mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-06-13 05:37:48 +02:00
feat(experimental): prevent forced logout
This commit is contained in:
@ -650,6 +650,10 @@
|
||||
"disable_composer_modules": {
|
||||
"name": "Disable Composer Modules",
|
||||
"description": "Prevents selected composer modules from being loaded\nNames must be separated by a comma"
|
||||
},
|
||||
"prevent_forced_logout": {
|
||||
"name": "Prevent Forced Logout",
|
||||
"description": "Prevents Snapchat from logging you out when you login on another device"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -32,4 +32,5 @@ class Experimental : ConfigContainer() {
|
||||
"added_by_community",
|
||||
) { addNotices(FeatureNotice.BAN_RISK) }
|
||||
val disableComposerModules = string("disable_composer_modules") { requireRestart(); nativeHooks() }
|
||||
val preventForcedLogout = boolean("prevent_forced_logout") { requireRestart(); addNotices(FeatureNotice.BAN_RISK, FeatureNotice.INTERNAL_BEHAVIOR); }
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package me.rhunk.snapenhance.core.features.impl.experiments
|
||||
|
||||
import android.content.Intent
|
||||
import me.rhunk.snapenhance.core.features.Feature
|
||||
import me.rhunk.snapenhance.core.features.FeatureLoadParams
|
||||
import me.rhunk.snapenhance.core.util.hook.HookStage
|
||||
import me.rhunk.snapenhance.core.util.hook.hook
|
||||
|
||||
class PreventForcedLogout : Feature("Prevent Forced Logout", loadParams = FeatureLoadParams.INIT_SYNC) {
|
||||
override fun init() {
|
||||
if (!context.config.experimental.preventForcedLogout.get()) return
|
||||
findClass("com.snap.identity.service.ForcedLogoutBroadcastReceiver").hook("onReceive", HookStage.BEFORE) { param ->
|
||||
val intent = param.arg<Intent>(1)
|
||||
if (!intent.getBooleanExtra("forced", false)) return@hook
|
||||
context.log.verbose("Prevent forced logout, reason=${intent.getStringExtra("reason")}")
|
||||
param.setResult(null)
|
||||
}
|
||||
}
|
||||
}
|
@ -114,6 +114,7 @@ class FeatureManager(
|
||||
DisableComposerModules::class,
|
||||
FideliusIndicator::class,
|
||||
EditTextOverride::class,
|
||||
PreventForcedLogout::class,
|
||||
)
|
||||
|
||||
initializeFeatures()
|
||||
|
Reference in New Issue
Block a user