mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Fix potential issue setting account (only happens sometimes)
This commit is contained in:
parent
d1e46422df
commit
fea6e5f704
1 changed files with 14 additions and 2 deletions
|
@ -58,16 +58,28 @@ class AccountSelectActivity : AppCompatActivity() {
|
||||||
showPinInputDialog(this@AccountSelectActivity, selectedAccount.lockPin, false) { pin ->
|
showPinInputDialog(this@AccountSelectActivity, selectedAccount.lockPin, false) { pin ->
|
||||||
if (pin == null) return@showPinInputDialog
|
if (pin == null) return@showPinInputDialog
|
||||||
// Pin is correct, proceed to main activity
|
// Pin is correct, proceed to main activity
|
||||||
DataStoreHelper.selectedKeyIndex = selectedAccount.keyIndex
|
setAccount(selectedAccount)
|
||||||
navigateToMainActivity()
|
navigateToMainActivity()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// No PIN set for the selected account, proceed to main activity
|
// No PIN set for the selected account, proceed to main activity
|
||||||
DataStoreHelper.selectedKeyIndex = selectedAccount.keyIndex
|
setAccount(selectedAccount)
|
||||||
navigateToMainActivity()
|
navigateToMainActivity()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setAccount(account: DataStoreHelper.Account) {
|
||||||
|
// Don't reload if it is the same account
|
||||||
|
if (DataStoreHelper.selectedKeyIndex == account.keyIndex) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
DataStoreHelper.selectedKeyIndex = account.keyIndex
|
||||||
|
|
||||||
|
MainActivity.bookmarksUpdatedEvent(true)
|
||||||
|
MainActivity.reloadHomeEvent(true)
|
||||||
|
}
|
||||||
|
|
||||||
private fun navigateToMainActivity() {
|
private fun navigateToMainActivity() {
|
||||||
val mainIntent = Intent(this, MainActivity::class.java)
|
val mainIntent = Intent(this, MainActivity::class.java)
|
||||||
startActivity(mainIntent)
|
startActivity(mainIntent)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue