mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-16 22:37:17 +02:00
feat(spoof-app-version): rename patch (enable-old-layout
→ spoof-app-version
)
This commit is contained in:
parent
e80997c246
commit
ed32eddd71
@ -1,14 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.misc.oldlayout.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
|
||||||
import org.jf.dexlib2.Opcode
|
|
||||||
|
|
||||||
object VersionOverrideFingerprint : MethodFingerprint(
|
|
||||||
opcodes = listOf(
|
|
||||||
Opcode.IF_EQZ,
|
|
||||||
Opcode.CONST_STRING
|
|
||||||
),
|
|
||||||
customFingerprint = {
|
|
||||||
it.definingClass.endsWith("VersionOverridePatch;") && it.name == "getVersionOverride"
|
|
||||||
}
|
|
||||||
)
|
|
@ -1,64 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.misc.oldlayout.patch
|
|
||||||
|
|
||||||
import app.revanced.extensions.toErrorResult
|
|
||||||
import app.revanced.patcher.annotation.Description
|
|
||||||
import app.revanced.patcher.annotation.Name
|
|
||||||
import app.revanced.patcher.annotation.Version
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.replaceInstruction
|
|
||||||
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.patcher.patch.annotations.Patch
|
|
||||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
|
||||||
import app.revanced.patches.shared.patch.options.PatchOptions
|
|
||||||
import app.revanced.patches.shared.patch.versionspoof.GeneralVersionSpoofPatch
|
|
||||||
import app.revanced.patches.youtube.misc.oldlayout.fingerprints.VersionOverrideFingerprint
|
|
||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
|
||||||
import app.revanced.util.integrations.Constants.MISC_PATH
|
|
||||||
|
|
||||||
@Patch
|
|
||||||
@Name("enable-old-layout")
|
|
||||||
@Description("Spoof the YouTube client version to use the old layout.")
|
|
||||||
@DependsOn(
|
|
||||||
[
|
|
||||||
GeneralVersionSpoofPatch::class,
|
|
||||||
PatchOptions::class,
|
|
||||||
SettingsPatch::class
|
|
||||||
]
|
|
||||||
)
|
|
||||||
@YouTubeCompatibility
|
|
||||||
@Version("0.0.1")
|
|
||||||
class OldLayoutPatch : BytecodePatch(
|
|
||||||
listOf(
|
|
||||||
VersionOverrideFingerprint
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
override fun execute(context: BytecodeContext): PatchResult {
|
|
||||||
|
|
||||||
GeneralVersionSpoofPatch.injectSpoof("$MISC_PATH/VersionOverridePatch;->getVersionOverride(Ljava/lang/String;)Ljava/lang/String;")
|
|
||||||
|
|
||||||
val clientSpoofVersion = PatchOptions.clientSpoofVersion!!
|
|
||||||
|
|
||||||
VersionOverrideFingerprint.result?.let {
|
|
||||||
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
|
||||||
|
|
||||||
it.mutableMethod.replaceInstruction(insertIndex, "const-string p0, \"$clientSpoofVersion\"")
|
|
||||||
|
|
||||||
} ?: return VersionOverrideFingerprint.toErrorResult()
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Add settings
|
|
||||||
*/
|
|
||||||
SettingsPatch.addPreference(
|
|
||||||
arrayOf(
|
|
||||||
"SETTINGS: ENABLE_OLD_LAYOUT"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
SettingsPatch.updatePatchStatus("enable-old-layout")
|
|
||||||
|
|
||||||
return PatchResultSuccess()
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,47 @@
|
|||||||
|
package app.revanced.patches.youtube.misc.spoofappversion.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||||
|
import app.revanced.patches.shared.patch.versionspoof.GeneralVersionSpoofPatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
|
||||||
|
import app.revanced.util.integrations.Constants.MISC_PATH
|
||||||
|
import app.revanced.util.resources.ResourceUtils.copyXmlNode
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("spoof-app-version")
|
||||||
|
@Description("Tricks YouTube into thinking, you are running an older version of the app. One of the side effects also includes restoring the old UI.")
|
||||||
|
@DependsOn(
|
||||||
|
[
|
||||||
|
GeneralVersionSpoofPatch::class,
|
||||||
|
SettingsPatch::class
|
||||||
|
]
|
||||||
|
)
|
||||||
|
@YouTubeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class SpoofAppVersionPatch : ResourcePatch {
|
||||||
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
|
||||||
|
GeneralVersionSpoofPatch.injectSpoof("$MISC_PATH/VersionOverridePatch;->getVersionOverride(Ljava/lang/String;)Ljava/lang/String;")
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add settings
|
||||||
|
*/
|
||||||
|
SettingsPatch.addPreference(
|
||||||
|
arrayOf(
|
||||||
|
"SETTINGS: SPOOF_APP_VERSION"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
SettingsPatch.updatePatchStatus("spoof-app-version")
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
@ -81,9 +81,11 @@
|
|||||||
<string name="revanced_enable_external_browser_summary_off">External browser is disabled</string>
|
<string name="revanced_enable_external_browser_summary_off">External browser is disabled</string>
|
||||||
<string name="revanced_enable_external_browser_summary_on">External browser is enabled</string>
|
<string name="revanced_enable_external_browser_summary_on">External browser is enabled</string>
|
||||||
<string name="revanced_enable_external_browser_title">Enable external browser</string>
|
<string name="revanced_enable_external_browser_title">Enable external browser</string>
|
||||||
<string name="revanced_enable_old_layout_summary_off">YouTube Layout will follow your Google Account status</string>
|
<string name="revanced_spoof_app_version_summary">"Spoofing the client version to the old version
|
||||||
<string name="revanced_enable_old_layout_summary_on">Trick the YouTube version to force enable old layout</string>
|
|
||||||
<string name="revanced_enable_old_layout_title">Enable old layout</string>
|
This will change the appearance of the app, but unknown side effects may occur
|
||||||
|
If later turned off, the old UI may remain until clear the app data"</string>
|
||||||
|
<string name="revanced_spoof_app_version_title">Spoof app version</string>
|
||||||
<string name="revanced_enable_old_quality_layout_summary_off">New style quality settings are shown</string>
|
<string name="revanced_enable_old_quality_layout_summary_off">New style quality settings are shown</string>
|
||||||
<string name="revanced_enable_old_quality_layout_summary_on">Old style quality settings are shown</string>
|
<string name="revanced_enable_old_quality_layout_summary_on">Old style quality settings are shown</string>
|
||||||
<string name="revanced_enable_old_quality_layout_title">Enable old style quality layout</string>
|
<string name="revanced_enable_old_quality_layout_title">Enable old style quality layout</string>
|
||||||
|
@ -429,8 +429,9 @@
|
|||||||
<ListPreference android:title="@string/revanced_double_back_timeout_title" android:summary="@string/revanced_double_back_timeout_summary" android:key="revanced_double_back_timeout" android:defaultValue="2" />SETTINGS: DOUBLE_BACK_TIMEOUT -->
|
<ListPreference android:title="@string/revanced_double_back_timeout_title" android:summary="@string/revanced_double_back_timeout_summary" android:key="revanced_double_back_timeout" android:defaultValue="2" />SETTINGS: DOUBLE_BACK_TIMEOUT -->
|
||||||
|
|
||||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_experimental_flag" />
|
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_experimental_flag" />
|
||||||
<!-- SETTINGS: ENABLE_OLD_LAYOUT
|
<!-- SETTINGS: SPOOF_APP_VERSION
|
||||||
<SwitchPreference android:title="@string/revanced_enable_old_layout_title" android:key="revanced_enable_old_layout" android:defaultValue="false" android:summaryOn="@string/revanced_enable_old_layout_summary_on" android:summaryOff="@string/revanced_enable_old_layout_summary_off" />SETTINGS: ENABLE_OLD_LAYOUT -->
|
<SwitchPreference android:title="@string/revanced_spoof_app_version_title" android:key="revanced_spoof_app_version" android:defaultValue="false" android:summary="@string/revanced_spoof_app_version_summary" />SETTINGS: SPOOF_APP_VERSION -->
|
||||||
|
|
||||||
<!-- SETTINGS: LAYOUT_SWITCH
|
<!-- SETTINGS: LAYOUT_SWITCH
|
||||||
<SwitchPreference android:title="@string/revanced_enable_tablet_layout_title" android:key="revanced_enable_tablet_layout" android:summary="@string/revanced_enable_tablet_layout_summary" android:defaultValue="false" />
|
<SwitchPreference android:title="@string/revanced_enable_tablet_layout_title" android:key="revanced_enable_tablet_layout" android:summary="@string/revanced_enable_tablet_layout_summary" android:defaultValue="false" />
|
||||||
<SwitchPreference android:title="@string/revanced_enable_phone_layout_title" android:key="revanced_enable_phone_layout" android:summary="@string/revanced_enable_phone_layout_summary" android:defaultValue="false" />SETTINGS: LAYOUT_SWITCH -->
|
<SwitchPreference android:title="@string/revanced_enable_phone_layout_title" android:key="revanced_enable_phone_layout" android:summary="@string/revanced_enable_phone_layout_summary" android:defaultValue="false" />SETTINGS: LAYOUT_SWITCH -->
|
||||||
@ -538,7 +539,7 @@
|
|||||||
<Preference android:title="enable-external-browser" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="enable-external-browser" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="enable-open-links-directly" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="enable-open-links-directly" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="bypass-ambient-mode-restrictions" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="bypass-ambient-mode-restrictions" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="enable-old-layout" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="spoof-app-version" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="layout-switch" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="layout-switch" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="force-vp9-codec" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="force-vp9-codec" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
<Preference android:title="disable-quic-protocol" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
<Preference android:title="disable-quic-protocol" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user