mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-05-30 05:20:18 +02:00
fix(core): sync remote in background
This commit is contained in:
parent
eb3ea2675b
commit
5563418d79
@ -114,10 +114,12 @@ class SnapEnhance {
|
||||
appContext.isMainActivityPaused = false
|
||||
}) {
|
||||
appContext.reloadConfig()
|
||||
appContext.executeAsync {
|
||||
syncRemote()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun init(scope: CoroutineScope) {
|
||||
with(appContext) {
|
||||
@ -134,6 +136,11 @@ class SnapEnhance {
|
||||
initWidgetListener()
|
||||
initNative()
|
||||
scope.launch(Dispatchers.IO) {
|
||||
runCatching {
|
||||
syncRemote()
|
||||
}.onFailure {
|
||||
log.error("Failed to sync remote", it)
|
||||
}
|
||||
translation.userLocale = getConfigLocale()
|
||||
translation.loadFromCallback { locale ->
|
||||
bridgeClient.fetchLocales(locale)
|
||||
@ -257,10 +264,9 @@ class SnapEnhance {
|
||||
}
|
||||
|
||||
private fun syncRemote() {
|
||||
appContext.executeAsync {
|
||||
bridgeClient.sync(object : SyncCallback.Stub() {
|
||||
appContext.bridgeClient.sync(object : SyncCallback.Stub() {
|
||||
override fun syncFriend(uuid: String): String? {
|
||||
return database.getFriendInfo(uuid)?.let {
|
||||
return appContext.database.getFriendInfo(uuid)?.let {
|
||||
MessagingFriendInfo(
|
||||
userId = it.userId!!,
|
||||
displayName = it.displayName,
|
||||
@ -278,7 +284,7 @@ class SnapEnhance {
|
||||
}
|
||||
|
||||
override fun syncGroup(uuid: String): String? {
|
||||
return database.getFeedEntryByConversationId(uuid)?.let {
|
||||
return appContext.database.getFeedEntryByConversationId(uuid)?.let {
|
||||
MessagingGroupInfo(
|
||||
it.key!!,
|
||||
it.feedDisplayName!!,
|
||||
@ -288,7 +294,6 @@ class SnapEnhance {
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun jetpackComposeResourceHook() {
|
||||
val material3RString = try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user