fix(bridge): auto bridge restart on SnapEnhance update

Signed-off-by: rhunk <101876869+rhunk@users.noreply.github.com>
This commit is contained in:
rhunk
2024-06-12 16:20:24 +02:00
parent 248100b8b9
commit 6c87e72d94
3 changed files with 11 additions and 3 deletions

View File

@@ -42,6 +42,7 @@ class BridgeClient(
private lateinit var service: BridgeInterface
private val onConnectedCallbacks = mutableListOf<suspend () -> Unit>()
private var cacheSnapEnhanceApkPath: String? = null
fun addOnConnectedCallback(callback: suspend () -> Unit) {
synchronized(onConnectedCallbacks) {
@@ -123,6 +124,13 @@ class BridgeClient(
}
}
}
cacheSnapEnhanceApkPath = this.service.applicationApkPath.also {
if (cacheSnapEnhanceApkPath != null && cacheSnapEnhanceApkPath != it) {
context.log.verbose("Restarting Snapchat due to SnapEnhance update")
context.softRestartApp()
return
}
}
resumeContinuation(true)
}

View File

@@ -414,8 +414,8 @@ class FriendFeedInfoMenu : AbstractMenu() {
state = !ruleFeature.getState(conversationId)
ruleFeature.setState(conversationId, state)
context.inAppOverlay.showStatusToast(
if (ruleFeature.getState(conversationId)) Icons.Default.CheckCircleOutline else Icons.Default.NotInterested,
context.translation.format("rules.toasts.${if (ruleFeature.getState(conversationId)) "enabled" else "disabled"}", "ruleName" to context.translation[ruleFeature.ruleType.translateOptionKey(ruleState.key)]),
if (state) Icons.Default.CheckCircleOutline else Icons.Default.NotInterested,
context.translation.format("rules.toasts.${if (state) "enabled" else "disabled"}", "ruleName" to context.translation[ruleFeature.ruleType.translateOptionKey(ruleState.key)]),
durationMs = 1500
)
context.mainActivity?.triggerRootCloseTouchEvent()