feat(config): require native hooks notice

This commit is contained in:
rhunk 2023-10-11 23:40:41 +02:00
parent 9d7556eafd
commit a01c2b09ca
7 changed files with 17 additions and 10 deletions

View File

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

View File

@ -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": {

View File

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

View File

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

View File

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

View File

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

View File

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