mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
accountsLoginLock.withLock{}
This commit is contained in:
parent
9b835f6627
commit
2374ba26e2
1 changed files with 19 additions and 10 deletions
|
@ -329,6 +329,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
|||
//private var mCastSession: CastSession? = null
|
||||
lateinit var mSessionManager: SessionManager
|
||||
private val mSessionManagerListener: SessionManagerListener<Session> by lazy { SessionManagerListenerImpl() }
|
||||
private val accountsLoginLock = Mutex()
|
||||
|
||||
private inner class SessionManagerListenerImpl : SessionManagerListener<Session> {
|
||||
override fun onSessionStarting(session: Session) {
|
||||
|
@ -507,11 +508,17 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
|||
val settingsManager = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
super.onStart()
|
||||
ioSafe {
|
||||
if (githubApi.getLatestLoginData() != null && settingsManager.getBoolean(getString(R.string.automatic_cloud_backups), true)){
|
||||
accountsLoginLock.withLock {
|
||||
if (githubApi.getLatestLoginData() != null && settingsManager.getBoolean(
|
||||
getString(R.string.automatic_cloud_backups),
|
||||
true
|
||||
)
|
||||
) {
|
||||
context?.restorePromptGithub()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
app.initClient(this)
|
||||
|
@ -605,6 +612,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
|||
|
||||
// init accounts
|
||||
ioSafe {
|
||||
accountsLoginLock.withLock{
|
||||
for (api in accountManagers) {
|
||||
api.init()
|
||||
}
|
||||
|
@ -617,6 +625,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SearchResultBuilder.updateCache(this)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue