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