mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-28 21:21:02 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5237c3a1a6 | ||
|
|
7d6f205fd9 | ||
|
|
f82aae930b | ||
|
|
83b11c92af | ||
|
|
a9abab97d7 |
13
CHANGELOG.md
13
CHANGELOG.md
@@ -1,3 +1,16 @@
|
|||||||
|
# [2.30.0](https://github.com/revanced/revanced-patches/compare/v2.29.0...v2.30.0) (2022-08-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* incorrect fingerprint version [skip ci] ([f8c62ae](https://github.com/revanced/revanced-patches/commit/f8c62ae16b088ff6d0e96a4ef62dc707cd83beb9))
|
||||||
|
* rollback to `Dependencies` annotation ([36a2ae8](https://github.com/revanced/revanced-patches/commit/36a2ae886c63f1d22bb1cca9e7110af6c3f6f2d3))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* set the correct theme of the settings screen ([70d850c](https://github.com/revanced/revanced-patches/commit/70d850cf295d306b0de9419efe6a4bbf3857d3a0))
|
||||||
|
|
||||||
# [2.29.0](https://github.com/revanced/revanced-patches/compare/v2.28.2...v2.29.0) (2022-08-02)
|
# [2.29.0](https://github.com/revanced/revanced-patches/compare/v2.28.2...v2.29.0) (2022-08-02)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.29.0
|
version = 2.30.0
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import app.revanced.patcher.annotation.Version
|
|||||||
import app.revanced.patcher.data.impl.ResourceData
|
import app.revanced.patcher.data.impl.ResourceData
|
||||||
import app.revanced.patcher.patch.PatchResult
|
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.Dependencies
|
||||||
import app.revanced.patcher.patch.impl.ResourcePatch
|
import app.revanced.patcher.patch.impl.ResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
|
||||||
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
|
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
|
||||||
@@ -15,8 +15,7 @@ import app.revanced.patches.youtube.misc.microg.shared.Constants.REVANCED_PACKAG
|
|||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsResourcePatch
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsResourcePatch
|
||||||
|
|
||||||
@Name("microg-resource-patch")
|
@Name("microg-resource-patch")
|
||||||
@DependsOn(FixLocaleConfigErrorPatch::class)
|
@Dependencies([FixLocaleConfigErrorPatch::class, SettingsResourcePatch::class])
|
||||||
@DependsOn(SettingsResourcePatch::class)
|
|
||||||
@Description("Resource patch to allow YouTube ReVanced to run without root and under a different package name.")
|
@Description("Resource patch to allow YouTube ReVanced to run without root and under a different package name.")
|
||||||
@MicroGPatchCompatibility
|
@MicroGPatchCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package app.revanced.patches.youtube.misc.settings.bytecode.fingerprints
|
|||||||
|
|
||||||
import app.revanced.patcher.annotation.Name
|
import app.revanced.patcher.annotation.Name
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
|
|
||||||
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
import app.revanced.patches.youtube.layout.returnyoutubedislike.annotations.ReturnYouTubeDislikeCompatibility
|
import app.revanced.patches.youtube.layout.returnyoutubedislike.annotations.ReturnYouTubeDislikeCompatibility
|
||||||
@@ -13,9 +12,8 @@ import app.revanced.patches.youtube.layout.returnyoutubedislike.annotations.Retu
|
|||||||
@MatchingMethod(
|
@MatchingMethod(
|
||||||
"Lcom/google/android/libraries/social/licenses/LicenseActivity;", "onCreate"
|
"Lcom/google/android/libraries/social/licenses/LicenseActivity;", "onCreate"
|
||||||
)
|
)
|
||||||
@FuzzyPatternScanMethod(2)
|
|
||||||
@ReturnYouTubeDislikeCompatibility
|
@ReturnYouTubeDislikeCompatibility
|
||||||
@Version("0.0.2")
|
@Version("0.0.1")
|
||||||
object LicenseActivityFingerprint : MethodFingerprint(
|
object LicenseActivityFingerprint : MethodFingerprint(
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
|||||||
@@ -13,9 +13,8 @@ import app.revanced.patches.youtube.layout.returnyoutubedislike.annotations.Retu
|
|||||||
@MatchingMethod(
|
@MatchingMethod(
|
||||||
"Lapp/revanced/integrations/settingsmenu/ReVancedSettingActivity;", "initializeSettings"
|
"Lapp/revanced/integrations/settingsmenu/ReVancedSettingActivity;", "initializeSettings"
|
||||||
)
|
)
|
||||||
@FuzzyPatternScanMethod(2)
|
|
||||||
@ReturnYouTubeDislikeCompatibility
|
@ReturnYouTubeDislikeCompatibility
|
||||||
@Version("0.0.2")
|
@Version("0.0.1")
|
||||||
object ReVancedSettingsActivityFingerprint : MethodFingerprint(
|
object ReVancedSettingsActivityFingerprint : MethodFingerprint(
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package app.revanced.patches.youtube.misc.settings.bytecode.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.returnyoutubedislike.annotations.ReturnYouTubeDislikeCompatibility
|
||||||
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
|
||||||
|
|
||||||
|
@Name("theme-setter-fingerprint")
|
||||||
|
@MatchingMethod(
|
||||||
|
"Lfyq;", "a"
|
||||||
|
)
|
||||||
|
@ReturnYouTubeDislikeCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object ThemeSetterFingerprint : MethodFingerprint(
|
||||||
|
"L",
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
listOf(Opcode.RETURN_OBJECT),
|
||||||
|
null,
|
||||||
|
{ methodDef ->
|
||||||
|
methodDef.implementation?.instructions?.any {
|
||||||
|
it.opcode.ordinal == Opcode.CONST.ordinal && (it as WideLiteralInstruction).wideLiteral == SettingsPatch.appearanceStringId
|
||||||
|
} == true
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -11,24 +11,28 @@ import app.revanced.patcher.patch.PatchResultSuccess
|
|||||||
import app.revanced.patcher.patch.annotations.Dependencies
|
import app.revanced.patcher.patch.annotations.Dependencies
|
||||||
import app.revanced.patcher.patch.annotations.Patch
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
import app.revanced.patcher.patch.impl.BytecodePatch
|
import app.revanced.patcher.patch.impl.BytecodePatch
|
||||||
|
import app.revanced.patcher.util.smali.toInstruction
|
||||||
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
|
import app.revanced.patches.youtube.misc.mapping.patch.ResourceIdMappingProviderResourcePatch
|
||||||
import app.revanced.patches.youtube.misc.settings.annotations.SettingsCompatibility
|
import app.revanced.patches.youtube.misc.settings.annotations.SettingsCompatibility
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.LicenseActivityFingerprint
|
import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.LicenseActivityFingerprint
|
||||||
import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.ReVancedSettingsActivityFingerprint
|
import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.ReVancedSettingsActivityFingerprint
|
||||||
|
import app.revanced.patches.youtube.misc.settings.bytecode.fingerprints.ThemeSetterFingerprint
|
||||||
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsResourcePatch
|
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsResourcePatch
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Dependencies([IntegrationsPatch::class, SettingsResourcePatch::class])
|
@Dependencies([IntegrationsPatch::class, SettingsResourcePatch::class, ResourceIdMappingProviderResourcePatch::class])
|
||||||
@Name("settings")
|
@Name("settings")
|
||||||
@Description("Adds settings for ReVanced to YouTube.")
|
@Description("Adds settings for ReVanced to YouTube.")
|
||||||
@SettingsCompatibility
|
@SettingsCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class SettingsPatch : BytecodePatch(
|
class SettingsPatch : BytecodePatch(
|
||||||
listOf(LicenseActivityFingerprint, ReVancedSettingsActivityFingerprint)
|
listOf(LicenseActivityFingerprint, ReVancedSettingsActivityFingerprint, ThemeSetterFingerprint)
|
||||||
) {
|
) {
|
||||||
override fun execute(data: BytecodeData): PatchResult {
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
val licenseActivityResult = LicenseActivityFingerprint.result!!
|
val licenseActivityResult = LicenseActivityFingerprint.result!!
|
||||||
val settingsResult = ReVancedSettingsActivityFingerprint.result!!
|
val settingsResult = ReVancedSettingsActivityFingerprint.result!!
|
||||||
|
val themeSetterResult = ThemeSetterFingerprint.result!!
|
||||||
|
|
||||||
val licenseActivityClass = licenseActivityResult.mutableClass
|
val licenseActivityClass = licenseActivityResult.mutableClass
|
||||||
val settingsClass = settingsResult.mutableClass
|
val settingsClass = settingsResult.mutableClass
|
||||||
@@ -37,7 +41,25 @@ class SettingsPatch : BytecodePatch(
|
|||||||
val setThemeMethodName = "setTheme"
|
val setThemeMethodName = "setTheme"
|
||||||
val initializeSettings = settingsResult.mutableMethod
|
val initializeSettings = settingsResult.mutableMethod
|
||||||
|
|
||||||
// First add the setTheme call to the onCreate method to not affect the offsets.
|
val setThemeInstruction =
|
||||||
|
"invoke-static {v0}, Lapp/revanced/integrations/utils/ThemeHelper;->setTheme(Ljava/lang/Object;)V".toInstruction(
|
||||||
|
themeSetterResult.mutableMethod
|
||||||
|
)
|
||||||
|
|
||||||
|
// add instructions to set the theme of the settings activity
|
||||||
|
themeSetterResult.mutableMethod.implementation!!.let {
|
||||||
|
it.addInstruction(
|
||||||
|
themeSetterResult.patternScanResult!!.startIndex,
|
||||||
|
setThemeInstruction
|
||||||
|
)
|
||||||
|
|
||||||
|
it.addInstruction(
|
||||||
|
it.instructions.size - 1, // add before return
|
||||||
|
setThemeInstruction
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the setTheme call to the onCreate method to not affect the offsets.
|
||||||
onCreate.addInstructions(
|
onCreate.addInstructions(
|
||||||
1,
|
1,
|
||||||
"""
|
"""
|
||||||
@@ -46,11 +68,18 @@ class SettingsPatch : BytecodePatch(
|
|||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
// Add the initializeSettings call to the onCreate method.
|
// add the initializeSettings call to the onCreate method.
|
||||||
onCreate.addInstruction(
|
onCreate.addInstruction(
|
||||||
0,
|
0,
|
||||||
"invoke-static { p0 }, ${settingsClass.type}->$setThemeMethodName(${licenseActivityClass.type})V"
|
"invoke-static { p0 }, ${settingsClass.type}->$setThemeMethodName(${licenseActivityClass.type})V"
|
||||||
)
|
)
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal companion object {
|
||||||
|
val appearanceStringId = ResourceIdMappingProviderResourcePatch.resourceMappings.find {
|
||||||
|
it.type == "string" && it.name == "app_theme_appearance_dark"
|
||||||
|
}!!.id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user