mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-29 05:10:20 +02:00
feat(youtube): add new-layout-alert-dialog
patch
This commit is contained in:
parent
70761a6676
commit
b2331ad875
@ -13,9 +13,11 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
|||||||
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.patches.youtube.flyoutpanel.oldqualitylayout.fingerprints.QualityMenuViewInflateFingerprint
|
import app.revanced.patches.youtube.flyoutpanel.oldqualitylayout.fingerprints.QualityMenuViewInflateFingerprint
|
||||||
|
import app.revanced.patches.youtube.utils.alertdialog.patch.NewLayoutAlertDialogPatch
|
||||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||||
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||||
|
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
|
||||||
import app.revanced.util.integrations.Constants.FLYOUT_PANEL
|
import app.revanced.util.integrations.Constants.FLYOUT_PANEL
|
||||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
@ -24,6 +26,7 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
|||||||
@Description("Enables the original quality flyout menu.")
|
@Description("Enables the original quality flyout menu.")
|
||||||
@DependsOn(
|
@DependsOn(
|
||||||
[
|
[
|
||||||
|
NewLayoutAlertDialogPatch::class,
|
||||||
SettingsPatch::class,
|
SettingsPatch::class,
|
||||||
SharedResourceIdPatch::class
|
SharedResourceIdPatch::class
|
||||||
]
|
]
|
||||||
@ -47,6 +50,8 @@ class OldQualityLayoutPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
} ?: return QualityMenuViewInflateFingerprint.toErrorResult()
|
} ?: return QualityMenuViewInflateFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
context.updatePatchStatus("OldQualityLayout")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
package app.revanced.patches.youtube.utils.alertdialog.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch.Companion.BottomSheetRecyclerView
|
||||||
|
import app.revanced.util.bytecode.isWideLiteralExists
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object BottomSheetRecyclerViewBuilderFingerprint : MethodFingerprint(
|
||||||
|
returnType = "L",
|
||||||
|
accessFlags = AccessFlags.PROTECTED or AccessFlags.FINAL,
|
||||||
|
parameters = listOf(),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.IF_NEZ,
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.RETURN_OBJECT,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.IF_EQZ
|
||||||
|
),
|
||||||
|
customFingerprint = { methodDef, _ -> methodDef.isWideLiteralExists(BottomSheetRecyclerView) }
|
||||||
|
)
|
@ -0,0 +1,49 @@
|
|||||||
|
package app.revanced.patches.youtube.utils.alertdialog.patch
|
||||||
|
|
||||||
|
import app.revanced.extensions.toErrorResult
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patches.youtube.misc.spoofappversion.patch.SpoofAppVersionPatch
|
||||||
|
import app.revanced.patches.youtube.utils.alertdialog.fingerprints.BottomSheetRecyclerViewBuilderFingerprint
|
||||||
|
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||||
|
import app.revanced.patches.youtube.utils.resourceid.patch.SharedResourceIdPatch
|
||||||
|
import app.revanced.util.integrations.Constants.UTILS_PATH
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
|
@Name("new-layout-alert-dialog")
|
||||||
|
@DependsOn(
|
||||||
|
[
|
||||||
|
SharedResourceIdPatch::class,
|
||||||
|
SpoofAppVersionPatch::class
|
||||||
|
]
|
||||||
|
)
|
||||||
|
@YouTubeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class NewLayoutAlertDialogPatch : BytecodePatch(
|
||||||
|
listOf(BottomSheetRecyclerViewBuilderFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
BottomSheetRecyclerViewBuilderFingerprint.result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val contextIndex = it.scanResult.patternScanResult!!.startIndex + 3
|
||||||
|
val contextRegister = getInstruction<OneRegisterInstruction>(contextIndex).registerA
|
||||||
|
|
||||||
|
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
|
||||||
|
addInstruction(
|
||||||
|
insertIndex,
|
||||||
|
"invoke-static {v$contextRegister}, $UTILS_PATH/NewPlayerFlyoutPanelsDetectPatch;->showAlertDialog(Landroid/content/Context;)V"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: return BottomSheetRecyclerViewBuilderFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
@ -36,6 +36,7 @@ class SharedResourceIdPatch : ResourcePatch {
|
|||||||
var BackgroundCategory: Long = -1
|
var BackgroundCategory: Long = -1
|
||||||
var BarContainerHeight: Long = -1
|
var BarContainerHeight: Long = -1
|
||||||
var BottomPanelOverlayText: Long = -1
|
var BottomPanelOverlayText: Long = -1
|
||||||
|
var BottomSheetRecyclerView: Long = -1
|
||||||
var BottomUiContainerStub: Long = -1
|
var BottomUiContainerStub: Long = -1
|
||||||
var ChannelListSubMenu: Long = -1
|
var ChannelListSubMenu: Long = -1
|
||||||
var CompactLink: Long = -1
|
var CompactLink: Long = -1
|
||||||
@ -104,6 +105,7 @@ class SharedResourceIdPatch : ResourcePatch {
|
|||||||
BackgroundCategory = find(STRING, "pref_background_and_offline_category")
|
BackgroundCategory = find(STRING, "pref_background_and_offline_category")
|
||||||
BarContainerHeight = find(DIMEN, "bar_container_height")
|
BarContainerHeight = find(DIMEN, "bar_container_height")
|
||||||
BottomPanelOverlayText = find(ID, "bottom_panel_overlay_text")
|
BottomPanelOverlayText = find(ID, "bottom_panel_overlay_text")
|
||||||
|
BottomSheetRecyclerView = find(LAYOUT, "bottom_sheet_recycler_view")
|
||||||
BottomUiContainerStub = find(ID, "bottom_ui_container_stub")
|
BottomUiContainerStub = find(ID, "bottom_ui_container_stub")
|
||||||
ChannelListSubMenu = find(LAYOUT, "channel_list_sub_menu")
|
ChannelListSubMenu = find(LAYOUT, "channel_list_sub_menu")
|
||||||
CompactLink = find(LAYOUT, "compact_link")
|
CompactLink = find(LAYOUT, "compact_link")
|
||||||
|
@ -13,10 +13,12 @@ import app.revanced.patcher.patch.PatchResult
|
|||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
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.patches.youtube.utils.alertdialog.patch.NewLayoutAlertDialogPatch
|
||||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||||
import app.revanced.patches.youtube.video.customspeed.fingerprints.SpeedArrayGeneratorFingerprint
|
import app.revanced.patches.youtube.video.customspeed.fingerprints.SpeedArrayGeneratorFingerprint
|
||||||
import app.revanced.patches.youtube.video.customspeed.fingerprints.SpeedLimiterFingerprint
|
import app.revanced.patches.youtube.video.customspeed.fingerprints.SpeedLimiterFingerprint
|
||||||
|
import app.revanced.util.bytecode.BytecodeHelper.updatePatchStatus
|
||||||
import app.revanced.util.integrations.Constants.VIDEO_PATH
|
import app.revanced.util.integrations.Constants.VIDEO_PATH
|
||||||
import org.jf.dexlib2.Opcode
|
import org.jf.dexlib2.Opcode
|
||||||
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
|
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
|
||||||
@ -28,7 +30,12 @@ import org.jf.dexlib2.iface.reference.MethodReference
|
|||||||
@Patch
|
@Patch
|
||||||
@Name("custom-video-speed")
|
@Name("custom-video-speed")
|
||||||
@Description("Adds more video speed options.")
|
@Description("Adds more video speed options.")
|
||||||
@DependsOn([SettingsPatch::class])
|
@DependsOn(
|
||||||
|
[
|
||||||
|
NewLayoutAlertDialogPatch::class,
|
||||||
|
SettingsPatch::class
|
||||||
|
]
|
||||||
|
)
|
||||||
@YouTubeCompatibility
|
@YouTubeCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class CustomVideoSpeedPatch : BytecodePatch(
|
class CustomVideoSpeedPatch : BytecodePatch(
|
||||||
@ -114,6 +121,8 @@ class CustomVideoSpeedPatch : BytecodePatch(
|
|||||||
}
|
}
|
||||||
} ?: return SpeedLimiterFingerprint.toErrorResult()
|
} ?: return SpeedLimiterFingerprint.toErrorResult()
|
||||||
|
|
||||||
|
context.updatePatchStatus("CustomVideoSpeed")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add settings
|
* Add settings
|
||||||
*/
|
*/
|
||||||
|
@ -492,6 +492,9 @@ Only available on YouTube v18.24.37+"</string>
|
|||||||
<string name="revanced_layout_title">Layout</string>
|
<string name="revanced_layout_title">Layout</string>
|
||||||
<string name="revanced_misc">Miscellaneous</string>
|
<string name="revanced_misc">Miscellaneous</string>
|
||||||
<string name="revanced_navigation">Navigation</string>
|
<string name="revanced_navigation">Navigation</string>
|
||||||
|
<string name="revanced_new_player_flyout_panel_alert_dialog_message_footer" formatted="false">There is no valid resolution for this issue yet\nOnly spoofing the client version to %s can temporarily fix this issue\n\nSpoofing the client version to %s?"</string>
|
||||||
|
<string name="revanced_new_player_flyout_panel_alert_dialog_message_header">The following settings do not work in the new player flyout panel :</string>
|
||||||
|
<string name="revanced_new_player_flyout_panel_alert_dialog_title">New player flyout panel detected</string>
|
||||||
<string name="revanced_open_library_startup_summary_off">Library is not opened at app startup</string>
|
<string name="revanced_open_library_startup_summary_off">Library is not opened at app startup</string>
|
||||||
<string name="revanced_open_library_startup_summary_on">Library is opened at app startup</string>
|
<string name="revanced_open_library_startup_summary_on">Library is opened at app startup</string>
|
||||||
<string name="revanced_open_library_startup_title">Open library on app startup</string>
|
<string name="revanced_open_library_startup_title">Open library on app startup</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user