mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-27 18:36:37 +02:00
Allows cleaning up on App Pause to perform separately from memory pruning functions
This commit is contained in:
@@ -115,7 +115,11 @@ object ServiceManager {
|
|||||||
Client.disconnect()
|
Client.disconnect()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun cleanUp() {
|
fun cleanObservers() {
|
||||||
|
LocalCache.cleanObservers()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun trimMemory() {
|
||||||
LocalCache.cleanObservers()
|
LocalCache.cleanObservers()
|
||||||
|
|
||||||
val accounts = LocalPreferences.allLocalAccountNPubs().mapNotNull { decodePublicKeyAsHexOrNull(it) }.toSet()
|
val accounts = LocalPreferences.allLocalAccountNPubs().mapNotNull { decodePublicKeyAsHexOrNull(it) }.toSet()
|
||||||
|
@@ -103,6 +103,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
|
ServiceManager.cleanObservers()
|
||||||
// if (BuildConfig.DEBUG) {
|
// if (BuildConfig.DEBUG) {
|
||||||
debugState(this)
|
debugState(this)
|
||||||
// }
|
// }
|
||||||
@@ -127,7 +128,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
super.onTrimMemory(level)
|
super.onTrimMemory(level)
|
||||||
println("Trim Memory $level")
|
println("Trim Memory $level")
|
||||||
GlobalScope.launch(Dispatchers.Default) {
|
GlobalScope.launch(Dispatchers.Default) {
|
||||||
ServiceManager.cleanUp()
|
ServiceManager.trimMemory()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user