diff --git a/patches/src/main/kotlin/app/revanced/patches/instagram/hide/navigation/HideNavigationButtons.kt b/patches/src/main/kotlin/app/revanced/patches/instagram/hide/navigation/HideNavigationButtons.kt index fca74bc18..be7aba78c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/instagram/hide/navigation/HideNavigationButtons.kt +++ b/patches/src/main/kotlin/app/revanced/patches/instagram/hide/navigation/HideNavigationButtons.kt @@ -28,6 +28,13 @@ val hideNavigationButtonsPatch = bytecodePatch( dependsOn(sharedExtensionPatch) + val hideHome by booleanOption( + key = "hideHome", + default = false, + title = "Hide Home", + description = "Permanently hides the Home button. App starts at next available tab." // On the "homecoming" / current instagram layout. + ) + val hideReels by booleanOption( key = "hideReels", default = true, @@ -35,6 +42,27 @@ val hideNavigationButtonsPatch = bytecodePatch( description = "Permanently hides the Reels button." ) + val hideDirect by booleanOption( + key = "hideDirect", + default = false, + title = "Hide Direct", + description = "Permanently hides the Direct button." + ) + + val hideSearch by booleanOption( + key = "hideSearch", + default = false, + title = "Hide Search", + description = "Permanently hides the Search button." + ) + + val hideProfile by booleanOption( + key = "hideProfile", + default = false, + title = "Hide Profile", + description = "Permanently hides the Profile button." + ) + val hideCreate by booleanOption( key = "hideCreate", default = true, @@ -42,8 +70,10 @@ val hideNavigationButtonsPatch = bytecodePatch( description = "Permanently hides the Create button." ) + + execute { - if (!hideReels!! && !hideCreate!!) { + if (!hideHome!! &&!hideReels!! && !hideDirect!! && !hideSearch!! && !hideProfile && !hideCreate!!) { return@execute Logger.getLogger(this::class.java.name).warning( "No hide navigation buttons options are enabled. No changes made." ) @@ -76,6 +106,13 @@ val hideNavigationButtonsPatch = bytecodePatch( """ } + if (hideHome!!) { + addInstructionsAtControlFlowLabel( + returnIndex, + instructionsRemoveButtonByName("fragment_feed") + ) + } + if (hideReels!!) { addInstructionsAtControlFlowLabel( returnIndex, @@ -83,12 +120,33 @@ val hideNavigationButtonsPatch = bytecodePatch( ) } + if (hideDirect!!) { + addInstructionsAtControlFlowLabel( + returnIndex, + instructionsRemoveButtonByName("fragment_direct_tab") + ) + } + if (hideSearch!!) { + addInstructionsAtControlFlowLabel( + returnIndex, + instructionsRemoveButtonByName("fragment_search") + ) + } + if (hideCreate!!) { addInstructionsAtControlFlowLabel( returnIndex, instructionsRemoveButtonByName("fragment_share") ) } + + if (hideProfile!!) { + addInstructionsAtControlFlowLabel( + returnIndex, + instructionsRemoveButtonByName("fragment_profile") + ) + } + } } }