commit a01c2b09ca9c344d8e95e92a0734c9cf544eb28d
parent 9d7556eafdbec30798e4cb74b7ed12d3ddb18c20
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date:   Wed, 11 Oct 2023 23:40:41 +0200

feat(config): require native hooks notice

Diffstat:
Mapp/src/main/kotlin/me/rhunk/snapenhance/ui/manager/sections/features/FeaturesSection.kt | 3++-
Mcommon/src/main/assets/lang/en_US.json | 3++-
Mcommon/src/main/kotlin/me/rhunk/snapenhance/common/config/ConfigObjects.kt | 7++++++-
Mcommon/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/Experimental.kt | 2+-
Mcommon/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/Global.kt | 4++--
Mcommon/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/MessagingTweaks.kt | 3++-
Mcommon/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/RootConfig.kt | 5++---
7 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/ui/manager/sections/features/FeaturesSection.kt b/app/src/main/kotlin/me/rhunk/snapenhance/ui/manager/sections/features/FeaturesSection.kt @@ -293,7 +293,8 @@ class FeaturesSection : Section() { val noticeColorMap = mapOf( FeatureNotice.UNSTABLE.key to Color(0xFFFFFB87), FeatureNotice.BAN_RISK.key to Color(0xFFFF8585), - FeatureNotice.INTERNAL_BEHAVIOR.key to Color(0xFFFFFB87) + FeatureNotice.INTERNAL_BEHAVIOR.key to Color(0xFFFFFB87), + FeatureNotice.REQUIRE_NATIVE_HOOKS.key to Color(0xFFFF5722), ) Card( diff --git a/common/src/main/assets/lang/en_US.json b/common/src/main/assets/lang/en_US.json @@ -121,7 +121,8 @@ "notices": { "unstable": "\u26A0 Unstable", "ban_risk": "\u26A0 This feature may cause bans", - "internal_behavior": "\u26A0 This may break Snapchat internal behavior" + "internal_behavior": "\u26A0 This may break Snapchat internal behavior", + "require_native_hooks": "\u26A0 This feature requires experimental Native Hooks to work correctly" }, "properties": { "downloader": { diff --git a/common/src/main/kotlin/me/rhunk/snapenhance/common/config/ConfigObjects.kt b/common/src/main/kotlin/me/rhunk/snapenhance/common/config/ConfigObjects.kt @@ -16,7 +16,8 @@ enum class FeatureNotice( ) { UNSTABLE(0b0001, "unstable"), BAN_RISK(0b0010, "ban_risk"), - INTERNAL_BEHAVIOR(0b0100, "internal_behavior") + INTERNAL_BEHAVIOR(0b0100, "internal_behavior"), + REQUIRE_NATIVE_HOOKS(0b1000, "require_native_hooks"), } enum class ConfigFlag( @@ -50,6 +51,10 @@ class ConfigParams( this._flags = (this._flags ?: 0) or values.fold(0) { acc, flag -> acc or flag.id } } + fun nativeHooks() { + addNotices(FeatureNotice.REQUIRE_NATIVE_HOOKS) + } + fun requireRestart() { addFlags(ConfigFlag.REQUIRE_RESTART) } diff --git a/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/Experimental.kt b/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/Experimental.kt @@ -18,7 +18,7 @@ class Experimental : ConfigContainer() { val meoPasscodeBypass = boolean("meo_passcode_bypass") val unlimitedMultiSnap = boolean("unlimited_multi_snap") { addNotices(FeatureNotice.BAN_RISK)} val noFriendScoreDelay = boolean("no_friend_score_delay") { requireRestart()} - val e2eEncryption = container("e2ee", E2EEConfig()) { requireRestart()} + val e2eEncryption = container("e2ee", E2EEConfig()) { requireRestart(); nativeHooks() } val hiddenSnapchatPlusFeatures = boolean("hidden_snapchat_plus_features") { addNotices(FeatureNotice.BAN_RISK, FeatureNotice.UNSTABLE) requireRestart() 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 @@ -8,11 +8,11 @@ class Global : ConfigContainer() { val coordinates = mapCoordinates("coordinates", 0.0 to 0.0) { requireRestart()} // lat, long } val spoofLocation = container("spoofLocation", SpoofLocation()) - val snapchatPlus = boolean("snapchat_plus") { addNotices(FeatureNotice.BAN_RISK); requireRestart() } + val snapchatPlus = boolean("snapchat_plus") { requireRestart() } val disableMetrics = boolean("disable_metrics") val blockAds = boolean("block_ads") val bypassVideoLengthRestriction = unique("bypass_video_length_restriction", "split", "single") { addNotices( - FeatureNotice.BAN_RISK); requireRestart() } + FeatureNotice.BAN_RISK); requireRestart(); nativeHooks() } val disableGooglePlayDialogs = boolean("disable_google_play_dialogs") { requireRestart() } val forceMediaSourceQuality = boolean("force_media_source_quality") val disableSnapSplitting = boolean("disable_snap_splitting") { addNotices(FeatureNotice.INTERNAL_BEHAVIOR) } diff --git a/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/MessagingTweaks.kt b/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/MessagingTweaks.kt @@ -19,12 +19,13 @@ class MessagingTweaks : ConfigContainer() { ) { requireRestart() } val preventMessageSending = multiple("prevent_message_sending", *NotificationType.getOutgoingValues().map { it.key }.toTypedArray()) { customOptionTranslationPath = "features.options.notifications" + nativeHooks() } val betterNotifications = multiple("better_notifications", "snap", "chat", "reply_button", "download_button", "group") { requireRestart() } val notificationBlacklist = multiple("notification_blacklist", *NotificationType.getIncomingValues().map { it.key }.toTypedArray()) { customOptionTranslationPath = "features.options.notifications" } val messageLogger = boolean("message_logger") { addNotices(FeatureNotice.UNSTABLE); requireRestart() } - val galleryMediaSendOverride = boolean("gallery_media_send_override") + val galleryMediaSendOverride = boolean("gallery_media_send_override") { nativeHooks() } val messagePreviewLength = integer("message_preview_length", defaultValue = 20) } \ No newline at end of file diff --git a/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/RootConfig.kt b/common/src/main/kotlin/me/rhunk/snapenhance/common/config/impl/RootConfig.kt @@ -11,8 +11,7 @@ class RootConfig : ConfigContainer() { val rules = container("rules", Rules()) { icon = "Rule" } val camera = container("camera", Camera()) { icon = "Camera"; requireRestart() } val streaksReminder = container("streaks_reminder", StreaksReminderConfig()) { icon = "Alarm" } - val experimental = container("experimental", Experimental()) { - icon = "Science"; addNotices(FeatureNotice.UNSTABLE) - } + val experimental = container("experimental", Experimental()) { icon = "Science"; addNotices( + FeatureNotice.UNSTABLE) } val scripting = container("scripting", Scripting()) { icon = "DataObject" } } \ No newline at end of file