mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-06 01:24:35 +02:00
feat(YouTube): Disable pip notification
, Hide tooltip content
patches has been integrated into Hide layout components
patch
This commit is contained in:
parent
bdff8e5430
commit
eb5f08b209
@ -5,6 +5,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
|||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
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.PatchException
|
||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
import app.revanced.patches.shared.litho.LithoFilterPatch
|
import app.revanced.patches.shared.litho.LithoFilterPatch
|
||||||
import app.revanced.patches.youtube.general.components.fingerprints.AccountListFingerprint
|
import app.revanced.patches.youtube.general.components.fingerprints.AccountListFingerprint
|
||||||
@ -13,7 +14,10 @@ import app.revanced.patches.youtube.general.components.fingerprints.AccountMenuF
|
|||||||
import app.revanced.patches.youtube.general.components.fingerprints.AccountSwitcherAccessibilityLabelFingerprint
|
import app.revanced.patches.youtube.general.components.fingerprints.AccountSwitcherAccessibilityLabelFingerprint
|
||||||
import app.revanced.patches.youtube.general.components.fingerprints.BottomUiContainerFingerprint
|
import app.revanced.patches.youtube.general.components.fingerprints.BottomUiContainerFingerprint
|
||||||
import app.revanced.patches.youtube.general.components.fingerprints.FloatingMicrophoneFingerprint
|
import app.revanced.patches.youtube.general.components.fingerprints.FloatingMicrophoneFingerprint
|
||||||
|
import app.revanced.patches.youtube.general.components.fingerprints.PiPNotificationFingerprint
|
||||||
import app.revanced.patches.youtube.general.components.fingerprints.SettingsMenuFingerprint
|
import app.revanced.patches.youtube.general.components.fingerprints.SettingsMenuFingerprint
|
||||||
|
import app.revanced.patches.youtube.general.components.fingerprints.TooltipContentFullscreenFingerprint
|
||||||
|
import app.revanced.patches.youtube.general.components.fingerprints.TooltipContentViewFingerprint
|
||||||
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
|
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
|
||||||
import app.revanced.patches.youtube.utils.fingerprints.AccountMenuParentFingerprint
|
import app.revanced.patches.youtube.utils.fingerprints.AccountMenuParentFingerprint
|
||||||
import app.revanced.patches.youtube.utils.integrations.Constants.COMPONENTS_PATH
|
import app.revanced.patches.youtube.utils.integrations.Constants.COMPONENTS_PATH
|
||||||
@ -30,6 +34,7 @@ import app.revanced.util.patch.BaseBytecodePatch
|
|||||||
import app.revanced.util.resultOrThrow
|
import app.revanced.util.resultOrThrow
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
@ -49,7 +54,10 @@ object LayoutComponentsPatch : BaseBytecodePatch(
|
|||||||
AccountSwitcherAccessibilityLabelFingerprint,
|
AccountSwitcherAccessibilityLabelFingerprint,
|
||||||
BottomUiContainerFingerprint,
|
BottomUiContainerFingerprint,
|
||||||
FloatingMicrophoneFingerprint,
|
FloatingMicrophoneFingerprint,
|
||||||
SettingsMenuFingerprint
|
PiPNotificationFingerprint,
|
||||||
|
SettingsMenuFingerprint,
|
||||||
|
TooltipContentFullscreenFingerprint,
|
||||||
|
TooltipContentViewFingerprint
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
private const val CUSTOM_FILTER_CLASS_DESCRIPTOR =
|
private const val CUSTOM_FILTER_CLASS_DESCRIPTOR =
|
||||||
@ -59,6 +67,33 @@ object LayoutComponentsPatch : BaseBytecodePatch(
|
|||||||
|
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
|
|
||||||
|
// region patch for disable pip notification
|
||||||
|
|
||||||
|
PiPNotificationFingerprint.resultOrThrow().let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val checkCastCalls = implementation!!.instructions.withIndex()
|
||||||
|
.filter { instruction ->
|
||||||
|
(instruction.value as? ReferenceInstruction)?.reference.toString() == "Lcom/google/apps/tiktok/account/AccountId;"
|
||||||
|
}
|
||||||
|
|
||||||
|
val checkCastCallSize = checkCastCalls.size
|
||||||
|
if (checkCastCallSize != 3)
|
||||||
|
throw PatchException("Couldn't find target index, size: $checkCastCallSize")
|
||||||
|
|
||||||
|
arrayOf(
|
||||||
|
checkCastCalls.elementAt(1).index,
|
||||||
|
checkCastCalls.elementAt(0).index
|
||||||
|
).forEach { index ->
|
||||||
|
addInstruction(
|
||||||
|
index + 1,
|
||||||
|
"return-void"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// endregion
|
||||||
|
|
||||||
// region patch for hide account menu
|
// region patch for hide account menu
|
||||||
|
|
||||||
// for you tab
|
// for you tab
|
||||||
@ -171,6 +206,20 @@ object LayoutComponentsPatch : BaseBytecodePatch(
|
|||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
|
// region patch for hide tooltip content
|
||||||
|
|
||||||
|
arrayOf(
|
||||||
|
TooltipContentFullscreenFingerprint,
|
||||||
|
TooltipContentViewFingerprint
|
||||||
|
).forEach { fingerprint ->
|
||||||
|
fingerprint.resultOrThrow().mutableMethod.addInstruction(
|
||||||
|
0,
|
||||||
|
"return-void"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// endregion
|
||||||
|
|
||||||
LithoFilterPatch.addFilter(CUSTOM_FILTER_CLASS_DESCRIPTOR)
|
LithoFilterPatch.addFilter(CUSTOM_FILTER_CLASS_DESCRIPTOR)
|
||||||
LithoFilterPatch.addFilter(LAYOUT_COMPONENTS_FILTER_CLASS_DESCRIPTOR)
|
LithoFilterPatch.addFilter(LAYOUT_COMPONENTS_FILTER_CLASS_DESCRIPTOR)
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.layout.pipnotification.fingerprints
|
package app.revanced.patches.youtube.general.components.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.EditSettingsAction
|
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.EditSettingsAction
|
@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.layout.tooltip.fingerprints
|
package app.revanced.patches.youtube.general.components.fingerprints
|
||||||
|
|
||||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.layout.tooltip.fingerprints
|
package app.revanced.patches.youtube.general.components.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ToolTipContentView
|
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ToolTipContentView
|
@ -1,51 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.layout.pipnotification
|
|
||||||
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
|
||||||
import app.revanced.patcher.patch.PatchException
|
|
||||||
import app.revanced.patches.youtube.layout.pipnotification.fingerprints.PiPNotificationFingerprint
|
|
||||||
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
|
|
||||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
|
||||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
|
||||||
import app.revanced.util.patch.BaseBytecodePatch
|
|
||||||
import app.revanced.util.resultOrThrow
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
|
||||||
|
|
||||||
@Suppress("unused")
|
|
||||||
object PiPNotificationPatch : BaseBytecodePatch(
|
|
||||||
name = "Disable pip notification",
|
|
||||||
description = "Disable pip notification when you first launch pip mode.",
|
|
||||||
dependencies = setOf(
|
|
||||||
SettingsPatch::class,
|
|
||||||
SharedResourceIdPatch::class
|
|
||||||
),
|
|
||||||
compatiblePackages = COMPATIBLE_PACKAGE,
|
|
||||||
fingerprints = setOf(PiPNotificationFingerprint)
|
|
||||||
) {
|
|
||||||
override fun execute(context: BytecodeContext) {
|
|
||||||
|
|
||||||
PiPNotificationFingerprint.resultOrThrow().let {
|
|
||||||
it.mutableMethod.apply {
|
|
||||||
val checkCastCalls = implementation!!.instructions.withIndex()
|
|
||||||
.filter { instruction ->
|
|
||||||
(instruction.value as? ReferenceInstruction)?.reference.toString() == "Lcom/google/apps/tiktok/account/AccountId;"
|
|
||||||
}
|
|
||||||
|
|
||||||
if (checkCastCalls.size != 3)
|
|
||||||
throw PatchException("Couldn't find target Index")
|
|
||||||
|
|
||||||
arrayOf(
|
|
||||||
checkCastCalls.elementAt(1).index,
|
|
||||||
checkCastCalls.elementAt(0).index
|
|
||||||
).forEach { index ->
|
|
||||||
addInstruction(
|
|
||||||
index + 1,
|
|
||||||
"return-void"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SettingsPatch.updatePatchStatus(this)
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.layout.tooltip
|
|
||||||
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
|
||||||
import app.revanced.patches.youtube.layout.tooltip.fingerprints.TooltipContentFullscreenFingerprint
|
|
||||||
import app.revanced.patches.youtube.layout.tooltip.fingerprints.TooltipContentViewFingerprint
|
|
||||||
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
|
|
||||||
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
|
|
||||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
|
||||||
import app.revanced.util.patch.BaseBytecodePatch
|
|
||||||
import app.revanced.util.resultOrThrow
|
|
||||||
|
|
||||||
@Suppress("unused")
|
|
||||||
object TooltipContentViewPatch : BaseBytecodePatch(
|
|
||||||
name = "Hide tooltip content",
|
|
||||||
description = "Hides the tooltip box that appears on first install.",
|
|
||||||
dependencies = setOf(
|
|
||||||
SettingsPatch::class,
|
|
||||||
SharedResourceIdPatch::class
|
|
||||||
),
|
|
||||||
compatiblePackages = COMPATIBLE_PACKAGE,
|
|
||||||
fingerprints = setOf(
|
|
||||||
TooltipContentFullscreenFingerprint,
|
|
||||||
TooltipContentViewFingerprint
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
override fun execute(context: BytecodeContext) {
|
|
||||||
|
|
||||||
arrayOf(
|
|
||||||
TooltipContentFullscreenFingerprint,
|
|
||||||
TooltipContentViewFingerprint
|
|
||||||
).forEach { fingerprint ->
|
|
||||||
fingerprint.resultOrThrow().mutableMethod.addInstruction(
|
|
||||||
0,
|
|
||||||
"return-void"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
SettingsPatch.updatePatchStatus(this)
|
|
||||||
}
|
|
||||||
}
|
|
@ -621,11 +621,9 @@
|
|||||||
|
|
||||||
<PreferenceCategory android:title="@string/revanced_preference_category_others" android:layout="@layout/revanced_settings_preferences_category">
|
<PreferenceCategory android:title="@string/revanced_preference_category_others" android:layout="@layout/revanced_settings_preferences_category">
|
||||||
<Preference android:title="Custom double tap length" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="Custom double tap length" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="Disable pip notification" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
|
||||||
<Preference android:title="GmsCore support" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="GmsCore support" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="Hide animated button background" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="Hide animated button background" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="Hide double tap overlay filter" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="Hide double tap overlay filter" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="Hide tooltip content" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
|
||||||
<Preference android:title="Icon" android:summary="@string/revanced_icon_default" android:selectable="false"/>
|
<Preference android:title="Icon" android:summary="@string/revanced_icon_default" android:selectable="false"/>
|
||||||
<Preference android:title="Label" android:summary="@string/revanced_label_default" android:selectable="false"/>
|
<Preference android:title="Label" android:summary="@string/revanced_label_default" android:selectable="false"/>
|
||||||
<Preference android:title="Return YouTube Dislike" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="Return YouTube Dislike" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user