diff --git a/extensions/shared/src/main/java/app/revanced/extension/music/patches/navigation/NavigationPatch.java b/extensions/shared/src/main/java/app/revanced/extension/music/patches/navigation/NavigationPatch.java index dedb249c9..53e1fe5cb 100644 --- a/extensions/shared/src/main/java/app/revanced/extension/music/patches/navigation/NavigationPatch.java +++ b/extensions/shared/src/main/java/app/revanced/extension/music/patches/navigation/NavigationPatch.java @@ -65,6 +65,7 @@ public class NavigationPatch { Runnable onClickAction = button.onClickAction; if (onClickAction != null) { view.setOnClickListener(v -> onClickAction.run()); + Utils.runOnMainThreadDelayed(() -> view.setOnClickListener(v -> onClickAction.run()), 500); } } hideViewUnderCondition(button.hidden, view); diff --git a/patches/src/main/kotlin/app/revanced/patches/music/general/startpage/ChangeStartPagePatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/general/startpage/ChangeStartPagePatch.kt index 92aa964c8..8a95aa8b6 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/general/startpage/ChangeStartPagePatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/general/startpage/ChangeStartPagePatch.kt @@ -4,13 +4,17 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.patch.bytecodePatch +import app.revanced.patcher.patch.resourcePatch import app.revanced.patches.music.utils.compatibility.Constants.COMPATIBLE_PACKAGE import app.revanced.patches.music.utils.extension.Constants.GENERAL_PATH import app.revanced.patches.music.utils.patch.PatchList.CHANGE_START_PAGE +import app.revanced.patches.music.utils.playservice.is_6_27_or_greater +import app.revanced.patches.music.utils.playservice.versionCheckPatch import app.revanced.patches.music.utils.settings.CategoryType import app.revanced.patches.music.utils.settings.ResourceUtils.updatePatchStatus import app.revanced.patches.music.utils.settings.addPreferenceWithIntent import app.revanced.patches.music.utils.settings.settingsPatch +import app.revanced.util.addEntryValues import app.revanced.util.fingerprint.methodOrThrow import app.revanced.util.getReference import app.revanced.util.indexOfFirstInstructionReversedOrThrow @@ -22,6 +26,33 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference private const val EXTENSION_CLASS_DESCRIPTOR = "$GENERAL_PATH/ChangeStartPagePatch;" +private val changeStartPageResourcePatch = resourcePatch( + description = "changeStartPageResourcePatch" +) { + dependsOn( + settingsPatch, + versionCheckPatch, + ) + + execute { + fun appendStartPage(startPage: String) { + addEntryValues( + "revanced_change_start_page_entries", + "@string/revanced_change_start_page_entry_$startPage", + ) + addEntryValues( + "revanced_change_start_page_entry_values", + startPage.uppercase(), + ) + } + + if (is_6_27_or_greater) { + appendStartPage("search") + } + appendStartPage("subscriptions") + } +} + @Suppress("unused") val changeStartPagePatch = bytecodePatch( CHANGE_START_PAGE.title, @@ -29,7 +60,10 @@ val changeStartPagePatch = bytecodePatch( ) { compatibleWith(COMPATIBLE_PACKAGE) - dependsOn(settingsPatch) + dependsOn( + changeStartPageResourcePatch, + settingsPatch, + ) execute { diff --git a/patches/src/main/kotlin/app/revanced/patches/music/navigation/components/NavigationBarComponentsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/navigation/components/NavigationBarComponentsPatch.kt index 7a8ec9e5e..e4b459e25 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/navigation/components/NavigationBarComponentsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/navigation/components/NavigationBarComponentsPatch.kt @@ -10,6 +10,8 @@ import app.revanced.patches.music.general.startpage.changeStartPagePatch import app.revanced.patches.music.utils.compatibility.Constants.COMPATIBLE_PACKAGE import app.revanced.patches.music.utils.extension.Constants.NAVIGATION_CLASS_DESCRIPTOR import app.revanced.patches.music.utils.patch.PatchList.NAVIGATION_BAR_COMPONENTS +import app.revanced.patches.music.utils.playservice.is_6_27_or_greater +import app.revanced.patches.music.utils.playservice.versionCheckPatch import app.revanced.patches.music.utils.resourceid.colorGrey import app.revanced.patches.music.utils.resourceid.sharedResourceIdPatch import app.revanced.patches.music.utils.resourceid.text1 @@ -70,6 +72,7 @@ val navigationBarComponentsPatch = bytecodePatch( navigationBarComponentsResourcePatch, sharedResourceIdPatch, settingsPatch, + versionCheckPatch, ) execute { @@ -228,11 +231,13 @@ val navigationBarComponentsPatch = bytecodePatch( "revanced_hide_navigation_label", "false" ) - addSwitchPreference( - CategoryType.NAVIGATION, - "revanced_replace_navigation_samples_button", - "false" - ) + if (is_6_27_or_greater) { + addSwitchPreference( + CategoryType.NAVIGATION, + "revanced_replace_navigation_samples_button", + "false" + ) + } addSwitchPreference( CategoryType.NAVIGATION, "revanced_replace_navigation_upgrade_button", diff --git a/patches/src/main/resources/music/settings/host/values/arrays.xml b/patches/src/main/resources/music/settings/host/values/arrays.xml index e56a20190..d019ea5b1 100644 --- a/patches/src/main/resources/music/settings/host/values/arrays.xml +++ b/patches/src/main/resources/music/settings/host/values/arrays.xml @@ -10,8 +10,6 @@ @string/revanced_change_start_page_entry_liked_music @string/revanced_change_start_page_entry_podcasts @string/revanced_change_start_page_entry_samples - @string/revanced_change_start_page_entry_search - @string/revanced_change_start_page_entry_subscriptions ORIGINAL @@ -23,8 +21,6 @@ LIKED_MUSIC PODCASTS SAMPLES - SEARCH - SUBSCRIPTIONS @string/revanced_disable_music_video_in_album_redirect_type_entry_redirect