fix(music/hide-upgrade-button): library tab stuck when opening device files

This commit is contained in:
inotia00 2023-09-18 01:15:58 +09:00
parent c284098a1f
commit fd125c83f7
3 changed files with 2 additions and 41 deletions

View File

@ -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) }
)

View File

@ -4,14 +4,12 @@ import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext 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.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel 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.annotations.MusicCompatibility
import app.revanced.patches.music.utils.fingerprints.TabLayoutTextFingerprint import app.revanced.patches.music.utils.fingerprints.TabLayoutTextFingerprint
import app.revanced.patches.music.utils.integrations.patch.IntegrationsPatch import app.revanced.patches.music.utils.integrations.patch.IntegrationsPatch
@ -24,7 +22,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
@Patch @Patch
@Name("Hide upgrade button") @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( @DependsOn(
[ [
IntegrationsPatch::class, IntegrationsPatch::class,
@ -33,10 +31,7 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference
) )
@MusicCompatibility @MusicCompatibility
class UpgradeButtonPatch : BytecodePatch( class UpgradeButtonPatch : BytecodePatch(
listOf( listOf(TabLayoutTextFingerprint)
NotifierShelfFingerprint,
TabLayoutTextFingerprint
)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
TabLayoutTextFingerprint.result?.let { TabLayoutTextFingerprint.result?.let {
@ -65,16 +60,5 @@ class UpgradeButtonPatch : BytecodePatch(
} }
} ?: throw TabLayoutTextFingerprint.exception } ?: throw TabLayoutTextFingerprint.exception
NotifierShelfFingerprint.result?.let {
it.mutableMethod.apply {
val targetIndex = it.scanResult.patternScanResult!!.endIndex
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
addInstruction(
targetIndex + 1,
"invoke-static {v$targetRegister}, Lapp/revanced/music/utils/ReVancedUtils;->hideViewByLayoutParams(Landroid/view/View;)V"
)
}
} ?: throw NotifierShelfFingerprint.exception
} }
} }

View File

@ -25,7 +25,6 @@ class SharedResourceIdPatch : ResourcePatch {
var InlineTimeBarAdBreakMarkerColor: Long = -1 var InlineTimeBarAdBreakMarkerColor: Long = -1
var IsTablet: Long = -1 var IsTablet: Long = -1
var MusicMenuLikeButtons: Long = -1 var MusicMenuLikeButtons: Long = -1
var MusicNotifierShelf: Long = -1
var PrivacyTosFooter: Long = -1 var PrivacyTosFooter: Long = -1
var QualityTitle: Long = -1 var QualityTitle: Long = -1
var Text1: Long = -1 var Text1: Long = -1
@ -48,7 +47,6 @@ class SharedResourceIdPatch : ResourcePatch {
InlineTimeBarAdBreakMarkerColor = find(COLOR, "inline_time_bar_ad_break_marker_color") InlineTimeBarAdBreakMarkerColor = find(COLOR, "inline_time_bar_ad_break_marker_color")
IsTablet = find(BOOL, "is_tablet") IsTablet = find(BOOL, "is_tablet")
MusicMenuLikeButtons = find(LAYOUT, "music_menu_like_buttons") MusicMenuLikeButtons = find(LAYOUT, "music_menu_like_buttons")
MusicNotifierShelf = find(LAYOUT, "music_notifier_shelf")
PrivacyTosFooter = find(ID, "privacy_tos_footer") PrivacyTosFooter = find(ID, "privacy_tos_footer")
QualityTitle = find(STRING, "quality_title") QualityTitle = find(STRING, "quality_title")
Text1 = find(ID, "text1") Text1 = find(ID, "text1")