mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-05-29 04:50:15 +02:00
feat(experimental): context menu fix
Attempt to repair the Friend Feed Menu as when the device is offline it cannot be displayed correctly Signed-off-by: rhunk <101876869+rhunk@users.noreply.github.com>
This commit is contained in:
parent
e45e96908b
commit
47a549ea2d
@ -1050,6 +1050,10 @@
|
||||
"name": "Edit Messages",
|
||||
"description": "Allows you to edit messages in conversations"
|
||||
},
|
||||
"context_menu_fix": {
|
||||
"name": "Context Menu Fix",
|
||||
"description": "Attempt to repair the Friend Feed Menu as when the device is offline it cannot be displayed correctly"
|
||||
},
|
||||
"app_lock": {
|
||||
"name": "App Lock",
|
||||
"description": "Prevents access to Snapchat without a passcode",
|
||||
|
@ -56,6 +56,7 @@ class Experimental : ConfigContainer() {
|
||||
val callRecorder = boolean("call_recorder") { requireRestart(); addNotices(FeatureNotice.UNSTABLE); }
|
||||
val accountSwitcher = container("account_switcher", AccountSwitcherConfig()) { requireRestart(); addNotices(FeatureNotice.UNSTABLE) }
|
||||
val editMessage = boolean("edit_message") { requireRestart() }
|
||||
val contextMenuFix = boolean("context_menu_fix") { requireRestart() }
|
||||
val cofExperiments = multiple("cof_experiments", *cofExperimentList.toTypedArray()) { requireRestart(); addFlags(ConfigFlag.NO_TRANSLATE); addNotices(FeatureNotice.UNSTABLE) }
|
||||
val appLock = container("app_lock", AppLockConfig()) { requireRestart(); addNotices(FeatureNotice.UNSTABLE) }
|
||||
val infiniteStoryBoost = boolean("infinite_story_boost")
|
||||
|
@ -129,6 +129,7 @@ class FeatureManager(
|
||||
ComposerHooks(),
|
||||
DisableCustomTabs(),
|
||||
BestFriendPinning(),
|
||||
ContextMenuFix(),
|
||||
)
|
||||
initializeFeatures()
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
package me.rhunk.snapenhance.core.features.impl.experiments
|
||||
|
||||
import me.rhunk.snapenhance.core.event.events.impl.UnaryCallEvent
|
||||
import me.rhunk.snapenhance.core.features.Feature
|
||||
import me.rhunk.snapenhance.core.features.FeatureLoadParams
|
||||
import java.nio.ByteBuffer
|
||||
|
||||
class ContextMenuFix: Feature("Context Menu Fix", loadParams = FeatureLoadParams.INIT_SYNC) {
|
||||
override fun init() {
|
||||
if (!context.config.experimental.contextMenuFix.get()) return
|
||||
context.event.subscribe(UnaryCallEvent::class) { event ->
|
||||
if (event.uri == "/snapchat.maps.device.MapDevice/IsPrimary") {
|
||||
event.canceled = true
|
||||
val unaryEventHandler = event.adapter.arg<Any>(3)
|
||||
runCatching {
|
||||
unaryEventHandler::class.java.methods.first { it.name == "onEvent" }.invoke(unaryEventHandler, ByteBuffer.wrap(
|
||||
byteArrayOf(8, 1)
|
||||
), null)
|
||||
}.onFailure {
|
||||
context.log.error(null, it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user