Skip to content

Commit

Permalink
feat(core/ui_tweaks): multiple hide ui components (#106)
Browse files Browse the repository at this point in the history
eat(ui): Hide below_header_message_banner_text by default

Added default hiding for below_header_message_banner_text

* feat(ui): Hide below_header_message_banner_text and below_header_message by default

* refactor(core/ui_tweaks): hide reminders by default

* feat(core/ui_tweaks): hide reminders by default

* refactor(core/ui_tweaks): hide reminders by default

* fix(core/ui_tweaks): accidental removal

* feat: Multiple hide ui components

* feat(core/ui_tweaks): Multiple hide ui components

* feat: Multiple hide ui components

* refactor(lang/en_US.json): hide_ui_components

* refactor(core/ui_tweaks): multiple hide ui components

* fix: missing code

* refactor: spaces

* feat: hide create group shortcut

* feat: hide create group shortcut

* feat(core/ui_tweaks): hide create group shortcut

* feat(core/ui_tweaks): Hide Spotlight Icon & Tokens Icon

* feat: Hide Spotlight Icon & Tokens Icon

* feat: Hide Spotlight Icon & Tokens Icon

* remove(core/ui_tweaks): hide billboard prompt

* remove: hide billboard-prompt

* remove: hide billboard-prompt

* remove(core/ui_tweaks): hide spotlight icon

* remove: hide spotlight icon

* remove: hide spotlight icon

* fix(core/ui_tweaks): accidental removal

* refactor: multiple hide ui components

---------

Co-authored-by: Jacob Thomas <41988041+bocajthomas@users.noreply.github.com>
  • Loading branch information
suryadip2008 and bocajthomas authored Jul 16, 2024
1 parent 5552da0 commit a121fa9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
7 changes: 6 additions & 1 deletion common/src/main/assets/lang/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1428,12 +1428,17 @@
},
"hide_ui_components": {
"hide_profile_call_buttons": "Remove Profile Call Buttons",
"hide_snap_create_group_buttons": "Remove Snap Create Group Buttons",
"hide_chat_call_buttons": "Remove Chat Call Buttons",
"hide_chat_camera_button": "Remove Chat Camera Button",
"hide_chat_gallery_button": "Remove Chat Gallery Button",
"hide_explorer_token_button": "Remove Explorer Token Button",
"hide_live_location_share_button": "Remove Live Location Share Button",
"hide_stickers_button": "Remove Stickers Button",
"hide_voice_record_button": "Remove Voice Record Button",
"hide_unread_chat_hint": "Remove Unread Chat Hint",
"hide_post_to_story_buttons": "Remove Post to Story buttons before sending a Snap"
"hide_post_to_story_buttons": "Remove Post to Story Buttons",
"hide_gift_snapchat_plus_reminders": "Remove Gift Snapchat Plus Reminders"
},
"hide_story_suggestions": {
"hide_friend_suggestions": "Hide friend suggestions",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class UserInterfaceTweaks : ConfigContainer() {
val amount = integer("amount", defaultValue = 1)
}


class ColorsConfig : ConfigContainer() {
val textColor = color("text_color")
val chatChatTextColor = color("chat_chat_text_color")
Expand Down Expand Up @@ -103,9 +102,14 @@ class UserInterfaceTweaks : ConfigContainer() {
"hide_stickers_button",
"hide_live_location_share_button",
"hide_chat_call_buttons",
"hide_chat_camera_button",
"hide_chat_gallery_button",
"hide_profile_call_buttons",
"hide_unread_chat_hint",
"hide_post_to_story_buttons",
"hide_snap_create_group_buttons",
"hide_explorer_token_button",
"hide_gift_snapchat_plus_reminders"
) { requireRestart() }
val operaMediaQuickInfo = boolean("opera_media_quick_info") { requireRestart() }
val oldBitmojiSelfie = unique("old_bitmoji_selfie", "2d", "3d") { requireCleanCache() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class UITweaks : Feature("UITweaks", loadParams = FeatureLoadParams.ACTIVITY_CRE
}
}

Resources::class.java.methods.first { it.name == "getDimensionPixelSize"}.hook(
Resources::class.java.methods.first { it.name == "getDimensionPixelSize" }.hook(
HookStage.AFTER,
{ isImmersiveCamera }
) { param ->
Expand All @@ -99,7 +99,7 @@ class UITweaks : Feature("UITweaks", loadParams = FeatureLoadParams.ACTIVITY_CRE
if (event.view is FrameLayout) {
val viewModelString = event.prevModel.toString()
val isSuggestedFriend by lazy { viewModelString.startsWith("DFFriendSuggestionCardViewModel") }
val isMyStory by lazy { viewModelString.let { it.startsWith("CircularItemViewModel") && it.contains("storyId=")} }
val isMyStory by lazy { viewModelString.let { it.startsWith("CircularItemViewModel") && it.contains("storyId=") }}

if ((hideStorySuggestions.contains("hide_friend_suggestions") && isSuggestedFriend) ||
(hideStorySuggestions.contains("hide_my_stories") && isMyStory)) {
Expand Down Expand Up @@ -160,16 +160,22 @@ class UITweaks : Feature("UITweaks", loadParams = FeatureLoadParams.ACTIVITY_CRE

if (
((viewId == getId("post_tool", "id") || viewId == getId("story_button", "id")) && hiddenElements.contains("hide_post_to_story_buttons")) ||
(viewId == chatNoteRecordButton && hiddenElements.contains("hide_voice_record_button")) ||
((viewId == getId("below_header_message_banner_text", "id") || viewId == getId("below_header_message_banner", "id")) && hiddenElements.contains("hide_gift_snapchat_plus_reminders")) ||
((viewId == getId("explorer_action_icon", "id") || viewId == getId("explorer_action_text", "id")) && hiddenElements.contains("hide_explorer_token_button")) ||
(viewId == getId("chat_input_bar_sticker", "id") && hiddenElements.contains("hide_stickers_button")) ||
(viewId == getId("chat_input_bar_sharing_drawer_button", "id") && hiddenElements.contains("hide_live_location_share_button")) ||
(viewId == getId("chat_input_bar_camera", "id") && hiddenElements.contains("hide_chat_camera_button")) ||
(viewId == getId("chat_input_bar_gallery", "id") && hiddenElements.contains("hide_chat_gallery_button")) ||
(viewId == getId("send_to_recipient_bar_new_group_button", "id") && hiddenElements.contains("hide_snap_create_group_buttons")) ||
(viewId == chatNoteRecordButton && hiddenElements.contains("hide_voice_record_button")) ||
(viewId == callButtonsStub && hiddenElements.contains("hide_chat_call_buttons"))
) {
hideView(view)
}

if (viewId == unreadHintButton && hiddenElements.contains("hide_unread_chat_hint")) {
event.canceled = true
}
}
}
}
}

0 comments on commit a121fa9

Please sign in to comment.