Skip to content

Commit

Permalink
Added More Notification Filter Options
Browse files Browse the repository at this point in the history
  • Loading branch information
RevealedSoulEven committed Aug 21, 2022
1 parent 3d17a94 commit c7e13d0
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 77 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified app/libs/snapmod.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion app/src/main/java/xyz/rodit/snapmod/CustomResources.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ object CustomResources {

private val strings: MutableMap<Int, String> = mutableMapOf(
string.menu_option_stealth_mode to "Stealth Mode",
string.menu_option_preview to "More Information",
string.menu_option_preview to "Preview Conversation",
string.menu_option_auto_save to "Auto-Save Messages",
string.menu_option_dont_auto_save to "Don't Auto-Save",
string.menu_option_auto_download to "Auto-Download Snaps",
string.menu_option_export to "Export...",

Expand Down Expand Up @@ -49,6 +50,7 @@ object CustomResources {
const val menu_option_auto_save = -100002
const val menu_option_auto_download = -100003
const val menu_option_export = -100004
const val menu_option_dont_auto_save = -100005

const val chat_action_playback_speed = -200000

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import xyz.rodit.xposed.client.http.StreamServer
private const val PINNED_CONVERSATIONS_FILE = "pinned.list"
private const val STEALTH_CONVERSATIONS_FILE = "stealth.list"
private const val AUTO_SAVE_CONVERSATIONS_FILE = "auto_save.list"
private const val DONT_AUTO_SAVE_FILE = "dont_auto_save.list"
private const val AUTO_DOWNLOAD_CONVERSATIONS_FILE = "auto_download.list"
private const val AUTO_DOWNLOAD_STORIES_FILE = "auto_download_stories.list"
private const val PINNED_STORIES_FILE = "pinned_stories.list"
Expand All @@ -29,6 +30,7 @@ class FeatureContext(
val callbacks: CallbackManager = CallbackManager()
val pinned: ConversationManager = ConversationManager(appContext.filesDir, PINNED_CONVERSATIONS_FILE)
val stealth: ConversationManager = ConversationManager(appContext.filesDir, STEALTH_CONVERSATIONS_FILE)
val dont_autoSave: ConversationManager = ConversationManager(appContext.filesDir, DONT_AUTO_SAVE_FILE)
val autoSave: ConversationManager = ConversationManager(appContext.filesDir, AUTO_SAVE_CONVERSATIONS_FILE)
val autoDownload: ConversationManager = ConversationManager(appContext.filesDir, AUTO_DOWNLOAD_CONVERSATIONS_FILE)
val autoDownloadStories: ConversationManager = ConversationManager(appContext.filesDir, AUTO_DOWNLOAD_STORIES_FILE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ abstract class ButtonOption(context: FeatureContext, name: String, private val t
null,
null,
false,
null,
ActionMenuOptionItemType.OPTION_ITEM()
).instance
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package xyz.rodit.snapmod.features.chatmenu

import xyz.rodit.snapmod.CustomResources.string.menu_option_auto_download
import xyz.rodit.snapmod.CustomResources.string.menu_option_auto_save
import xyz.rodit.snapmod.CustomResources.string.menu_option_dont_auto_save
import xyz.rodit.snapmod.CustomResources.string.menu_option_stealth_mode
import xyz.rodit.snapmod.Shared
import xyz.rodit.snapmod.features.Feature
Expand Down Expand Up @@ -33,6 +34,7 @@ class ChatMenuModifier(context: FeatureContext) : Feature(context) {
registerConversationToggle("pinning", pinTextResource) { it.pinned }
registerConversationToggle("stealth", menu_option_stealth_mode) { it.stealth }
registerConversationToggle("auto_save", menu_option_auto_save) { it.autoSave }
registerConversationToggle("dont_auto_save", menu_option_dont_auto_save) { it.dont_autoSave }
registerConversationToggle("auto_download", menu_option_auto_download) { it.autoDownload }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import xyz.rodit.snapmod.features.FeatureContext
import xyz.rodit.snapmod.logging.log
import xyz.rodit.snapmod.mappings.ArroyoConvertMessagesAction
import xyz.rodit.snapmod.mappings.ChatCommandSource
import xyz.rodit.snapmod.mappings.ChatContext
import xyz.rodit.snapmod.mappings.Message
import xyz.rodit.snapmod.util.*

Expand Down Expand Up @@ -33,6 +34,9 @@ class AutoSave(context: FeatureContext) : Feature(context, 84608.toMax()) {
val descriptor = m.descriptor
val conversationId = descriptor.conversationId.toUUIDString()

if(context.dont_autoSave.isEnabled(conversationId))
return@forEach

if (!context.config.getBoolean("auto_save_all_chats")
&& !context.autoSave.isEnabled(conversationId)
) return@forEach
Expand All @@ -45,8 +49,10 @@ class AutoSave(context: FeatureContext) : Feature(context, 84608.toMax()) {

val arroyoId = createArroyoId(conversationId, descriptor.messageId)
context.instances.chatCommandsClient.saveMessage(
null,
arroyoId,
true,
false,
ChatCommandSource.CHAT(),
false
)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MessageMenuModifier(context: FeatureContext) : Feature(context) {
private val plugins: MutableList<MenuPlugin> = mutableListOf()

override fun init() {
plugins.add(AudioSpeedModifier(context))

}

override fun performHooks() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import xyz.rodit.snapmod.mappings.NotificationHandler
import xyz.rodit.snapmod.util.before
import xyz.rodit.snapmod.util.getList
import xyz.rodit.snapmod.util.toMax
import xyz.rodit.snapmod.logging.log

class FilterTypes(context: FeatureContext) : Feature(context, 84608.toMax()) {

Expand All @@ -27,6 +28,7 @@ class FilterTypes(context: FeatureContext) : Feature(context, 84608.toMax()) {

val type =
bundle.getString("type") ?: bundle.getString("n_key")?.split('~')?.get(0) ?: ""
log.debug(type)
if (hiddenTypes.contains(type.lowercase())) {
it.result = null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ class ChatSaving(context: FeatureContext) : Feature(context) {
null,
base.status,
true,
true
).instance
}
ChatModelAudioNote.isInstance(it.args[2]) -> {
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,18 @@
<item>Chats</item>
<item>Snaps</item>
<item>Typing</item>
<item>Replay</item>
<item>Saved Snap</item>
<item>Screenshot</item>
</string-array>

<string-array name="notification_types_values">
<item>chat</item>
<item>snap</item>
<item>typing</item>
<item>replay</item>
<item>snap_save</item>
<item>chat_screenshot</item>
</string-array>

<string-array name="log_levels">
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/xml/root_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
app:key="enable_new_chat_menu"
app:title="@string/enable_new_chat_menu_title"
app:summary="@string/enable_new_chat_menu_description"
app:defaultValue="true"
app:defaultValue="false"
app:iconSpaceReserved="false" />

<MultiSelectListPreference
Expand Down

0 comments on commit c7e13d0

Please sign in to comment.