mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-21 18:10:33 +02:00
BugFix for restarting the relay connection when switching accounts after Amber's integration.
This commit is contained in:
@@ -142,6 +142,13 @@ object ServiceManager {
|
|||||||
LocalCache.pruneExpiredEvents()
|
LocalCache.pruneExpiredEvents()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun restartIfDifferentAccount(account: Account, context: Context) {
|
||||||
|
if (this.account != account) {
|
||||||
|
pause()
|
||||||
|
start(account, context)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object SingletonDiskCache {
|
object SingletonDiskCache {
|
||||||
|
@@ -88,7 +88,7 @@ class AccountStateViewModel(val context: Context) : ViewModel() {
|
|||||||
_accountContent.update { AccountState.LoggedInViewOnly(account) }
|
_accountContent.update { AccountState.LoggedInViewOnly(account) }
|
||||||
}
|
}
|
||||||
GlobalScope.launch(Dispatchers.IO) {
|
GlobalScope.launch(Dispatchers.IO) {
|
||||||
ServiceManager.start(account, context)
|
ServiceManager.restartIfDifferentAccount(account, context)
|
||||||
}
|
}
|
||||||
GlobalScope.launch(Dispatchers.Main) {
|
GlobalScope.launch(Dispatchers.Main) {
|
||||||
account.saveable.observeForever(saveListener)
|
account.saveable.observeForever(saveListener)
|
||||||
|
Reference in New Issue
Block a user