commit 87030eca7e88465cabcb909e3c98fc85c567a343
parent 29e552569e00fba9b9fd560451b2796952ae9d5d
Author: rhunk <101876869+rhunk@users.noreply.github.com>
Date:   Thu, 17 Aug 2023 17:39:07 +0200

feat: ui
- feature icons, notices

Diffstat:
Mapp/src/main/kotlin/me/rhunk/snapenhance/ui/manager/Section.kt | 8++++----
Mapp/src/main/kotlin/me/rhunk/snapenhance/ui/manager/sections/features/FeaturesSection.kt | 33+++++++++++++++++++++++++++++++++
Mcore/src/main/assets/lang/en_US.json | 349+++++++++++++++++++++++++++++++++++++++----------------------------------------
Mcore/src/main/kotlin/me/rhunk/snapenhance/core/config/ConfigContainer.kt | 5+++--
Mcore/src/main/kotlin/me/rhunk/snapenhance/core/config/ConfigObjects.kt | 11+++++++++--
Acore/src/main/kotlin/me/rhunk/snapenhance/core/config/FeatureNotice.kt | 13+++++++++++++
Mcore/src/main/kotlin/me/rhunk/snapenhance/core/config/impl/Camera.kt | 5+++--
Mcore/src/main/kotlin/me/rhunk/snapenhance/core/config/impl/DownloaderConfig.kt | 3++-
Mcore/src/main/kotlin/me/rhunk/snapenhance/core/config/impl/Global.kt | 8+++++---
Mcore/src/main/kotlin/me/rhunk/snapenhance/core/config/impl/MessagingTweaks.kt | 6+++---
Mcore/src/main/kotlin/me/rhunk/snapenhance/core/config/impl/RootConfig.kt | 14+++++++-------
Mcore/src/main/kotlin/me/rhunk/snapenhance/core/config/impl/UserInterfaceTweaks.kt | 6+++---
Mcore/src/main/kotlin/me/rhunk/snapenhance/features/impl/ConfigurationOverride.kt | 4++--
Mcore/src/main/kotlin/me/rhunk/snapenhance/features/impl/downloader/MediaDownloader.kt | 4++--
Mcore/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/UITweaks.kt | 2+-
15 files changed, 262 insertions(+), 209 deletions(-)

diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/ui/manager/Section.kt b/app/src/main/kotlin/me/rhunk/snapenhance/ui/manager/Section.kt @@ -2,8 +2,8 @@ package me.rhunk.snapenhance.ui.manager import androidx.compose.foundation.layout.RowScope import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.BugReport import androidx.compose.material.icons.filled.Download +import androidx.compose.material.icons.filled.Extension import androidx.compose.material.icons.filled.Group import androidx.compose.material.icons.filled.Home import androidx.compose.material.icons.filled.Stars @@ -43,9 +43,9 @@ enum class EnumSection( route = "friends", icon = Icons.Filled.Group ), - DEBUG( - route = "debug", - icon = Icons.Filled.BugReport + PLUGINS( + route = "plugins", + icon = Icons.Filled.Extension ); companion object { 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 @@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth @@ -41,6 +42,8 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp @@ -275,6 +278,26 @@ class FeaturesSection : Section() { .padding(all = 4.dp), horizontalArrangement = Arrangement.SpaceBetween ) { + property.key.params.icon?.let { iconName -> + //TODO: find a better way to load icons + val icon: ImageVector? = remember(iconName) { + runCatching { + val cl = Class.forName("androidx.compose.material.icons.filled.${iconName}Kt") + val method = cl.declaredMethods.first() + method.invoke(null, Icons.Filled) as ImageVector + }.getOrNull() + } + if (icon != null) { + Icon( + imageVector = icon, + contentDescription = null, + modifier = Modifier + .align(Alignment.CenterVertically) + .padding(start = 10.dp) + ) + } + } + Column( modifier = Modifier .align(Alignment.CenterVertically) @@ -291,6 +314,16 @@ class FeaturesSection : Section() { fontSize = 12.sp, lineHeight = 15.sp ) + property.key.params.notices.also { + if (it.isNotEmpty()) Spacer(modifier = Modifier.height(5.dp)) + }.forEach { + Text( + text = context.translation["features.notices.${it.key}"], + color = Color.Yellow, + fontSize = 12.sp, + lineHeight = 15.sp + ) + } } Row( diff --git a/core/src/main/assets/lang/en_US.json b/core/src/main/assets/lang/en_US.json @@ -8,10 +8,9 @@ }, "mappings": { "dialog": "To support a wide range of versions, mappings need to be generated for the current snapchat version.", - "snapchat_not_found": "Snapchat could not be found on your device. Please install Snapchat and try again.", - "snapchat_not_supported": "Snapchat is not supported. Please update Snapchat and try again.", "generate_button": "Generate", - "generate_error": "An error occurred while generating mappings. Please try again.", + "generate_failure_no_snapchat": "Snapchat could not be found on your device. Please install Snapchat and try again.", + "generate_failure": "An error occurred while generating mappings. Please try again.", "generate_success": "Mappings generated successfully." } }, @@ -22,7 +21,7 @@ "features": "Features", "home": "Home", "friends": "Friends", - "debug": "Debug" + "plugins": "Plugins" }, "features": { "disabled": "Disabled" @@ -39,6 +38,12 @@ }, "features": { + "notices": { + "unstable": "This feature is unstable and may not work as expected", + "may_ban": "This feature may get you banned\nUse at your own risk", + "may_break_internal_behavior": "This feature may break Snapchat internal behavior", + "may_cause_crashes": "This feature may cause crashes" + }, "properties": { "spoof": { "name": "Spoof", @@ -65,6 +70,26 @@ "auto_download_options": { "name": "Auto Download Options", "description": "Select which medias to auto download" + }, + "path_format": { + "name": "Path Format", + "description": "Specify the file path format" + }, + "allow_duplicate": { + "name": "Allow Duplicate", + "description": "Allows the same media to be downloaded multiple times" + }, + "merge_overlays": { + "name": "Merge Overlays", + "description": "Combines the text and the media of a Snap into a single file" + }, + "chat_download_context_menu": { + "name": "Chat Download Context Menu", + "description": "Allows to download messages from a conversation by long pressing them" + }, + "logging": { + "name": "Logging", + "description": "Shows toasts when media is downloading" } } }, @@ -124,19 +149,155 @@ }, "messaging": { "name": "Messaging", - "description": "Change how you interact with friends" + "description": "Change how you interact with friends", + "properties": { + "anonymous_story_viewing": { + "name": "Anonymous Story Viewing", + "description": "Prevents anyone from knowing you've seen their story" + }, + "prevent_read_receipts": { + "name": "Prevent Read Receipts", + "description": "Prevent anyone from knowing you've opened their Snaps/Chats" + }, + "hide_bitmoji_presence": { + "name": "Hide Bitmoji Presence", + "description": "Hides your Bitmoji presence from the chat" + }, + "hide_typing_notifications": { + "name": "Hide Typing Notifications", + "description": "Prevents anyone from knowing you're typing in a conversation" + }, + "unlimited_snap_view_time": { + "name": "Unlimited Snap View Time", + "description": "Removes the time limit for viewing Snaps" + }, + "prevent_message_sending": { + "name": "Prevent Message Sending", + "description": "Prevents sending certain types of messages" + }, + "message_logger": { + "name": "Message Logger", + "description": "Keeps messages when someone deletes them. This only works for messages deleted after enabling this feature" + }, + "auto_save_messages_in_conversations": { + "name": "Auto Save Messages", + "description": "Automatically saves messages in conversations" + }, + "gallery_media_send_override": { + "name": "Gallery Media Send Override", + "description": "Convert a gallery media to a specific media type before it's sent" + }, + "message_preview_length": { + "name": "Message Preview Length", + "description": "Specify the amount of messages to be previewed" + } + } }, "global": { "name": "Global", - "description": "Tweak Snapchat globally" + "description": "Tweak Snapchat globally", + "properties": { + "snapchat_plus": { + "name": "Snapchat Plus", + "description": "Enables Snapchat Plus features (some features may not work)" + }, + "auto_updater": { + "name": "Auto Updater", + "description": "Automatically checks for new updates" + }, + "disable_metrics": { + "name": "Disable Metrics", + "description": "Disables some analytics data sent to Snapchat" + }, + "block_ads": { + "name": "Block Ads", + "description": "Prevent ads from being displayed" + }, + "disable_video_length_restrictions": { + "name": "Disable Video Length Restrictions", + "description": "Prevents Snapchat from blocking videos that are too long" + }, + "disable_google_play_dialogs": { + "name": "Disable Google Play Services Dialogs", + "description": "Prevent Google Play Services availability dialogs from being shown" + }, + "force_media_source_quality": { + "name": "Force Media Source Quality", + "description": "Overrides the media quality to the highest possible" + }, + "better_notifications": { + "name": "Better Notifications", + "description": "Adds more information in received notifications" + }, + "notification_blacklist": { + "name": "Notification Blacklist", + "description": "Select the notifications to be blocked" + }, + "disable_snap_splitting": { + "name": "Disable Snap Splitting", + "description": "Prevents Snaps from being split into multiple parts. It also convert sent images into videos" + } + } }, "camera": { "name": "Camera", - "description": "Adjust the right settings for the perfect snap" + "description": "Adjust the right settings for the perfect snap", + "properties": { + "disable_camera": { + "name": "Disable Camera", + "description": "Prevents Snapchat from using the cameras available on your device" + }, + "immersive_camera_preview": { + "name": "Immersive Preview", + "description": "Stops Snapchat from cropping the camera preview. It might cause flickering on some devices" + }, + "override_preview_resolution": { + "name": "Override Preview Resolution", + "description": "Overrides the camera preview resolution" + }, + "override_picture_resolution": { + "name": "Override Picture Resolution", + "description": "Overrides the picture resolution" + }, + "force_highest_frame_rate": { + "name": "Force Highest Frame Rate", + "description": "Forces the highest possible frame rate" + }, + "force_camera_source_encoding": { + "name": "Force Camera Source Encoding", + "description": "Forces the camera source encoding" + } + } }, "experimental": { "name": "Experimental", - "description": "Experimental features" + "description": "Experimental features", + "properties": { + "app_passcode": { + "name": "App Passcode", + "description": "Sets a passcode to lock the app" + }, + "app_lock_on_resume": { + "name": "App Lock On Resume", + "description": "Locks the app when it's reopened" + }, + "infinite_story_boost": { + "name": "Infinite Story Boost", + "description": "Bypass the story boost limit delay" + }, + "meo_passcode_bypass": { + "name": "My Eyes Only Passcode Bypass", + "description": "Bypass the My Eyes Only passcode\nThis will only work if the passcode has been entered correctly before" + }, + "unlimited_multi_snap": { + "name": "Unlimited Multi Snap", + "description": "Allows you to take an unlimited amount of multi snaps" + }, + "no_friend_score_delay": { + "name": "No Friend Score Delay", + "description": "Removes the delay when viewing a friends score" + } + } } }, "options": { @@ -152,14 +313,12 @@ "stealth_mode": "\uD83D\uDC7B Stealth Mode", "conversation_info": "\uD83D\uDC64 Conversation Info" }, - "download_options": { - "allow_duplicate": "Allow duplicate downloads", + "path_format": { "create_user_folder": "Create folder for each user", "append_hash": "Add a unique hash to the file name", "append_username": "Add the username to the file name", "append_date_time": "Add the date and time to the file name", - "append_type": "Add the media type to the file name", - "merge_overlay": "Merge Snap Image Overlays" + "append_type": "Add the media type to the file name" }, "auto_download_options": { "friend_snaps": "Friend Snaps", @@ -167,7 +326,7 @@ "public_stories": "Public Stories", "spotlight": "Spotlight" }, - "download_logging": { + "logging": { "started": "Started", "success": "Success", "progress": "Progress", @@ -233,170 +392,6 @@ "ngs_spotlight_icon_container": "Spotlight", "ngs_search_icon_container": "Search" } - }, - - "temp": { - "message_logger": { - "name": "Message Logger", - "description": "Prevents messages from being deleted" - }, - "prevent_read_receipts": { - "name": "Prevent Read Receipts", - "description": "Prevent anyone from knowing you've opened their Snaps" - }, - "hide_bitmoji_presence": { - "name": "Hide Bitmoji Presence", - "description": "Hides your Bitmoji presence from the chat" - }, - "better_notifications": { - "name": "Better Notifications", - "description": "Shows more information in notifications" - }, - "notification_blacklist": { - "name": "Notification Blacklist", - "description": "Hides selected notification type" - }, - "disable_metrics": { - "name": "Disable Metrics", - "description": "Disables metrics sent to Snapchat" - }, - "block_ads": { - "name": "Block Ads", - "description": "Blocks ads from being displayed" - }, - "unlimited_snap_view_time": { - "name": "Unlimited Snap View Time", - "description": "Removes the time limit for viewing Snaps" - }, - "prevent_sending_messages": { - "name": "Prevent Sending Messages", - "description": "Prevents sending certain types of messages" - }, - "anonymous_story_view": { - "name": "Anonymous Story View", - "description": "Prevents anyone from knowing you've seen their story" - }, - "hide_typing_notification": { - "name": "Hide Typing Notification", - "description": "Prevents typing notifications being sent" - }, - - "download_options": { - "name": "Download Options", - "description": "Specify the file path format" - }, - "chat_download_context_menu": { - "name": "Chat Download Context Menu", - "description": "Enable the chat download context menu" - }, - "gallery_media_send_override": { - "name": "Gallery Media Send Override", - "description": "Overrides media sent from the gallery" - }, - "auto_save_messages": { - "name": "Auto Save Messages", - "description": "Select which type of messages to auto save" - }, - "force_media_source_quality": { - "name": "Force Media Source Quality", - "description": "Overrides the media source quality" - }, - "download_logging": { - "name": "Download Logging", - "description": "Show a toast when media is downloading" - }, - - "disable_snap_splitting": { - "name": "Disable Snap Splitting", - "description": "Prevents Snaps from being split into multiple parts" - }, - "disable_video_length_restriction": { - "name": "Disable Video Length Restriction", - "description": "Disables video length restrictions" - }, - "snapchat_plus": { - "name": "Snapchat Plus", - "description": "Enables Snapchat Plus features" - }, - "location_spoof": { - "name": "Snapmap Location Spoofer", - "description": "Spoofs your location on the Snapmap" - }, - "message_preview_length": { - "name": "Message Preview Length", - "description": "Specify the amount of messages to be previewed" - }, - "unlimited_conversation_pinning": { - "name": "Unlimited Conversation Pinning", - "description": "Enables the ability to pin unlimited conversations" - }, - "disable_google_play_dialogs": { - "name": "Disable Google Play Services Dialogs", - "description": "Prevent Google Play Services availability dialogs from being shown" - }, - - "auto_updater": { - "name": "Auto Updater", - "description": "The interval of checking for updates" - }, - - "disable_camera": { - "name": "Disable Camera", - "description": "Prevents Snapchat from being able to use the camera" - }, - "immersive_camera_preview": { - "name": "Immersive Camera Preview", - "description": "Stops Snapchat from cropping the camera preview" - }, - "preview_resolution": { - "name": "Preview Resolution", - "description": "Overrides the camera preview resolution" - }, - "picture_resolution": { - "name": "Picture Resolution", - "description": "Overrides the picture resolution" - }, - "force_highest_frame_rate": { - "name": "Force Highest Frame Rate", - "description": "Forces the highest possible frame rate" - }, - "force_camera_source_encoding": { - "name": "Force Camera Source Encoding", - "description": "Forces the camera source encoding" - }, - - "app_passcode": { - "name": "Set App Passcode", - "description": "Sets a passcode to lock the app" - }, - "app_lock_on_resume": { - "name": "App Lock On Resume", - "description": "Locks the app when it's reopened" - }, - "infinite_story_boost": { - "name": "Infinite Story Boost", - "description": "Infinitely boosts your story" - }, - "meo_passcode_bypass": { - "name": "My Eyes Only Passcode Bypass", - "description": "Bypass the My Eyes Only passcode\nThis will only work if the passcode has been entered correctly before" - }, - "unlimited_multi_snap": { - "name": "Unlimited Multi Snap", - "description": "Allows you to take an unlimited amount of multi snaps" - }, - "device_spoof": { - "name": "Spoof Device Values", - "description": "Spoofs the devices values" - }, - "device_fingerprint": { - "name": "Device Fingerprint", - "description": "Spoofs the device fingerprint" - }, - "android_id": { - "name": "Android ID", - "description": "Spoofs the devices Android ID" - } } }, diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/config/ConfigContainer.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/config/ConfigContainer.kt @@ -53,8 +53,9 @@ open class ConfigContainer( protected fun <T : ConfigContainer> container( key: String, - container: T - ) = registerProperty(key, DataProcessors.container(container), PropertyValue(container)) { + container: T, + params: ConfigParamsBuilder = {} + ) = registerProperty(key, DataProcessors.container(container), PropertyValue(container), params) { container.parentContainerKey = it }.get() diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/config/ConfigObjects.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/config/ConfigObjects.kt @@ -11,11 +11,18 @@ data class PropertyPair<T>( } class ConfigParams( + private var _notices: Int? = null, var shouldTranslate: Boolean = true, var isHidden: Boolean = false, var isFolder: Boolean = false, - val disabledKey: String? = null -) + var disabledKey: String? = null, + var icon: String? = null +) { + val notices get() = _notices?.let { FeatureNotice.values().filter { flag -> it and flag.id != 0 } } ?: emptyList() + fun addNotices(vararg flags: FeatureNotice) { + this._notices = (this._notices ?: 0) or flags.fold(0) { acc, featureNotice -> acc or featureNotice.id } + } +} class PropertyValue<T>( private var value: T? = null, diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/config/FeatureNotice.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/config/FeatureNotice.kt @@ -0,0 +1,12 @@ +package me.rhunk.snapenhance.core.config + + +enum class FeatureNotice( + val id: Int, + val key: String +) { + UNSTABLE(0b0001, "unstable"), + MAY_BAN(0b0010, "may_ban"), + MAY_BREAK_INTERNAL_BEHAVIOR(0b0100, "may_break_internal_behavior"), + MAY_CAUSE_CRASHES(0b1000, "may_cause_crashes"); +}+ \ No newline at end of file diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/config/impl/Camera.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/config/impl/Camera.kt @@ -1,15 +1,16 @@ package me.rhunk.snapenhance.core.config.impl import me.rhunk.snapenhance.core.config.ConfigContainer +import me.rhunk.snapenhance.core.config.FeatureNotice import me.rhunk.snapenhance.features.impl.tweaks.CameraTweaks class Camera : ConfigContainer() { val disable = boolean("disable_camera") - val immersiveCameraPreview = boolean("immersive_camera_preview") + val immersiveCameraPreview = boolean("immersive_camera_preview") { addNotices(FeatureNotice.MAY_CAUSE_CRASHES) } val overridePreviewResolution = unique("override_preview_resolution", *CameraTweaks.resolutions.toTypedArray()) { shouldTranslate = false } val overridePictureResolution = unique("override_picture_resolution", *CameraTweaks.resolutions.toTypedArray()) { shouldTranslate = false } - val forceHighestFrameRate = boolean("force_highest_frame_rate") + val forceHighestFrameRate = boolean("force_highest_frame_rate") { addNotices(FeatureNotice.MAY_BREAK_INTERNAL_BEHAVIOR) } val forceCameraSourceEncoding = boolean("force_camera_source_encoding") } diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/config/impl/DownloaderConfig.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/config/impl/DownloaderConfig.kt @@ -1,6 +1,7 @@ package me.rhunk.snapenhance.core.config.impl import me.rhunk.snapenhance.core.config.ConfigContainer +import me.rhunk.snapenhance.core.config.FeatureNotice class DownloaderConfig : ConfigContainer() { val saveFolder = string("save_folder") { isFolder = true } @@ -18,7 +19,7 @@ class DownloaderConfig : ConfigContainer() { "append_username" ).apply { set(mutableListOf("append_hash", "append_date_time", "append_type", "append_username")) } val allowDuplicate = boolean("allow_duplicate") - val mergeOverlays = boolean("merge_overlays") + val mergeOverlays = boolean("merge_overlays") { addNotices(FeatureNotice.MAY_CAUSE_CRASHES) } val chatDownloadContextMenu = boolean("chat_download_context_menu") val logging = multiple("logging", "started", "success", "progress", "failure").apply { set(mutableListOf("started", "success")) diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/config/impl/Global.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/config/impl/Global.kt @@ -1,16 +1,18 @@ package me.rhunk.snapenhance.core.config.impl import me.rhunk.snapenhance.core.config.ConfigContainer +import me.rhunk.snapenhance.core.config.FeatureNotice import me.rhunk.snapenhance.data.NotificationType class Global : ConfigContainer() { - val snapchatPlus = boolean("snapchat_plus") + val snapchatPlus = boolean("snapchat_plus") { addNotices(FeatureNotice.MAY_BAN) } val autoUpdater = unique("auto_updater", "EVERY_LAUNCH", "DAILY", "WEEKLY") val disableMetrics = boolean("disable_metrics") - val disableVideoLengthRestrictions = boolean("disable_video_length_restrictions") + val blockAds = boolean("block_ads") + val disableVideoLengthRestrictions = boolean("disable_video_length_restrictions") { addNotices(FeatureNotice.MAY_BAN) } val disableGooglePlayDialogs = boolean("disable_google_play_dialogs") val forceMediaSourceQuality = boolean("force_media_source_quality") val betterNotifications = multiple("better_notifications", "snap", "chat", "reply_button", "download_button") val notificationBlacklist = multiple("notification_blacklist", *NotificationType.getIncomingValues().map { it.key }.toTypedArray()) - val disableSnapSplitting = boolean("disable_snap_splitting") + val disableSnapSplitting = boolean("disable_snap_splitting") { addNotices(FeatureNotice.MAY_BREAK_INTERNAL_BEHAVIOR) } } \ No newline at end of file diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/config/impl/MessagingTweaks.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/config/impl/MessagingTweaks.kt @@ -1,16 +1,17 @@ package me.rhunk.snapenhance.core.config.impl import me.rhunk.snapenhance.core.config.ConfigContainer +import me.rhunk.snapenhance.core.config.FeatureNotice import me.rhunk.snapenhance.data.NotificationType class MessagingTweaks : ConfigContainer() { - val anonymousStoryViewing = boolean("annonymous_story_viewing") + val anonymousStoryViewing = boolean("anonymous_story_viewing") val preventReadReceipts = boolean("prevent_read_receipts") val hideBitmojiPresence = boolean("hide_bitmoji_presence") val hideTypingNotifications = boolean("hide_typing_notifications") val unlimitedSnapViewTime = boolean("unlimited_snap_view_time") val preventMessageSending = multiple("prevent_message_sending", *NotificationType.getOutgoingValues().map { it.key }.toTypedArray()) - val messageLogger = boolean("message_logger") + val messageLogger = boolean("message_logger") { addNotices(FeatureNotice.MAY_CAUSE_CRASHES) } val autoSaveMessagesInConversations = multiple("auto_save_messages_in_conversations", "CHAT", "SNAP", @@ -21,5 +22,4 @@ class MessagingTweaks : ConfigContainer() { val galleryMediaSendOverride = boolean("gallery_media_send_override") val messagePreviewLength = integer("message_preview_length", defaultValue = 20) - } \ No newline at end of file diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/config/impl/RootConfig.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/config/impl/RootConfig.kt @@ -3,11 +3,11 @@ package me.rhunk.snapenhance.core.config.impl import me.rhunk.snapenhance.core.config.ConfigContainer class RootConfig : ConfigContainer() { - val downloader = container("downloader", DownloaderConfig()) - val userInterface = container("user_interface", UserInterfaceTweaks()) - val messaging = container("messaging", MessagingTweaks()) - val global = container("global", Global()) - val camera = container("camera", Camera()) - val experimental = container("experimental", Experimental()) - val spoof = container("spoof", Spoof()) + val downloader = container("downloader", DownloaderConfig()) { icon = "Download"} + val userInterface = container("user_interface", UserInterfaceTweaks()) { icon = "RemoveRedEye"} + val messaging = container("messaging", MessagingTweaks()) { icon = "Send" } + val global = container("global", Global()) { icon = "MiscellaneousServices" } + val camera = container("camera", Camera()) { icon = "Camera"} + val experimental = container("experimental", Experimental()) { icon = "Science" } + val spoof = container("spoof", Spoof()) { icon = "Fingerprint" } } \ No newline at end of file diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/core/config/impl/UserInterfaceTweaks.kt b/core/src/main/kotlin/me/rhunk/snapenhance/core/config/impl/UserInterfaceTweaks.kt @@ -1,11 +1,11 @@ package me.rhunk.snapenhance.core.config.impl import me.rhunk.snapenhance.core.config.ConfigContainer +import me.rhunk.snapenhance.core.config.FeatureNotice class UserInterfaceTweaks : ConfigContainer() { val enableAppAppearance = boolean("enable_app_appearance") - val amoledDarkMode = boolean("amoled_dark_mode") - val blockAds = boolean("block_ads") + val amoledDarkMode = boolean("amoled_dark_mode") { addNotices(FeatureNotice.UNSTABLE) } val mapFriendNameTags = boolean("map_friend_nametags") val streakExpirationInfo = boolean("streak_expiration_info") val hideStorySections = multiple("hide_story_sections", "hide_friend_suggestions", "hide_friends", "hide_following", "hide_for_you") @@ -26,7 +26,7 @@ class UserInterfaceTweaks : ConfigContainer() { "ngs_spotlight_icon_container", "ngs_search_icon_container" ) - val storyViewerOverride = unique("story_viewer_override", "DISCOVER_PLAYBACK_SEEKBAR", "VERTICAL_STORY_VIEWER") + val storyViewerOverride = unique("story_viewer_override", "DISCOVER_PLAYBACK_SEEKBAR", "VERTICAL_STORY_VIEWER") { addNotices(FeatureNotice.UNSTABLE) } val friendFeedMenuButtons = multiple("friend_feed_menu_buttons", "auto_download_blacklist", "anti_auto_save", "stealth_mode", "conversation_info") val friendFeedMenuPosition = integer("friend_feed_menu_position", defaultValue = 1) val enableFriendFeedMenuBar = boolean("enable_friend_feed_menu_bar") diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/features/impl/ConfigurationOverride.kt b/core/src/main/kotlin/me/rhunk/snapenhance/features/impl/ConfigurationOverride.kt @@ -30,9 +30,9 @@ class ConfigurationOverride : Feature("Configuration Override", loadParams = Fea overrideProperty("SIG_APP_APPEARANCE_SETTING", { context.config.userInterface.enableAppAppearance.get() }, true) overrideProperty("SPOTLIGHT_5TH_TAB_ENABLED", { context.config.userInterface.disableSpotlight.get() }, false) - overrideProperty("BYPASS_AD_FEATURE_GATE", { context.config.userInterface.blockAds.get() }, true) + overrideProperty("BYPASS_AD_FEATURE_GATE", { context.config.global.blockAds.get() }, true) arrayOf("CUSTOM_AD_TRACKER_URL", "CUSTOM_AD_INIT_SERVER_URL", "CUSTOM_AD_SERVER_URL").forEach { - overrideProperty(it, { context.config.userInterface.blockAds.get() }, "http://127.0.0.1") + overrideProperty(it, { context.config.global.blockAds.get() }, "http://127.0.0.1") } val compositeConfigurationProviderMappings = context.mappings.getMappedMap("CompositeConfigurationProvider") diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/features/impl/downloader/MediaDownloader.kt b/core/src/main/kotlin/me/rhunk/snapenhance/features/impl/downloader/MediaDownloader.kt @@ -383,12 +383,12 @@ class MediaDownloader : Feature("MediaDownloader", loadParams = FeatureLoadParam val mediaInfoMap = mutableMapOf<SplitMediaAssetType, MediaInfo>() val isVideo = mediaParamMap.containsKey("video_media_info_list") - val canMergeOverlay = context.config.downloader.autoDownloadOptions.get().contains("merge_overlay") mediaInfoMap[SplitMediaAssetType.ORIGINAL] = MediaInfo( (if (isVideo) mediaParamMap["video_media_info_list"] else mediaParamMap["image_media_info"])!! ) - if (canMergeOverlay && mediaParamMap.containsKey("overlay_image_media_info")) { + + if (context.config.downloader.mergeOverlays.get() && mediaParamMap.containsKey("overlay_image_media_info")) { mediaInfoMap[SplitMediaAssetType.OVERLAY] = MediaInfo(mediaParamMap["overlay_image_media_info"]!!) } diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/UITweaks.kt b/core/src/main/kotlin/me/rhunk/snapenhance/features/impl/ui/UITweaks.kt @@ -35,7 +35,7 @@ class UITweaks : Feature("UITweaks", loadParams = FeatureLoadParams.ACTIVITY_CRE @SuppressLint("DiscouragedApi", "InternalInsetResource") override fun onActivityCreate() { - val blockAds by context.config.userInterface.blockAds + val blockAds by context.config.global.blockAds val hiddenElements by context.config.userInterface.hideUiComponents val hideStorySections by context.config.userInterface.hideStorySections val isImmersiveCamera by context.config.camera.immersiveCameraPreview