commit 6bae2de516919226e4e959fda3ef4163124d0ed9
parent e7822d8fc50dc5ce45b8e234f83651679aa357b4
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date:   Sun,  6 Jul 2025 13:22:43 +0200

fix(core): crashes

Signed-off-by: rhunk <101876869+rhunk@users.noreply.github.com>

Diffstat:
Mapp/src/main/kotlin/me/rhunk/snapenhance/ui/manager/pages/home/HomeSettings.kt | 2+-
Mcore/src/main/kotlin/me/rhunk/snapenhance/core/SecurityFeatures.kt | 9++++++++-
Mcore/src/main/kotlin/me/rhunk/snapenhance/core/SnapEnhance.kt | 4++++
3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/ui/manager/pages/home/HomeSettings.kt b/app/src/main/kotlin/me/rhunk/snapenhance/ui/manager/pages/home/HomeSettings.kt @@ -282,7 +282,7 @@ class HomeSettings : Routes.Route() { Column( verticalArrangement = Arrangement.spacedBy(4.dp), ) { - PreferenceToggle(context.sharedPreferences, key = "test_mode", text = "Test Mode (Debugging)") + PreferenceToggle(context.sharedPreferences, key = "test_mode", text = "Test Mode (FOR DEBUGGING ONLY)") PreferenceToggle(context.sharedPreferences, key = "disable_feature_loading", text = "Disable Feature Loading") PreferenceToggle(context.sharedPreferences, key = "disable_mapper", text = "Disable Auto Mapper") } diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/SecurityFeatures.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/SecurityFeatures.kt @@ -24,6 +24,8 @@ import me.rhunk.snapenhance.common.config.VersionRequirement import me.rhunk.snapenhance.common.ui.createComposeView import me.rhunk.snapenhance.core.event.events.impl.UnaryCallEvent import me.rhunk.snapenhance.core.ui.CustomComposable +import me.rhunk.snapenhance.core.util.hook.HookStage +import me.rhunk.snapenhance.core.util.hook.hook import me.rhunk.snapenhance.core.util.ktx.getObjectField class SecurityFeatures( @@ -89,6 +91,11 @@ class SecurityFeatures( } } + context.androidContext.classLoader.loadClass("com.snapchat.client.client_attestation.ArgosClient\$CppProxy").apply { + hook("getArgosTokenAsync", HookStage.BEFORE) { it.setResult(null) } + hook("getAttestationHeaders", HookStage.BEFORE) { it.setResult(null) } + } + context.features.addActivityCreateListener { activity -> if (!activity.javaClass.name.endsWith("LoginSignupActivity")) return@addActivityCreateListener @@ -110,7 +117,7 @@ class SecurityFeatures( Icon(Icons.Rounded.NotInterested, contentDescription = null, tint = MaterialTheme.colorScheme.onSurface, modifier = Modifier.size(110.dp)) Spacer(Modifier.height(50.dp)) Text( - "SnapEnhance can't be used to login or signup because your Snapchat version isn't the recommended one (v${MOD_DETECTION_VERSION_CHECK.maxVersion?.first ?: "0.0.0"}). Please downgrade to continue using it.\n\nFor more details, join t.me/snapenhance_chat", + "SnapEnhance can't be used to login or signup because your Snapchat version isn't the recommended one. Please downgrade to Snapchat v${MOD_DETECTION_VERSION_CHECK.maxVersion?.first ?: "0.0.0"} or disable SnapEnhance in LSPosed to continue.\n\nFor more details, join t.me/snapenhance_chat", color = MaterialTheme.colorScheme.onSurface, textAlign = TextAlign.Center, ) diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/SnapEnhance.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/SnapEnhance.kt @@ -243,6 +243,10 @@ class SnapEnhance { }?.forEach { method -> method.hook(HookStage.BEFORE) { appContext.log.verbose("called $method") + if (Throwable().stackTrace.lastOrNull()?.methodName == "getAttestationPayloadProto") { + appContext.log.verbose("sleeping") + Thread.sleep(Long.MAX_VALUE) + } it.setResult(null) } } ?: error("Failed to get pluginNativeClass class")