fix prevent screenshots & status notifications

This commit is contained in:
rhunk
2023-05-17 14:34:37 +02:00
parent 2d7b69f7e3
commit 9977d6ae67
5 changed files with 11 additions and 53 deletions

View File

@@ -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",

View File

@@ -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
),

View File

@@ -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)
}
}
}

View File

@@ -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)
}
}
}
}

View File

@@ -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)