mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-27 20:51:03 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
559d7ad50c | ||
|
|
e1bbe59b40 | ||
|
|
2f932d697b | ||
|
|
237129d327 | ||
|
|
e4d7dc0aa9 |
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,3 +1,17 @@
|
|||||||
|
# [2.74.0](https://github.com/revanced/revanced-patches/compare/v2.73.0...v2.74.0) (2022-09-29)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* `disable-startup-shorts-player` patch ([#670](https://github.com/revanced/revanced-patches/issues/670)) ([feb3bd0](https://github.com/revanced/revanced-patches/commit/feb3bd02aaf67379733d10988fd58b0c3924f88e))
|
||||||
|
|
||||||
|
# [2.73.0](https://github.com/revanced/revanced-patches/compare/v2.72.1...v2.73.0) (2022-09-29)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* `dynamic-color` patch ([#652](https://github.com/revanced/revanced-patches/issues/652)) ([a16575b](https://github.com/revanced/revanced-patches/commit/a16575b984354138b9ab175307be8d15de60b6a6))
|
||||||
|
|
||||||
## [2.72.1](https://github.com/revanced/revanced-patches/compare/v2.72.0...v2.72.1) (2022-09-29)
|
## [2.72.1](https://github.com/revanced/revanced-patches/compare/v2.72.0...v2.72.1) (2022-09-29)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|:--------:|:--------------:|:-----------------:|
|
||||||
| `monochrome-icon` | Adds a monochrome icon. | all |
|
| `monochrome-icon` | Adds a monochrome icon. | all |
|
||||||
|
| `dynamic-color` | Replaces the default Twitter Blue with the users Material You palette. | all |
|
||||||
| `timeline-ads` | Removes ads from the Twitter timeline. | all |
|
| `timeline-ads` | Removes ads from the Twitter timeline. | all |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
@@ -118,6 +119,7 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `enable-wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 17.36.37 |
|
| `enable-wide-searchbar` | Replaces the search icon with a wide search bar. This will hide the YouTube logo when active. | 17.36.37 |
|
||||||
| `disable-fullscreen-panels` | Disables video description and comments panel in fullscreen view. | 17.36.37 |
|
| `disable-fullscreen-panels` | Disables video description and comments panel in fullscreen view. | 17.36.37 |
|
||||||
| `hide-autoplay-button` | Hides the autoplay button in the video player. | 17.36.37 |
|
| `hide-autoplay-button` | Hides the autoplay button in the video player. | 17.36.37 |
|
||||||
|
| `disable-startup-shorts-player` | Disables playing YouTube Shorts when launching YouTube. | 17.36.37 |
|
||||||
| `premium-heading` | Shows premium branding on the home screen. | all |
|
| `premium-heading` | Shows premium branding on the home screen. | all |
|
||||||
| `custom-branding` | Changes the YouTube launcher icon and name to your choice (defaults to ReVanced). | all |
|
| `custom-branding` | Changes the YouTube launcher icon and name to your choice (defaults to ReVanced). | all |
|
||||||
| `hide-create-button` | Hides the create button in the navigation bar. | 17.36.37 |
|
| `hide-create-button` | Hides the create button in the navigation bar. | 17.36.37 |
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("app.revanced:revanced-patcher:5.1.0")
|
implementation("app.revanced:revanced-patcher:5.1.2")
|
||||||
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
||||||
// Required for meta
|
// Required for meta
|
||||||
implementation("com.google.code.gson:gson:2.9.1")
|
implementation("com.google.code.gson:gson:2.9.1")
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.72.1
|
version = 2.74.0
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
|
|||||||
|
package app.revanced.patches.twitter.misc.dynamiccolor.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility([Package("com.twitter.android")])
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class DynamicColorCompatibility
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
package app.revanced.patches.twitter.misc.dynamiccolor.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.impl.ResourceData
|
||||||
|
import app.revanced.patcher.patch.PatchResult
|
||||||
|
import app.revanced.patcher.patch.PatchResultError
|
||||||
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patcher.patch.impl.ResourcePatch
|
||||||
|
import app.revanced.patches.twitter.misc.dynamiccolor.annotations.DynamicColorCompatibility
|
||||||
|
import java.nio.file.Files
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@Name("dynamic-color")
|
||||||
|
@Description("Replaces the default Twitter Blue with the users Material You palette.")
|
||||||
|
@DynamicColorCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class DynamicColorPatch : ResourcePatch() {
|
||||||
|
override fun execute(data: ResourceData): PatchResult {
|
||||||
|
val resDirectory = data["res"]
|
||||||
|
if (!resDirectory.isDirectory) return PatchResultError("The res folder can not be found.")
|
||||||
|
|
||||||
|
val valuesV31Directory = resDirectory.resolve("values-v31")
|
||||||
|
if (!valuesV31Directory.isDirectory) Files.createDirectories(valuesV31Directory.toPath())
|
||||||
|
|
||||||
|
val valuesNightV31Directory = resDirectory.resolve("values-night-v31")
|
||||||
|
if (!valuesNightV31Directory.isDirectory) Files.createDirectories(valuesNightV31Directory.toPath())
|
||||||
|
|
||||||
|
listOf(valuesV31Directory, valuesNightV31Directory).forEach {
|
||||||
|
val colorsXml = it.resolve("colors.xml")
|
||||||
|
|
||||||
|
if(!colorsXml.exists()) {
|
||||||
|
Files.writeString(
|
||||||
|
colorsXml.toPath(),
|
||||||
|
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
|
||||||
|
"<resources>\n" +
|
||||||
|
"</resources>"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data.xmlEditor["res/values-v31/colors.xml"].use { editor ->
|
||||||
|
val document = editor.file
|
||||||
|
|
||||||
|
mapOf(
|
||||||
|
"ps__twitter_blue" to "@color/twitter_blue",
|
||||||
|
"ps__twitter_blue_pressed" to "@color/twitter_blue_fill_pressed",
|
||||||
|
"twitter_blue" to "@android:color/system_accent1_400",
|
||||||
|
"twitter_blue_fill_pressed" to "@android:color/system_accent1_300",
|
||||||
|
"twitter_blue_opacity_30" to "@android:color/system_accent1_100",
|
||||||
|
"twitter_blue_opacity_50" to "@android:color/system_accent1_200",
|
||||||
|
"twitter_blue_opacity_58" to "@android:color/system_accent1_300",
|
||||||
|
"deep_transparent_twitter_blue" to "@android:color/system_accent1_200",
|
||||||
|
"ic_launcher_background" to "#1DA1F2"
|
||||||
|
).forEach { (k, v) ->
|
||||||
|
val colorElement = document.createElement("color")
|
||||||
|
|
||||||
|
colorElement.setAttribute("name", k)
|
||||||
|
colorElement.textContent = v
|
||||||
|
|
||||||
|
document.getElementsByTagName("resources").item(0).appendChild(colorElement)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data.xmlEditor["res/values-night-v31/colors.xml"].use { editor ->
|
||||||
|
val document = editor.file
|
||||||
|
|
||||||
|
mapOf(
|
||||||
|
"twitter_blue" to "@android:color/system_accent1_200",
|
||||||
|
"twitter_blue_fill_pressed" to "@android:color/system_accent1_300",
|
||||||
|
"twitter_blue_opacity_30" to "@android:color/system_accent1_50",
|
||||||
|
"twitter_blue_opacity_50" to "@android:color/system_accent1_100",
|
||||||
|
"twitter_blue_opacity_58" to "@android:color/system_accent1_200",
|
||||||
|
"deep_transparent_twitter_blue" to "@android:color/system_accent1_200"
|
||||||
|
).forEach { (k, v) ->
|
||||||
|
val colorElement = document.createElement("color")
|
||||||
|
|
||||||
|
colorElement.setAttribute("name", k)
|
||||||
|
colorElement.textContent = v
|
||||||
|
|
||||||
|
document.getElementsByTagName("resources").item(0).appendChild(colorElement)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.startupshortsreset.annotations
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Compatibility
|
||||||
|
import app.revanced.patcher.annotation.Package
|
||||||
|
|
||||||
|
@Compatibility(
|
||||||
|
[Package(
|
||||||
|
"com.google.android.youtube", arrayOf("17.33.42", "17.36.37")
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
@Target(AnnotationTarget.CLASS)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
internal annotation class StartupShortsResetCompatibility
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.startupshortsreset.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.annotation.MatchingMethod
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patches.youtube.layout.startupshortsreset.annotations.StartupShortsResetCompatibility
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
@Name("action-open-shorts-fingerprint")
|
||||||
|
@MatchingMethod("Lkyt;", "l")
|
||||||
|
@StartupShortsResetCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
object ActionOpenShortsFingerprint : MethodFingerprint(
|
||||||
|
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("L", "L"), listOf(
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.CONST_STRING,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
Opcode.IPUT_BOOLEAN,
|
||||||
|
Opcode.IGET_BOOLEAN,
|
||||||
|
Opcode.IF_NEZ,
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
Opcode.CONST_CLASS,
|
||||||
|
),
|
||||||
|
listOf("com.google.android.youtube.action.open.shorts"),
|
||||||
|
)
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package app.revanced.patches.youtube.layout.startupshortsreset.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.annotation.Description
|
||||||
|
import app.revanced.patcher.annotation.Name
|
||||||
|
import app.revanced.patcher.annotation.Version
|
||||||
|
import app.revanced.patcher.data.impl.BytecodeData
|
||||||
|
import app.revanced.patcher.extensions.addInstructions
|
||||||
|
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.patcher.patch.impl.BytecodePatch
|
||||||
|
import app.revanced.patches.youtube.layout.startupshortsreset.annotations.StartupShortsResetCompatibility
|
||||||
|
import app.revanced.patches.youtube.layout.startupshortsreset.fingerprints.ActionOpenShortsFingerprint
|
||||||
|
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
|
||||||
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource
|
||||||
|
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference
|
||||||
|
import org.jf.dexlib2.builder.instruction.BuilderInstruction21c
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
|
||||||
|
@Name("disable-startup-shorts-player")
|
||||||
|
@Description("Disables playing YouTube Shorts when launching YouTube.")
|
||||||
|
@StartupShortsResetCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class DisableShortsOnStartupPatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
ActionOpenShortsFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(data: BytecodeData): PatchResult {
|
||||||
|
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||||
|
SwitchPreference(
|
||||||
|
"revanced_startup_shorts_player_enabled",
|
||||||
|
StringResource("revanced_startup_shorts_player_title", "Disable shorts player at app startup"),
|
||||||
|
false,
|
||||||
|
StringResource("revanced_startup_shorts_player_summary_on", "Shorts player is disabled at app startup"),
|
||||||
|
StringResource("revanced_startup_shorts_player_summary_off", "Shorts player is enabled at app startup")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
val actionOpenShortsResult = ActionOpenShortsFingerprint.result
|
||||||
|
val actionOpenShortsMethod = actionOpenShortsResult!!.mutableMethod
|
||||||
|
val actionOpenShortsInstructions = actionOpenShortsMethod.implementation!!.instructions
|
||||||
|
|
||||||
|
val moveResultIndex = actionOpenShortsResult.scanResult.stringsScanResult!!.matches.first().index + 5
|
||||||
|
val iPutBooleanIndex = moveResultIndex + 6
|
||||||
|
|
||||||
|
val moveResultRegister = (actionOpenShortsInstructions[moveResultIndex] as OneRegisterInstruction).registerA
|
||||||
|
val iPutBooleanRegister = (actionOpenShortsInstructions[iPutBooleanIndex] as TwoRegisterInstruction).registerA
|
||||||
|
|
||||||
|
actionOpenShortsMethod.addInstructions(
|
||||||
|
moveResultIndex + 1, """
|
||||||
|
invoke-static { }, Lapp/revanced/integrations/patches/DisableStartupShortsPlayerPatch;->disableStartupShortsPlayer()Z
|
||||||
|
move-result v$moveResultRegister
|
||||||
|
if-nez v$moveResultRegister, :cond_startup_shorts_reset
|
||||||
|
const/4 v$iPutBooleanRegister, 0x0
|
||||||
|
:cond_startup_shorts_reset
|
||||||
|
nop
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user