mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-12-10 03:13:56 +01:00
Compare commits
19 Commits
v2.200.1-d
...
v2.202.0-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18481c66c4 | ||
|
|
8c5487c467 | ||
|
|
a96572001b | ||
|
|
a6267fd00f | ||
|
|
35ac0913c9 | ||
|
|
240696d573 | ||
|
|
b16d64dd58 | ||
|
|
d271ee40ad | ||
|
|
8f49b7ecf5 | ||
|
|
15702c92b3 | ||
|
|
71633b7f1d | ||
|
|
45e55b48e5 | ||
|
|
f2753b2999 | ||
|
|
6268d14212 | ||
|
|
576563a27b | ||
|
|
6cb43c3326 | ||
|
|
89300e1f42 | ||
|
|
094ffd1b34 | ||
|
|
7f15bb4c20 |
62
CHANGELOG.md
62
CHANGELOG.md
@@ -1,3 +1,65 @@
|
|||||||
|
# [2.202.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v2.201.2-dev.1...v2.202.0-dev.1) (2023-11-29)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Modernize restart app logic ([#3343](https://github.com/ReVanced/revanced-patches/issues/3343)) ([3897647](https://github.com/ReVanced/revanced-patches/commit/3897647321b6c1860dc9804cac6c6985da8bb675))
|
||||||
|
|
||||||
|
## [2.201.2-dev.1](https://github.com/ReVanced/revanced-patches/compare/v2.201.1...v2.201.2-dev.1) (2023-11-29)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **YouTube - Restore old seekbar thumbnails:** Move setting into 'Seekbar' submenu ([#3344](https://github.com/ReVanced/revanced-patches/issues/3344)) ([880091a](https://github.com/ReVanced/revanced-patches/commit/880091a96d1a628520732367c96c4c11fb93b72d))
|
||||||
|
|
||||||
|
## [2.201.1](https://github.com/ReVanced/revanced-patches/compare/v2.201.0...v2.201.1) (2023-11-27)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Spotify - Hide premium navbar:** Support latest version ([b87005d](https://github.com/ReVanced/revanced-patches/commit/b87005de0c40293f85d3997f43b353a87a925156))
|
||||||
|
* **YouTube - Hide layout components:** Clarify custom filter usage ([cc16db5](https://github.com/ReVanced/revanced-patches/commit/cc16db56d1c9925852265fcebb459d9620cd1b92))
|
||||||
|
|
||||||
|
## [2.201.1-dev.2](https://github.com/ReVanced/revanced-patches/compare/v2.201.1-dev.1...v2.201.1-dev.2) (2023-11-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Spotify - Hide premium navbar:** Support latest version ([b87005d](https://github.com/ReVanced/revanced-patches/commit/b87005de0c40293f85d3997f43b353a87a925156))
|
||||||
|
|
||||||
|
## [2.201.1-dev.1](https://github.com/ReVanced/revanced-patches/compare/v2.201.0...v2.201.1-dev.1) (2023-11-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **YouTube - Hide layout components:** Clarify custom filter usage ([cc16db5](https://github.com/ReVanced/revanced-patches/commit/cc16db56d1c9925852265fcebb459d9620cd1b92))
|
||||||
|
|
||||||
|
# [2.201.0](https://github.com/ReVanced/revanced-patches/compare/v2.200.0...v2.201.0) (2023-11-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **YouTube - Enable tablet layout:** Respect the original device layout ([b2c5bab](https://github.com/ReVanced/revanced-patches/commit/b2c5babf3fd9ad73daa06e03f4830a9dd7199d0c))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **YouTube - Hide ads:** Hide shopping links in video description ([0c875a1](https://github.com/ReVanced/revanced-patches/commit/0c875a106308ae9747ae998d75b84db1c336762b))
|
||||||
|
* **YouTube - Hide layout components:** Hide "For You" shelf in channel page ([2bc7485](https://github.com/ReVanced/revanced-patches/commit/2bc7485cda5c5e17d65419faca983567a030f9aa))
|
||||||
|
|
||||||
|
# [2.201.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v2.200.0...v2.201.0-dev.1) (2023-11-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **YouTube - Enable tablet layout:** Respect the original device layout ([b2c5bab](https://github.com/ReVanced/revanced-patches/commit/b2c5babf3fd9ad73daa06e03f4830a9dd7199d0c))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **YouTube - Hide ads:** Hide shopping links in video description ([0c875a1](https://github.com/ReVanced/revanced-patches/commit/0c875a106308ae9747ae998d75b84db1c336762b))
|
||||||
|
* **YouTube - Hide layout components:** Hide "For You" shelf in channel page ([2bc7485](https://github.com/ReVanced/revanced-patches/commit/2bc7485cda5c5e17d65419faca983567a030f9aa))
|
||||||
|
|
||||||
## [2.200.1-dev.1](https://github.com/ReVanced/revanced-patches/compare/v2.200.0...v2.200.1-dev.1) (2023-11-23)
|
## [2.200.1-dev.1](https://github.com/ReVanced/revanced-patches/compare/v2.200.0...v2.200.1-dev.1) (2023-11-23)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,13 +12,6 @@ repositories {
|
|||||||
mavenLocal()
|
mavenLocal()
|
||||||
google()
|
google()
|
||||||
maven { url = uri("https://jitpack.io") }
|
maven { url = uri("https://jitpack.io") }
|
||||||
// Required for FlexVer-Java
|
|
||||||
maven {
|
|
||||||
url = uri("https://repo.sleeping.town")
|
|
||||||
content {
|
|
||||||
includeGroup("com.unascribed")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -37,6 +30,22 @@ kotlin {
|
|||||||
jvmToolchain(11)
|
jvmToolchain(11)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.withType(Jar::class) {
|
||||||
|
exclude("app/revanced/meta")
|
||||||
|
|
||||||
|
manifest {
|
||||||
|
attributes["Name"] = "ReVanced Patches"
|
||||||
|
attributes["Description"] = "Patches for ReVanced."
|
||||||
|
attributes["Version"] = version
|
||||||
|
attributes["Timestamp"] = System.currentTimeMillis().toString()
|
||||||
|
attributes["Source"] = "git@github.com:revanced/revanced-patches.git"
|
||||||
|
attributes["Author"] = "ReVanced"
|
||||||
|
attributes["Contact"] = "contact@revanced.app"
|
||||||
|
attributes["Origin"] = "https://revanced.app"
|
||||||
|
attributes["License"] = "GNU General Public License v3.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
register<DefaultTask>("generateBundle") {
|
register<DefaultTask>("generateBundle") {
|
||||||
description = "Generate dex files from build and bundle them in the jar file"
|
description = "Generate dex files from build and bundle them in the jar file"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
org.gradle.parallel = true
|
org.gradle.parallel = true
|
||||||
org.gradle.caching = true
|
org.gradle.caching = true
|
||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.200.1-dev.1
|
version = 2.202.0-dev.1
|
||||||
|
|||||||
@@ -25,18 +25,6 @@ abstract class AbstractSettingsResourcePatch(
|
|||||||
private val sourceDirectory: String,
|
private val sourceDirectory: String,
|
||||||
) : ResourcePatch(), Closeable {
|
) : ResourcePatch(), Closeable {
|
||||||
override fun execute(context: ResourceContext) {
|
override fun execute(context: ResourceContext) {
|
||||||
/*
|
|
||||||
* used for self-restart
|
|
||||||
* TODO: do this only, when necessary
|
|
||||||
*/
|
|
||||||
context.xmlEditor["AndroidManifest.xml"].use { editor ->
|
|
||||||
editor.file.getElementsByTagName("manifest").item(0).also {
|
|
||||||
it.appendChild(it.ownerDocument.createElement("uses-permission").also { element ->
|
|
||||||
element.setAttribute("android:name", "android.permission.SCHEDULE_EXACT_ALARM")
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* copy preference template from source dir */
|
/* copy preference template from source dir */
|
||||||
context.copyResources(
|
context.copyResources(
|
||||||
sourceDirectory,
|
sourceDirectory,
|
||||||
|
|||||||
@@ -1,51 +1,32 @@
|
|||||||
package app.revanced.patches.spotify.navbar
|
package app.revanced.patches.spotify.navbar
|
||||||
|
|
||||||
|
import app.revanced.extensions.exception
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
|
import app.revanced.patches.spotify.navbar.fingerprints.AddNavBarItemFingerprint
|
||||||
import app.revanced.patches.spotify.navbar.fingerprints.AddPremiumNavbarTabFingerprint
|
|
||||||
import app.revanced.patches.spotify.navbar.fingerprints.AddPremiumNavbarTabParentFingerprint
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.WideLiteralInstruction
|
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Hide premium navbar",
|
name = "Hide premium navbar",
|
||||||
description = "Removes the premium tab from the navbar.",
|
description = "Removes the premium tab from the navbar.",
|
||||||
dependencies = [ResourceMappingPatch::class],
|
dependencies = [PremiumNavbarTabResourcePatch::class],
|
||||||
compatiblePackages = [CompatiblePackage("com.spotify.music")]
|
compatiblePackages = [CompatiblePackage("com.spotify.music")]
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object PremiumNavbarTabPatch : BytecodePatch(setOf(AddPremiumNavbarTabParentFingerprint)) {
|
object PremiumNavbarTabPatch : BytecodePatch(
|
||||||
override fun execute(context: BytecodeContext) {
|
setOf(AddNavBarItemFingerprint)
|
||||||
val parentResult = AddPremiumNavbarTabParentFingerprint.result!!
|
) {
|
||||||
AddPremiumNavbarTabFingerprint.resolve(context, parentResult.classDef)
|
// If the navigation bar item is the premium tab, do not add it.
|
||||||
|
override fun execute(context: BytecodeContext) = AddNavBarItemFingerprint.result?.mutableMethod?.addInstructions(
|
||||||
val result = AddPremiumNavbarTabFingerprint.result!!
|
0,
|
||||||
|
"""
|
||||||
val method = result.mutableMethod
|
const v1, ${PremiumNavbarTabResourcePatch.premiumTabId}
|
||||||
val methodInstructions = method.implementation!!.instructions
|
if-ne p5, v1, :continue
|
||||||
val lastInstructionIdx = methodInstructions.size - 1
|
return-void
|
||||||
|
:continue
|
||||||
val premiumTabId =
|
nop
|
||||||
ResourceMappingPatch.resourceMappings.single { it.type == "id" && it.name == "premium_tab" }.id
|
"""
|
||||||
|
) ?: throw AddNavBarItemFingerprint.exception
|
||||||
var removeAmount = 2
|
}
|
||||||
// 2nd const remove method
|
|
||||||
for ((i, instruction) in methodInstructions.asReversed().withIndex()) {
|
|
||||||
if (instruction.opcode.ordinal != Opcode.CONST.ordinal) continue
|
|
||||||
if ((instruction as WideLiteralInstruction).wideLiteral != premiumTabId) continue
|
|
||||||
|
|
||||||
val findThreshold = 10
|
|
||||||
val constIndex = lastInstructionIdx - i
|
|
||||||
val invokeInstruction = methodInstructions.subList(constIndex, constIndex + findThreshold).first {
|
|
||||||
it.opcode.ordinal == Opcode.INVOKE_VIRTUAL_RANGE.ordinal
|
|
||||||
}
|
|
||||||
method.removeInstruction(methodInstructions.indexOf(invokeInstruction))
|
|
||||||
|
|
||||||
if (--removeAmount == 0) break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package app.revanced.patches.spotify.navbar
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
|
||||||
|
|
||||||
|
@Patch(dependencies = [ResourceMappingPatch::class])
|
||||||
|
object PremiumNavbarTabResourcePatch : ResourcePatch() {
|
||||||
|
internal var showBottomNavigationItemsTextId = -1L
|
||||||
|
internal var premiumTabId = -1L
|
||||||
|
|
||||||
|
override fun execute(context: ResourceContext) {
|
||||||
|
premiumTabId = ResourceMappingPatch.resourceMappings.single {
|
||||||
|
it.type == "id" && it.name == "premium_tab"
|
||||||
|
}.id
|
||||||
|
|
||||||
|
showBottomNavigationItemsTextId = ResourceMappingPatch.resourceMappings.single {
|
||||||
|
it.type == "bool" && it.name == "show_bottom_navigation_items_text"
|
||||||
|
}.id
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package app.revanced.patches.spotify.navbar.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patches.spotify.navbar.PremiumNavbarTabResourcePatch
|
||||||
|
import app.revanced.util.patch.LiteralValueFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
object AddNavBarItemFingerprint : LiteralValueFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
literalSupplier = { PremiumNavbarTabResourcePatch.showBottomNavigationItemsTextId },
|
||||||
|
)
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package app.revanced.patches.spotify.navbar.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
|
||||||
|
|
||||||
object AddPremiumNavbarTabFingerprint : MethodFingerprint(
|
|
||||||
parameters = listOf("L", "L", "L", "L", "L", "L")
|
|
||||||
)
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package app.revanced.patches.spotify.navbar.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
|
||||||
|
|
||||||
object AddPremiumNavbarTabParentFingerprint : MethodFingerprint(
|
|
||||||
strings = listOf("com.samsung.android.samsungaccount.action.REQUEST_AUTHCODE")
|
|
||||||
)
|
|
||||||
@@ -111,7 +111,6 @@ object SettingsPatch : BytecodePatch(
|
|||||||
addString("revanced_settings", "ReVanced Settings", false)
|
addString("revanced_settings", "ReVanced Settings", false)
|
||||||
addString("revanced_reboot_message", "Twitch needs to restart to apply your changes. Restart now?", false)
|
addString("revanced_reboot_message", "Twitch needs to restart to apply your changes. Restart now?", false)
|
||||||
addString("revanced_reboot", "Restart", false)
|
addString("revanced_reboot", "Restart", false)
|
||||||
addString("revanced_cancel", "Cancel", false)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addString(identifier: String, value: String, formatted: Boolean = true) =
|
fun addString(identifier: String, value: String, formatted: Boolean = true) =
|
||||||
|
|||||||
@@ -55,6 +55,12 @@ object HideAdsResourcePatch : ResourcePatch() {
|
|||||||
StringResource("revanced_hide_products_banner_summary_on", "Banner is hidden"),
|
StringResource("revanced_hide_products_banner_summary_on", "Banner is hidden"),
|
||||||
StringResource("revanced_hide_products_banner_summary_off", "Banner is shown")
|
StringResource("revanced_hide_products_banner_summary_off", "Banner is shown")
|
||||||
),
|
),
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_hide_shopping_links",
|
||||||
|
StringResource("revanced_hide_shopping_links_title", "Hide shopping links in video description"),
|
||||||
|
StringResource("revanced_hide_shopping_links_summary_on", "Shopping links are hidden"),
|
||||||
|
StringResource("revanced_hide_shopping_links_summary_off", "Shopping links are shown")
|
||||||
|
),
|
||||||
SwitchPreference(
|
SwitchPreference(
|
||||||
"revanced_hide_web_search_results",
|
"revanced_hide_web_search_results",
|
||||||
StringResource("revanced_hide_web_search_results_title", "Hide web search results"),
|
StringResource("revanced_hide_web_search_results_title", "Hide web search results"),
|
||||||
|
|||||||
@@ -74,6 +74,12 @@ object HideLayoutComponentsPatch : BytecodePatch(
|
|||||||
StringResource("revanced_hide_channel_watermark_title_summary_on", "Watermark is hidden"),
|
StringResource("revanced_hide_channel_watermark_title_summary_on", "Watermark is hidden"),
|
||||||
StringResource("revanced_hide_channel_watermark_title_summary_off", "Watermark is shown")
|
StringResource("revanced_hide_channel_watermark_title_summary_off", "Watermark is shown")
|
||||||
),
|
),
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_hide_for_you_shelf",
|
||||||
|
StringResource("revanced_hide_for_you_shelf_title", "Hide \\\'For you\\\' shelf in channel page"),
|
||||||
|
StringResource("revanced_hide_for_you_shelf_summary_on", "Shelf is hidden"),
|
||||||
|
StringResource("revanced_hide_for_you_shelf_summary_off", "Shelf is shown")
|
||||||
|
),
|
||||||
SwitchPreference(
|
SwitchPreference(
|
||||||
"revanced_hide_notify_me_button",
|
"revanced_hide_notify_me_button",
|
||||||
StringResource("revanced_hide_notify_me_button_title", "Hide \\\'Notify me\\\' button"),
|
StringResource("revanced_hide_notify_me_button_title", "Hide \\\'Notify me\\\' button"),
|
||||||
@@ -400,7 +406,7 @@ object HideLayoutComponentsPatch : BytecodePatch(
|
|||||||
StringResource("revanced_custom_filter_strings_title", "Custom filter"),
|
StringResource("revanced_custom_filter_strings_title", "Custom filter"),
|
||||||
StringResource(
|
StringResource(
|
||||||
"revanced_custom_filter_strings_summary",
|
"revanced_custom_filter_strings_summary",
|
||||||
"List of components to filter separated by new line"
|
"List of component path builder strings to filter separated by new line"
|
||||||
),
|
),
|
||||||
inputType = InputType.TEXT_MULTI_LINE
|
inputType = InputType.TEXT_MULTI_LINE
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
|||||||
@Patch(
|
@Patch(
|
||||||
name = "Restore old seekbar thumbnails",
|
name = "Restore old seekbar thumbnails",
|
||||||
description = "Restores the old seekbar thumbnails that appear above the seekbar instead of fullscreen thumbnails.",
|
description = "Restores the old seekbar thumbnails that appear above the seekbar instead of fullscreen thumbnails.",
|
||||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
dependencies = [IntegrationsPatch::class, SeekbarPreferencesPatch::class],
|
||||||
compatiblePackages = [
|
compatiblePackages = [
|
||||||
CompatiblePackage(
|
CompatiblePackage(
|
||||||
"com.google.android.youtube", [
|
"com.google.android.youtube", [
|
||||||
@@ -37,7 +37,7 @@ object RestoreOldSeekbarThumbnailsPatch : BytecodePatch(
|
|||||||
"Lapp/revanced/integrations/patches/RestoreOldSeekbarThumbnailsPatch;"
|
"Lapp/revanced/integrations/patches/RestoreOldSeekbarThumbnailsPatch;"
|
||||||
|
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
SeekbarPreferencesPatch.addPreferences(
|
||||||
SwitchPreference(
|
SwitchPreference(
|
||||||
"revanced_restore_old_seekbar_thumbnails",
|
"revanced_restore_old_seekbar_thumbnails",
|
||||||
StringResource(
|
StringResource(
|
||||||
|
|||||||
@@ -2,8 +2,11 @@ package app.revanced.patches.youtube.layout.tablet
|
|||||||
|
|
||||||
import app.revanced.extensions.exception
|
import app.revanced.extensions.exception
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
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.extensions.InstructionExtensions.getInstructions
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
@@ -13,6 +16,8 @@ import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
|
|||||||
import app.revanced.patches.youtube.layout.tablet.fingerprints.GetFormFactorFingerprint
|
import app.revanced.patches.youtube.layout.tablet.fingerprints.GetFormFactorFingerprint
|
||||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction10x
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Enable tablet layout",
|
name = "Enable tablet layout",
|
||||||
@@ -37,18 +42,28 @@ object EnableTabletLayoutPatch : BytecodePatch(
|
|||||||
|
|
||||||
GetFormFactorFingerprint.result?.let {
|
GetFormFactorFingerprint.result?.let {
|
||||||
it.mutableMethod.apply {
|
it.mutableMethod.apply {
|
||||||
val returnLargeFormFactorIndex = it.scanResult.patternScanResult!!.endIndex - 4
|
val returnCurrentFormFactorIndex = getInstructions().lastIndex - 2
|
||||||
|
|
||||||
|
val returnIsLargeFormFactorLabel = getInstruction(returnCurrentFormFactorIndex - 2)
|
||||||
|
val returnFormFactorIndex = getInstruction(returnCurrentFormFactorIndex)
|
||||||
|
|
||||||
|
val insertIndex = returnCurrentFormFactorIndex + 1
|
||||||
|
|
||||||
|
// Replace the labeled instruction with a nop and add the preserved instructions back
|
||||||
|
replaceInstruction(returnCurrentFormFactorIndex, BuilderInstruction10x(Opcode.NOP))
|
||||||
|
addInstruction(insertIndex, returnFormFactorIndex)
|
||||||
|
|
||||||
|
// Because the labeled instruction is now a nop, we can add our own instructions right after it
|
||||||
addInstructionsWithLabels(
|
addInstructionsWithLabels(
|
||||||
0,
|
insertIndex,
|
||||||
"""
|
"""
|
||||||
invoke-static { v0 }, Lapp/revanced/integrations/patches/EnableTabletLayoutPatch;->enableTabletLayout(Z)Z
|
invoke-static { }, Lapp/revanced/integrations/patches/EnableTabletLayoutPatch;->enableTabletLayout()Z
|
||||||
move-result v0
|
move-result v0 # Free register
|
||||||
if-nez v0, :is_large_form_factor
|
if-nez v0, :is_large_form_factor
|
||||||
""",
|
""",
|
||||||
ExternalLabel(
|
ExternalLabel(
|
||||||
"is_large_form_factor",
|
"is_large_form_factor",
|
||||||
getInstruction(returnLargeFormFactorIndex)
|
returnIsLargeFormFactorLabel
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user