From fd125c83f74a3f30f2d7a416a83d8531a72b9181 Mon Sep 17 00:00:00 2001 From: inotia00 Date: Mon, 18 Sep 2023 01:15:58 +0900 Subject: [PATCH] fix(music/hide-upgrade-button): library tab stuck when opening device files --- .../fingerprints/NotifierShelfFingerprint.kt | 21 ------------------- .../upgrade/patch/UpgradeButtonPatch.kt | 20 ++---------------- .../resourceid/patch/SharedResourceIdPatch.kt | 2 -- 3 files changed, 2 insertions(+), 41 deletions(-) delete mode 100644 src/main/kotlin/app/revanced/patches/music/navigation/upgrade/fingerprints/NotifierShelfFingerprint.kt diff --git a/src/main/kotlin/app/revanced/patches/music/navigation/upgrade/fingerprints/NotifierShelfFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/navigation/upgrade/fingerprints/NotifierShelfFingerprint.kt deleted file mode 100644 index a6e46b2ee..000000000 --- a/src/main/kotlin/app/revanced/patches/music/navigation/upgrade/fingerprints/NotifierShelfFingerprint.kt +++ /dev/null @@ -1,21 +0,0 @@ -package app.revanced.patches.music.navigation.upgrade.fingerprints - -import app.revanced.patcher.extensions.or -import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint -import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.MusicNotifierShelf -import app.revanced.util.bytecode.isWideLiteralExists -import com.android.tools.smali.dexlib2.AccessFlags -import com.android.tools.smali.dexlib2.Opcode - -object NotifierShelfFingerprint : MethodFingerprint( - returnType = "V", - accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, - opcodes = listOf( - Opcode.CONST, - Opcode.CONST_4, - Opcode.INVOKE_STATIC, - Opcode.MOVE_RESULT_OBJECT - ), - customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(MusicNotifierShelf) } -) - diff --git a/src/main/kotlin/app/revanced/patches/music/navigation/upgrade/patch/UpgradeButtonPatch.kt b/src/main/kotlin/app/revanced/patches/music/navigation/upgrade/patch/UpgradeButtonPatch.kt index 0f5b179c9..3708dce03 100644 --- a/src/main/kotlin/app/revanced/patches/music/navigation/upgrade/patch/UpgradeButtonPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/navigation/upgrade/patch/UpgradeButtonPatch.kt @@ -4,14 +4,12 @@ import app.revanced.extensions.exception import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Name import app.revanced.patcher.data.BytecodeContext -import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.util.smali.ExternalLabel -import app.revanced.patches.music.navigation.upgrade.fingerprints.NotifierShelfFingerprint import app.revanced.patches.music.utils.annotations.MusicCompatibility import app.revanced.patches.music.utils.fingerprints.TabLayoutTextFingerprint import app.revanced.patches.music.utils.integrations.patch.IntegrationsPatch @@ -24,7 +22,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference @Patch @Name("Hide upgrade button") -@Description("Hides upgrade button from navigation bar and hide upgrade banner from homepage.") +@Description("Hides upgrade button from navigation bar.") @DependsOn( [ IntegrationsPatch::class, @@ -33,10 +31,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference ) @MusicCompatibility class UpgradeButtonPatch : BytecodePatch( - listOf( - NotifierShelfFingerprint, - TabLayoutTextFingerprint - ) + listOf(TabLayoutTextFingerprint) ) { override fun execute(context: BytecodeContext) { TabLayoutTextFingerprint.result?.let { @@ -65,16 +60,5 @@ class UpgradeButtonPatch : BytecodePatch( } } ?: throw TabLayoutTextFingerprint.exception - NotifierShelfFingerprint.result?.let { - it.mutableMethod.apply { - val targetIndex = it.scanResult.patternScanResult!!.endIndex - val targetRegister = getInstruction(targetIndex).registerA - addInstruction( - targetIndex + 1, - "invoke-static {v$targetRegister}, Lapp/revanced/music/utils/ReVancedUtils;->hideViewByLayoutParams(Landroid/view/View;)V" - ) - } - } ?: throw NotifierShelfFingerprint.exception - } } diff --git a/src/main/kotlin/app/revanced/patches/music/utils/resourceid/patch/SharedResourceIdPatch.kt b/src/main/kotlin/app/revanced/patches/music/utils/resourceid/patch/SharedResourceIdPatch.kt index 669b8bbc0..c02249695 100644 --- a/src/main/kotlin/app/revanced/patches/music/utils/resourceid/patch/SharedResourceIdPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/utils/resourceid/patch/SharedResourceIdPatch.kt @@ -25,7 +25,6 @@ class SharedResourceIdPatch : ResourcePatch { var InlineTimeBarAdBreakMarkerColor: Long = -1 var IsTablet: Long = -1 var MusicMenuLikeButtons: Long = -1 - var MusicNotifierShelf: Long = -1 var PrivacyTosFooter: Long = -1 var QualityTitle: Long = -1 var Text1: Long = -1 @@ -48,7 +47,6 @@ class SharedResourceIdPatch : ResourcePatch { InlineTimeBarAdBreakMarkerColor = find(COLOR, "inline_time_bar_ad_break_marker_color") IsTablet = find(BOOL, "is_tablet") MusicMenuLikeButtons = find(LAYOUT, "music_menu_like_buttons") - MusicNotifierShelf = find(LAYOUT, "music_notifier_shelf") PrivacyTosFooter = find(ID, "privacy_tos_footer") QualityTitle = find(STRING, "quality_title") Text1 = find(ID, "text1")