commit 9977d6ae674f07d7e5882f5e29118c5b9589ab44
parent 2d7b69f7e30bb173a0b8c1ea5098de1971136746
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date:   Wed, 17 May 2023 14:34:37 +0200

fix prevent screenshots & status notifications

Diffstat:
Mapp/src/main/assets/lang/en.json | 4++--
Mapp/src/main/kotlin/me/rhunk/snapenhance/config/ConfigProperty.kt | 6+++---
Dapp/src/main/kotlin/me/rhunk/snapenhance/features/impl/privacy/PreventScreenshotDetections.kt | 17-----------------
Dapp/src/main/kotlin/me/rhunk/snapenhance/features/impl/spy/PreventStatusNotifications.kt | 28----------------------------
Mapp/src/main/kotlin/me/rhunk/snapenhance/manager/impl/FeatureManager.kt | 10++++++----
5 files changed, 11 insertions(+), 54 deletions(-)

diff --git a/app/src/main/assets/lang/en.json b/app/src/main/assets/lang/en.json @@ -24,8 +24,8 @@ "download_inchat_snaps": "Download Inchat Snaps", "anti_auto_download_button": "Anti Auto Download Button", "disable_metrics": "Disable Metrics", - "prevent_screenshots": "Prevent Screenshots", - "prevent_status_notifications": "Prevent Status Notifications (Screenrecord, media save)", + "prevent_screenshot_notifications": "Prevent Screenshot Notifications", + "prevent_status_notifications": "Prevent Status Notifications (Save to camera roll, missed calls)", "anonymous_story_view": "Anonymous Story View", "hide_typing_notification": "Hide Typing Notification", "menu_slot_id": "Friend Menu Slot ID", diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/config/ConfigProperty.kt b/app/src/main/kotlin/me/rhunk/snapenhance/config/ConfigProperty.kt @@ -81,9 +81,9 @@ enum class ConfigProperty( ), DISABLE_METRICS("property.disable_metrics", "description.disable_metrics", ConfigCategory.PRIVACY, true), - PREVENT_SCREENSHOTS( - "property.prevent_screenshots", - "description.prevent_screenshots", + PREVENT_SCREENSHOT_NOTIFICATIONS( + "property.prevent_screenshot_notifications", + "description.prevent_screenshot_notifications", ConfigCategory.PRIVACY, true ), diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/privacy/PreventScreenshotDetections.kt b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/privacy/PreventScreenshotDetections.kt @@ -1,16 +0,0 @@ -package me.rhunk.snapenhance.features.impl.privacy - -import android.database.ContentObserver -import me.rhunk.snapenhance.config.ConfigProperty -import me.rhunk.snapenhance.features.Feature -import me.rhunk.snapenhance.features.FeatureLoadParams -import me.rhunk.snapenhance.hook.HookStage -import me.rhunk.snapenhance.hook.Hooker - -class PreventScreenshotDetections : Feature("Prevent Screenshot Detections", loadParams = FeatureLoadParams.ACTIVITY_CREATE_ASYNC) { - override fun asyncOnActivityCreate() { - Hooker.hook(ContentObserver::class.java,"dispatchChange", HookStage.BEFORE, { context.config.bool(ConfigProperty.PREVENT_SCREENSHOTS) }) { - it.setResult(null) - } - } -}- \ No newline at end of file diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spy/PreventStatusNotifications.kt b/app/src/main/kotlin/me/rhunk/snapenhance/features/impl/spy/PreventStatusNotifications.kt @@ -1,28 +0,0 @@ -package me.rhunk.snapenhance.features.impl.spy - -import me.rhunk.snapenhance.config.ConfigProperty -import me.rhunk.snapenhance.data.ContentType -import me.rhunk.snapenhance.features.Feature -import me.rhunk.snapenhance.features.FeatureLoadParams -import me.rhunk.snapenhance.hook.HookStage -import me.rhunk.snapenhance.hook.Hooker -import me.rhunk.snapenhance.util.getObjectField - - -class PreventStatusNotifications : Feature("PreventStatusNotifications", loadParams = FeatureLoadParams.ACTIVITY_CREATE_ASYNC) { - override fun asyncOnActivityCreate() { - Hooker.hook( - context.classCache.conversationManager, - "sendMessageWithContent", - HookStage.BEFORE, - {context.config.bool(ConfigProperty.PREVENT_STATUS_NOTIFICATIONS) }) { param -> - val contentTypeString = (param.arg(1) as Any).getObjectField("mContentType") - - if (contentTypeString == ContentType.STATUS_SAVE_TO_CAMERA_ROLL.name || - contentTypeString == ContentType.STATUS_CONVERSATION_CAPTURE_SCREENSHOT.name || - contentTypeString == ContentType.STATUS_CONVERSATION_CAPTURE_RECORD.name) { - param.setResult(null) - } - } - } -} diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/manager/impl/FeatureManager.kt b/app/src/main/kotlin/me/rhunk/snapenhance/manager/impl/FeatureManager.kt @@ -13,8 +13,11 @@ import me.rhunk.snapenhance.features.impl.extras.ExternalMediaAsSnap import me.rhunk.snapenhance.features.impl.extras.Notifications import me.rhunk.snapenhance.features.impl.extras.SnapchatPlus import me.rhunk.snapenhance.features.impl.privacy.DisableMetrics -import me.rhunk.snapenhance.features.impl.privacy.PreventScreenshotDetections -import me.rhunk.snapenhance.features.impl.spy.* +import me.rhunk.snapenhance.features.impl.privacy.PreventMessageSending +import me.rhunk.snapenhance.features.impl.spy.AnonymousStoryViewing +import me.rhunk.snapenhance.features.impl.spy.MessageLogger +import me.rhunk.snapenhance.features.impl.spy.PreventReadReceipts +import me.rhunk.snapenhance.features.impl.spy.StealthMode import me.rhunk.snapenhance.features.impl.ui.UITweaks import me.rhunk.snapenhance.features.impl.ui.menus.MenuViewInjector import me.rhunk.snapenhance.manager.Manager @@ -52,8 +55,7 @@ class FeatureManager(private val context: ModContext) : Manager { register(MessageLogger::class) register(SnapchatPlus::class) register(DisableMetrics::class) - register(PreventScreenshotDetections::class) - register(PreventStatusNotifications::class) + register(PreventMessageSending::class) register(Notifications::class) register(AutoSave::class) register(UITweaks::class)