Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
weblate committed Jun 8, 2024
2 parents e399221 + c8819cf commit f4726b3
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
4 changes: 4 additions & 0 deletions common/src/main/assets/lang/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,10 @@
"name": "Default Volume Controls",
"description": "Forces Snapchat to use system volume controls"
},
"disable_telecom_framework": {
"name": "Disable Telecom Framework",
"description": "Prevents Snapchat from using the Android Telecom framework\nThis allows you to listen to music while on a call"
},
"hide_active_music": {
"name": "Hide Active Music",
"description": "Prevents Snapchat from knowing you're listening to music\nThis will allow you to take snaps using control volume buttons while listening to music"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class Global : ConfigContainer() {
val videoPlaybackRateSlider = boolean("video_playback_rate_slider") { requireRestart() }
val disableGooglePlayDialogs = boolean("disable_google_play_dialogs") { requireRestart() }
val defaultVolumeControls = boolean("default_volume_controls") { requireRestart() }
val disableTelecomFramework = boolean("disable_telecom_framework") { requireRestart() }
val hideActiveMusic = boolean("hide_active_music") { requireRestart() }
val disableSnapSplitting = boolean("disable_snap_splitting") { addNotices(FeatureNotice.INTERNAL_BEHAVIOR) }
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class FeatureManager(
DisableCustomTabs(),
BestFriendPinning(),
ContextMenuFix(),
DisableTelecomFramework(),
)
initializeFeatures()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,12 @@ package me.rhunk.snapenhance.core.features.impl.experiments
import android.os.ParcelFileDescriptor
import android.view.View
import android.widget.FrameLayout
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.BugReport
import androidx.compose.material3.Button
import androidx.compose.material3.FilledIconButton
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.material3.*
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
Expand Down Expand Up @@ -219,7 +211,6 @@ class ComposerHooks: Feature("ComposerHooks", loadParams = FeatureLoadParams.INI
}

findClass("com.snapchat.client.composer.NativeBridge").apply {
hook("createViewLoaderManager", HookStage.AFTER) { loadHooks() }
hook("registerNativeModuleFactory", HookStage.BEFORE) { param ->
val moduleFactory = param.argNullable<Any>(1) ?: return@hook
if (moduleFactory.javaClass.getMethod("getModulePath").invoke(moduleFactory)?.toString() != "DeviceBridge") return@hook
Expand All @@ -230,6 +221,7 @@ class ComposerHooks: Feature("ComposerHooks", loadParams = FeatureLoadParams.INI
true
}
}
loadHooks()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package me.rhunk.snapenhance.core.features.impl.global

import android.content.ContextWrapper
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 DisableTelecomFramework: Feature("Disable Telecom Framework", loadParams = FeatureLoadParams.INIT_SYNC) {
override fun init() {
if (!context.config.global.disableTelecomFramework.get()) return

ContextWrapper::class.java.hook("getSystemService", HookStage.BEFORE) { param ->
if (param.arg<Any>(0).toString() == "telecom") param.setResult(null)
}
}
}

0 comments on commit f4726b3

Please sign in to comment.