commit b0b20894a603bca88e822e7fc6830705d2ce5a37
parent 454a441fda070dc16ce105d6fc55d2b3bb6c98e8
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date:   Tue,  9 Apr 2024 19:44:52 +0200

feat(core): hide active music

Diffstat:
Mcommon/src/main/assets/lang/en_US.json | 4++++
Mcommon/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/Global.kt | 1+
Mcore/src/main/kotlin/me/rhunk/snapenhance/core/features/FeatureManager.kt | 1+
Acore/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/tweaks/HideActiveMusic.kt | 17+++++++++++++++++
4 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/common/src/main/assets/lang/en_US.json b/common/src/main/assets/lang/en_US.json @@ -669,6 +669,10 @@ "name": "Default Volume Controls", "description": "Forces Snapchat to use system volume controls" }, + "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" + }, "disable_snap_splitting": { "name": "Disable Snap Splitting", "description": "Prevents Snaps from being split into multiple parts\nPictures you send will turn into videos" diff --git a/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/Global.kt b/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/Global.kt @@ -42,5 +42,6 @@ class Global : ConfigContainer() { val disableGooglePlayDialogs = boolean("disable_google_play_dialogs") { requireRestart() } val forceUploadSourceQuality = boolean("force_upload_source_quality") { requireRestart() } val defaultVolumeControls = boolean("default_volume_controls") { requireRestart() } + val hideActiveMusic = boolean("hide_active_music") { requireRestart() } val disableSnapSplitting = boolean("disable_snap_splitting") { addNotices(FeatureNotice.INTERNAL_BEHAVIOR) } } \ No newline at end of file diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/FeatureManager.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/FeatureManager.kt @@ -127,6 +127,7 @@ class FeatureManager( BypassMessageActionRestrictions(), BetterLocation(), MediaFilePicker(), + HideActiveMusic(), ) initializeFeatures() diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/tweaks/HideActiveMusic.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/features/impl/tweaks/HideActiveMusic.kt @@ -0,0 +1,16 @@ +package me.rhunk.snapenhance.core.features.impl.tweaks + +import android.media.AudioManager +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 HideActiveMusic: Feature("Hide Active Music", loadParams = FeatureLoadParams.ACTIVITY_CREATE_SYNC) { + override fun onActivityCreate() { + if (!context.config.global.hideActiveMusic.get()) return + AudioManager::class.java.hook("isMusicActive", HookStage.BEFORE) { + it.setResult(false) + } + } +}+ \ No newline at end of file