mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-04 08:34:27 +02:00
fix(YouTube Music/Hide general ads): Hide premium renewal banner
is not hidden
This commit is contained in:
parent
9a3ce20402
commit
e65dc3d261
@ -13,6 +13,7 @@ import app.revanced.patches.music.utils.integrations.Constants.ADS_PATH
|
||||
import app.revanced.patches.music.utils.integrations.Constants.COMPONENTS_PATH
|
||||
import app.revanced.patches.music.utils.litho.LithoFilterPatch
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.ButtonContainer
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.FloatingLayout
|
||||
import app.revanced.patches.music.utils.settings.CategoryType
|
||||
import app.revanced.patches.music.utils.settings.SettingsPatch
|
||||
@ -62,17 +63,13 @@ object GeneralAdsPatch : BytecodePatch(
|
||||
*/
|
||||
NotifierShelfFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val linearLayoutIndex = it.scanResult.patternScanResult!!.startIndex
|
||||
val linearLayoutIndex = getWideLiteralInstructionIndex(ButtonContainer) + 3
|
||||
val linearLayoutRegister =
|
||||
getInstruction<FiveRegisterInstruction>(linearLayoutIndex).registerC
|
||||
|
||||
val textViewIndex = linearLayoutIndex + 2
|
||||
val textViewRegister =
|
||||
getInstruction<OneRegisterInstruction>(textViewIndex).registerA
|
||||
getInstruction<OneRegisterInstruction>(linearLayoutIndex).registerA
|
||||
|
||||
addInstruction(
|
||||
textViewIndex,
|
||||
"invoke-static {v$linearLayoutRegister, v$textViewRegister}, $ADS_PATH/PremiumRenewalPatch;->hidePremiumRenewal(Landroid/widget/LinearLayout;Landroid/view/View;)V"
|
||||
linearLayoutIndex + 1,
|
||||
"invoke-static {v$linearLayoutRegister}, $ADS_PATH/PremiumRenewalPatch;->hidePremiumRenewal(Landroid/widget/LinearLayout;)V"
|
||||
)
|
||||
}
|
||||
} ?: throw NotifierShelfFingerprint.exception
|
||||
|
@ -1,19 +1,17 @@
|
||||
package app.revanced.patches.music.ads.general.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.ButtonContainer
|
||||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.MusicNotifierShelf
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
import app.revanced.util.containsWideLiteralInstructionIndex
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
object NotifierShelfFingerprint : LiteralValueFingerprint(
|
||||
object NotifierShelfFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
opcodes = listOf(
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.CHECK_CAST,
|
||||
Opcode.IPUT_OBJECT
|
||||
),
|
||||
literalSupplier = { MusicNotifierShelf }
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.containsWideLiteralInstructionIndex(MusicNotifierShelf)
|
||||
&& methodDef.containsWideLiteralInstructionIndex(ButtonContainer)
|
||||
}
|
||||
)
|
@ -17,6 +17,7 @@ import app.revanced.patches.shared.patch.mapping.ResourceType.STYLE
|
||||
object SharedResourceIdPatch : ResourcePatch() {
|
||||
var AccountSwitcherAccessibility: Long = -1
|
||||
var ActionsContainer: Long = -1
|
||||
var ButtonContainer: Long = -1
|
||||
var ButtonIconPaddingMedium: Long = -1
|
||||
var ChipCloud: Long = -1
|
||||
var ColorGrey: Long = -1
|
||||
@ -46,6 +47,7 @@ object SharedResourceIdPatch : ResourcePatch() {
|
||||
|
||||
AccountSwitcherAccessibility = find(STRING, "account_switcher_accessibility_label")
|
||||
ActionsContainer = find(ID, "actions_container")
|
||||
ButtonContainer = find(ID, "button_container")
|
||||
ButtonIconPaddingMedium = find(DIMEN, "button_icon_padding_medium")
|
||||
ChipCloud = find(LAYOUT, "chip_cloud")
|
||||
ColorGrey = find(COLOR, "ytm_color_grey_12")
|
||||
|
Loading…
x
Reference in New Issue
Block a user