Compare commits

...

22 Commits

Author SHA1 Message Date
semantic-release-bot
148900f47d chore(release): 2.187.0-dev.3 [skip ci]
# [2.187.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v2.187.0-dev.2...v2.187.0-dev.3) (2023-07-26)

### Bug Fixes

* **YouTube - Spoof App Version:** Remove 17.30.35 target (version no longer works correctly) ([#2703](https://github.com/ReVanced/revanced-patches/issues/2703)) ([936ac47](936ac475d2))
2023-07-26 21:19:08 +00:00
LisoUseInAIKyrios
936ac475d2 fix(YouTube - Spoof App Version): Remove 17.30.35 target (version no longer works correctly) (#2703) 2023-07-27 01:15:58 +04:00
semantic-release-bot
df57b1acdd chore(release): 2.187.0-dev.2 [skip ci]
# [2.187.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v2.187.0-dev.1...v2.187.0-dev.2) (2023-07-26)

### Features

* **YouTube - Hide layout components:** Hide `chips shelf` ([#2699](https://github.com/ReVanced/revanced-patches/issues/2699)) ([44107c2](44107c2b07))
2023-07-26 13:50:42 +00:00
johnconner122
44107c2b07 feat(YouTube - Hide layout components): Hide chips shelf (#2699) 2023-07-26 15:48:04 +02:00
semantic-release-bot
4680f1dc61 chore(release): 2.187.0-dev.1 [skip ci]
# [2.187.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v2.186.1-dev.1...v2.187.0-dev.1) (2023-07-24)

### Features

* **Sync for Reddit:** add `Disable Sync for Lemmy bottom sheet` patch ([70da6d8](70da6d8971))
2023-07-24 23:41:28 +00:00
oSumAtrIX
70da6d8971 feat(Sync for Reddit): add Disable Sync for Lemmy bottom sheet patch 2023-07-25 01:36:28 +02:00
semantic-release-bot
1df7df2841 chore(release): 2.186.1-dev.1 [skip ci]
## [2.186.1-dev.1](https://github.com/ReVanced/revanced-patches/compare/v2.186.0...v2.186.1-dev.1) (2023-07-21)

### Bug Fixes

* **YouTube - Theme:** only set splash screen color if background colors are set ([c14a7fb](c14a7fb66f))
2023-07-21 22:11:35 +00:00
oSumAtrIX
c14a7fb66f fix(YouTube - Theme): only set splash screen color if background colors are set 2023-07-22 00:08:25 +02:00
oSumAtrIX
6af4e47947 ci: clean after building 2023-07-21 19:17:06 +02:00
semantic-release-bot
ef704fcf7a chore(release): 2.186.0 [skip ci]
# [2.186.0](https://github.com/ReVanced/revanced-patches/compare/v2.185.0...v2.186.0) (2023-07-21)

### Bug Fixes

* **Tiktok - Settings:** get instruction registers dynamically ([#2676](https://github.com/ReVanced/revanced-patches/issues/2676)) ([b3ff7ef](b3ff7efdb2))
* **YouTube - Spoof app version:** update target app version description ([#2666](https://github.com/ReVanced/revanced-patches/issues/2666)) ([ae990ea](ae990eac6a))
* **YouTube - Theme:** allow setting no background color ([82e3ebe](82e3ebeeff))
* **YouTube - Theme:** apply custom seekbar color to shorts ([#2670](https://github.com/ReVanced/revanced-patches/issues/2670)) ([a19fa4e](a19fa4e087))

### Features

* **Twitter:** remove `Hide view stats` patch ([4e1c9b9](4e1c9b9ec2))
* **Youtube - Theme:** add a switch to enable/disable custom seekbar color ([#2663](https://github.com/ReVanced/revanced-patches/issues/2663)) ([dd7c663](dd7c663df6))
2023-07-21 15:08:14 +00:00
oSumAtrIX
eefa677b1a chore: merge branch dev to main (#2674) 2023-07-21 17:04:32 +02:00
oSumAtrIX
2bf6d693ec ci: do not cache build directory 2023-07-21 16:57:20 +02:00
semantic-release-bot
acc55fff89 chore(release): 2.186.0-dev.5 [skip ci]
# [2.186.0-dev.5](https://github.com/ReVanced/revanced-patches/compare/v2.186.0-dev.4...v2.186.0-dev.5) (2023-07-20)

### Bug Fixes

* **YouTube - Theme:** allow setting no background color ([82e3ebe](82e3ebeeff))
2023-07-20 22:13:30 +00:00
oSumAtrIX
82e3ebeeff fix(YouTube - Theme): allow setting no background color 2023-07-21 00:10:48 +02:00
semantic-release-bot
47d096399a chore(release): 2.186.0-dev.4 [skip ci]
# [2.186.0-dev.4](https://github.com/ReVanced/revanced-patches/compare/v2.186.0-dev.3...v2.186.0-dev.4) (2023-07-20)

### Bug Fixes

* **YouTube - Spoof app version:** update target app version description ([#2666](https://github.com/ReVanced/revanced-patches/issues/2666)) ([ae990ea](ae990eac6a))
2023-07-20 20:37:36 +00:00
LisoUseInAIKyrios
ae990eac6a fix(YouTube - Spoof app version): update target app version description (#2666) 2023-07-21 00:34:17 +04:00
LisoUseInAIKyrios
b7f40c3955 chore: delete empty file 2023-07-20 23:09:44 +04:00
semantic-release-bot
807a7b01d3 chore(release): 2.186.0-dev.3 [skip ci]
# [2.186.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v2.186.0-dev.2...v2.186.0-dev.3) (2023-07-20)

### Bug Fixes

* **Tiktok - Settings:** get instruction registers dynamically ([#2676](https://github.com/ReVanced/revanced-patches/issues/2676)) ([b3ff7ef](b3ff7efdb2))
2023-07-20 17:39:14 +00:00
Vu Hoan Huy
b3ff7efdb2 fix(Tiktok - Settings): get instruction registers dynamically (#2676) 2023-07-20 19:36:41 +02:00
semantic-release-bot
098162173f chore(release): 2.186.0-dev.2 [skip ci]
# [2.186.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v2.186.0-dev.1...v2.186.0-dev.2) (2023-07-20)

### Bug Fixes

* **YouTube - Theme:** apply custom seekbar color to shorts ([#2670](https://github.com/ReVanced/revanced-patches/issues/2670)) ([a19fa4e](a19fa4e087))

### Features

* **Youtube - Theme:** add a switch to enable/disable custom seekbar color ([#2663](https://github.com/ReVanced/revanced-patches/issues/2663)) ([dd7c663](dd7c663df6))
2023-07-20 17:31:06 +00:00
LisoUseInAIKyrios
a19fa4e087 fix(YouTube - Theme): apply custom seekbar color to shorts (#2670) 2023-07-20 21:28:22 +04:00
LisoUseInAIKyrios
dd7c663df6 feat(Youtube - Theme): add a switch to enable/disable custom seekbar color (#2663) 2023-07-20 21:27:44 +04:00
15 changed files with 234 additions and 77 deletions

View File

@@ -30,13 +30,12 @@ jobs:
${{ runner.home }}/.gradle/caches ${{ runner.home }}/.gradle/caches
${{ runner.home }}/.gradle/wrapper ${{ runner.home }}/.gradle/wrapper
.gradle .gradle
build
node_modules node_modules
key: ${{ runner.os }}-gradle-npm-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'package-lock.json') }} key: ${{ runner.os }}-gradle-npm-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'package-lock.json') }}
- name: Build with Gradle - name: Build with Gradle
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew generateMeta clean --no-daemon run: ./gradlew generateMeta clean
- name: Setup semantic-release - name: Setup semantic-release
run: npm install run: npm install
- name: Release - name: Release

View File

@@ -1,3 +1,80 @@
# [2.187.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v2.187.0-dev.2...v2.187.0-dev.3) (2023-07-26)
### Bug Fixes
* **YouTube - Spoof App Version:** Remove 17.30.35 target (version no longer works correctly) ([#2703](https://github.com/ReVanced/revanced-patches/issues/2703)) ([210108b](https://github.com/ReVanced/revanced-patches/commit/210108bd8f86f583f5cd5d5538480b76d51d7776))
# [2.187.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v2.187.0-dev.1...v2.187.0-dev.2) (2023-07-26)
### Features
* **YouTube - Hide layout components:** Hide `chips shelf` ([#2699](https://github.com/ReVanced/revanced-patches/issues/2699)) ([8e6058b](https://github.com/ReVanced/revanced-patches/commit/8e6058b62350b3d14d79e6fe52b0ad781b66b5de))
# [2.187.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v2.186.1-dev.1...v2.187.0-dev.1) (2023-07-24)
### Features
* **Sync for Reddit:** add `Disable Sync for Lemmy bottom sheet` patch ([56b535b](https://github.com/ReVanced/revanced-patches/commit/56b535b2a136d4b0afbddf2c8e251889c2555056))
## [2.186.1-dev.1](https://github.com/ReVanced/revanced-patches/compare/v2.186.0...v2.186.1-dev.1) (2023-07-21)
### Bug Fixes
* **YouTube - Theme:** only set splash screen color if background colors are set ([f058db4](https://github.com/ReVanced/revanced-patches/commit/f058db4ba4300400ac92b4a9790708eb8bde7092))
# [2.186.0](https://github.com/ReVanced/revanced-patches/compare/v2.185.0...v2.186.0) (2023-07-21)
### Bug Fixes
* **Tiktok - Settings:** get instruction registers dynamically ([#2676](https://github.com/ReVanced/revanced-patches/issues/2676)) ([b34e45b](https://github.com/ReVanced/revanced-patches/commit/b34e45b6dafad8e9d567ad65f58a182b8cc04676))
* **YouTube - Spoof app version:** update target app version description ([#2666](https://github.com/ReVanced/revanced-patches/issues/2666)) ([307442e](https://github.com/ReVanced/revanced-patches/commit/307442e654ff5486656319d91e4a5f5fb2b92651))
* **YouTube - Theme:** allow setting no background color ([8a4e77a](https://github.com/ReVanced/revanced-patches/commit/8a4e77a290a61a1caf93eb8bccaf728c84a3ef53))
* **YouTube - Theme:** apply custom seekbar color to shorts ([#2670](https://github.com/ReVanced/revanced-patches/issues/2670)) ([1f6fe3d](https://github.com/ReVanced/revanced-patches/commit/1f6fe3da4284fd768057ef068c7ddf88d3a11049))
### Features
* **Twitter:** remove `Hide view stats` patch ([f0d3800](https://github.com/ReVanced/revanced-patches/commit/f0d38001b34db63f212209afb91eebf59dad2b24))
* **Youtube - Theme:** add a switch to enable/disable custom seekbar color ([#2663](https://github.com/ReVanced/revanced-patches/issues/2663)) ([5c39985](https://github.com/ReVanced/revanced-patches/commit/5c39985888cdfe3acfdd8811ff9b6f80e243704e))
# [2.186.0-dev.5](https://github.com/ReVanced/revanced-patches/compare/v2.186.0-dev.4...v2.186.0-dev.5) (2023-07-20)
### Bug Fixes
* **YouTube - Theme:** allow setting no background color ([8a4e77a](https://github.com/ReVanced/revanced-patches/commit/8a4e77a290a61a1caf93eb8bccaf728c84a3ef53))
# [2.186.0-dev.4](https://github.com/ReVanced/revanced-patches/compare/v2.186.0-dev.3...v2.186.0-dev.4) (2023-07-20)
### Bug Fixes
* **YouTube - Spoof app version:** update target app version description ([#2666](https://github.com/ReVanced/revanced-patches/issues/2666)) ([307442e](https://github.com/ReVanced/revanced-patches/commit/307442e654ff5486656319d91e4a5f5fb2b92651))
# [2.186.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v2.186.0-dev.2...v2.186.0-dev.3) (2023-07-20)
### Bug Fixes
* **Tiktok - Settings:** get instruction registers dynamically ([#2676](https://github.com/ReVanced/revanced-patches/issues/2676)) ([b34e45b](https://github.com/ReVanced/revanced-patches/commit/b34e45b6dafad8e9d567ad65f58a182b8cc04676))
# [2.186.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v2.186.0-dev.1...v2.186.0-dev.2) (2023-07-20)
### Bug Fixes
* **YouTube - Theme:** apply custom seekbar color to shorts ([#2670](https://github.com/ReVanced/revanced-patches/issues/2670)) ([1f6fe3d](https://github.com/ReVanced/revanced-patches/commit/1f6fe3da4284fd768057ef068c7ddf88d3a11049))
### Features
* **Youtube - Theme:** add a switch to enable/disable custom seekbar color ([#2663](https://github.com/ReVanced/revanced-patches/issues/2663)) ([5c39985](https://github.com/ReVanced/revanced-patches/commit/5c39985888cdfe3acfdd8811ff9b6f80e243704e))
# [2.186.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v2.185.0...v2.186.0-dev.1) (2023-07-20) # [2.186.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v2.185.0...v2.186.0-dev.1) (2023-07-20)

View 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.186.0-dev.1 version = 2.187.0-dev.3

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,9 @@
package app.revanced.patches.reddit.customclients.syncforreddit.annoyances.startup.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object MainActivityOnCreate : MethodFingerprint(
customFingerprint = custom@{ method, classDef ->
classDef.type.endsWith("MainActivity;") && method.name == "onCreate"
}
)

View File

@@ -0,0 +1,35 @@
package app.revanced.patches.reddit.customclients.syncforreddit.annoyances.startup.patch
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Package
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.reddit.customclients.syncforreddit.annoyances.startup.fingerprints.MainActivityOnCreate
@Patch
@Name("Disable Sync for Lemmy bottom sheet")
@Description("Disables the bottom sheet at the startup that asks you to signup to \"Sync for Lemmy\".")
@Compatibility(
[
Package("com.laurencedawson.reddit_sync", ["v23.06.30-13:39"]),
Package("com.laurencedawson.reddit_sync.pro"), // Version unknown.
Package("com.laurencedawson.reddit_sync.dev") // Version unknown.
]
)
class DisableSyncForLemmyBottomSheetPatch : BytecodePatch(listOf(MainActivityOnCreate)) {
override fun execute(context: BytecodeContext): PatchResult {
MainActivityOnCreate.result?.mutableMethod?.apply {
val showBottomSheetIndex = implementation!!.instructions.lastIndex - 1
removeInstruction(showBottomSheetIndex)
}
return PatchResultSuccess()
}
}

View File

@@ -18,7 +18,8 @@ import app.revanced.patches.tiktok.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.tiktok.misc.settings.annotations.SettingsCompatibility import app.revanced.patches.tiktok.misc.settings.annotations.SettingsCompatibility
import app.revanced.patches.tiktok.misc.settings.fingerprints.* import app.revanced.patches.tiktok.misc.settings.fingerprints.*
import org.jf.dexlib2.Opcode import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
import org.jf.dexlib2.iface.instruction.formats.Instruction35c
@Patch @Patch
@DependsOn([IntegrationsPatch::class]) @DependsOn([IntegrationsPatch::class])
@@ -45,7 +46,9 @@ class SettingsPatch : BytecodePatch(
AddSettingsEntryFingerprint.result?.apply { AddSettingsEntryFingerprint.result?.apply {
scanResult.patternScanResult?.startIndex?.let { scanResult.patternScanResult?.startIndex?.let {
val settingsEntries = mutableMethod.getInstruction(it + 3) val settingsEntries = mutableMethod.getInstruction(it + 3)
val addEntry = mutableMethod.getInstruction(it + 5) val addEntry = mutableMethod.getInstruction<BuilderInstruction35c>(it + 5)
val register1 = addEntry.registerC
val register2 = addEntry.registerD
// Add the settings entry created to the settings fragment // Add the settings entry created to the settings fragment
mutableMethod.addInstructions( mutableMethod.addInstructions(
it + 6, it + 6,
@@ -58,10 +61,10 @@ class SettingsPatch : BytecodePatch(
mutableMethod.addInstructions( mutableMethod.addInstructions(
it + 6, it + 6,
""" """
const-string v1, "$settingsButtonClass" const-string v$register1, "$settingsButtonClass"
const-string v2, "$settingsButtonInfoClass" const-string v$register2, "$settingsButtonInfoClass"
invoke-static {v1, v2}, $CREATE_SETTINGS_ENTRY_METHOD_DESCRIPTOR invoke-static {v$register1, v$register2}, $CREATE_SETTINGS_ENTRY_METHOD_DESCRIPTOR
move-result-object v1 move-result-object v$register2
""" """
) )
} }
@@ -73,14 +76,15 @@ class SettingsPatch : BytecodePatch(
it.opcode == Opcode.INVOKE_SUPER it.opcode == Opcode.INVOKE_SUPER
} + 1 } + 1
val thisRegister = getInstruction<FiveRegisterInstruction>(initializeSettingsIndex - 1).registerC val thisRegister = getInstruction<Instruction35c>(initializeSettingsIndex - 1).registerC
val usableRegister = implementation!!.registerCount - parameters.size - 2
addInstructionsWithLabels( addInstructionsWithLabels(
initializeSettingsIndex, initializeSettingsIndex,
""" """
invoke-static {v$thisRegister}, $INITIALIZE_SETTINGS_METHOD_DESCRIPTOR invoke-static {v$thisRegister}, $INITIALIZE_SETTINGS_METHOD_DESCRIPTOR
move-result v0 move-result v$usableRegister
if-eqz v0, :notrevanced if-eqz v$usableRegister, :notrevanced
return-void return-void
""", """,
ExternalLabel("notrevanced", getInstruction(initializeSettingsIndex)) ExternalLabel("notrevanced", getInstruction(initializeSettingsIndex))

View File

@@ -211,6 +211,12 @@ class HideLayoutComponentsPatch : BytecodePatch(
StringResource("revanced_hide_artist_cards_on", "Artist cards is hidden"), StringResource("revanced_hide_artist_cards_on", "Artist cards is hidden"),
StringResource("revanced_hide_artist_cards_off", "Artist cards is shown") StringResource("revanced_hide_artist_cards_off", "Artist cards is shown")
), ),
SwitchPreference(
"revanced_hide_chips_shelf",
StringResource("revanced_hide_chips_shelf_title", "Hide chips shelf"),
StringResource("revanced_hide_chips_shelf_on", "Chips shelf is hidden"),
StringResource("revanced_hide_chips_shelf_off", "Chips shelf is shown")
),
app.revanced.patches.shared.settings.preference.impl.PreferenceScreen( app.revanced.patches.shared.settings.preference.impl.PreferenceScreen(
"revanced_custom_filter_preference_screen", "revanced_custom_filter_preference_screen",
StringResource("revanced_custom_filter_preference_screen_title", "Custom filter"), StringResource("revanced_custom_filter_preference_screen_title", "Custom filter"),

View File

@@ -6,7 +6,7 @@ import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.seekbar.resource.SeekbarColorResourcePatch import app.revanced.patches.youtube.layout.seekbar.resource.SeekbarColorResourcePatch
import org.jf.dexlib2.AccessFlags import org.jf.dexlib2.AccessFlags
object CreateDarkThemeSeekbarFingerprint : MethodFingerprint( object PlayerSeekbarColorFingerprint : MethodFingerprint(
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
customFingerprint = { method, _ -> customFingerprint = { method, _ ->
method.containsConstantInstructionValue(SeekbarColorResourcePatch.inlineTimeBarColorizedBarPlayedColorDarkId) method.containsConstantInstructionValue(SeekbarColorResourcePatch.inlineTimeBarColorizedBarPlayedColorDarkId)

View File

@@ -0,0 +1,11 @@
package app.revanced.patches.youtube.layout.seekbar.bytecode.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patches.youtube.layout.seekbar.resource.SeekbarColorResourcePatch
import app.revanced.util.patch.LiteralValueFingerprint
import org.jf.dexlib2.AccessFlags
object ShortsSeekbarColorFingerprint : LiteralValueFingerprint(
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
literal = SeekbarColorResourcePatch.reelTimeBarPlayedColorId,
)

View File

@@ -14,8 +14,9 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.youtube.layout.seekbar.annotations.SeekbarColorCompatibility import app.revanced.patches.youtube.layout.seekbar.annotations.SeekbarColorCompatibility
import app.revanced.patches.youtube.layout.seekbar.bytecode.fingerprints.CreateDarkThemeSeekbarFingerprint import app.revanced.patches.youtube.layout.seekbar.bytecode.fingerprints.PlayerSeekbarColorFingerprint
import app.revanced.patches.youtube.layout.seekbar.bytecode.fingerprints.SetSeekbarClickedColorFingerprint import app.revanced.patches.youtube.layout.seekbar.bytecode.fingerprints.SetSeekbarClickedColorFingerprint
import app.revanced.patches.youtube.layout.seekbar.bytecode.fingerprints.ShortsSeekbarColorFingerprint
import app.revanced.patches.youtube.layout.seekbar.resource.SeekbarColorResourcePatch import app.revanced.patches.youtube.layout.seekbar.resource.SeekbarColorResourcePatch
import app.revanced.patches.youtube.layout.theme.bytecode.patch.LithoColorHookPatch import app.revanced.patches.youtube.layout.theme.bytecode.patch.LithoColorHookPatch
import app.revanced.patches.youtube.layout.theme.bytecode.patch.LithoColorHookPatch.Companion.lithoColorOverrideHook import app.revanced.patches.youtube.layout.theme.bytecode.patch.LithoColorHookPatch.Companion.lithoColorOverrideHook
@@ -28,30 +29,29 @@ import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
@SeekbarColorCompatibility @SeekbarColorCompatibility
@Version("0.0.1") @Version("0.0.1")
class SeekbarColorBytecodePatch : BytecodePatch( class SeekbarColorBytecodePatch : BytecodePatch(
listOf(CreateDarkThemeSeekbarFingerprint, SetSeekbarClickedColorFingerprint) listOf(PlayerSeekbarColorFingerprint, ShortsSeekbarColorFingerprint, SetSeekbarClickedColorFingerprint)
) { ) {
override fun execute(context: BytecodeContext): PatchResult { override fun execute(context: BytecodeContext): PatchResult {
CreateDarkThemeSeekbarFingerprint.result?.mutableMethod?.apply { fun MutableMethod.addColorChangeInstructions(resourceId: Long) {
var registerIndex = indexOfFirstConstantInstructionValue(SeekbarColorResourcePatch.inlineTimeBarColorizedBarPlayedColorDarkId) + 2 var registerIndex = indexOfFirstConstantInstructionValue(resourceId) + 2
var colorRegister = (getInstruction(registerIndex) as OneRegisterInstruction).registerA var colorRegister = getInstruction<OneRegisterInstruction>(registerIndex).registerA
addInstructions( addInstructions(
registerIndex + 1, registerIndex + 1,
""" """
invoke-static { v$colorRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->getVideoPlayerSeekbarColor(I)I invoke-static { v$colorRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->getVideoPlayerSeekbarColor(I)I
move-result v$colorRegister move-result v$colorRegister
""" """
) )
}
registerIndex = indexOfFirstConstantInstructionValue(SeekbarColorResourcePatch.inlineTimeBarPlayedNotHighlightedColorId) + 2
colorRegister = (getInstruction(registerIndex) as OneRegisterInstruction).registerA PlayerSeekbarColorFingerprint.result?.mutableMethod?.apply {
addInstructions( addColorChangeInstructions(SeekbarColorResourcePatch.inlineTimeBarColorizedBarPlayedColorDarkId)
registerIndex + 1, addColorChangeInstructions(SeekbarColorResourcePatch.inlineTimeBarPlayedNotHighlightedColorId)
""" } ?: return PlayerSeekbarColorFingerprint.toErrorResult()
invoke-static { v$colorRegister }, $INTEGRATIONS_CLASS_DESCRIPTOR->getVideoPlayerSeekbarColor(I)I
move-result v$colorRegister ShortsSeekbarColorFingerprint.result?.mutableMethod?.apply {
""" addColorChangeInstructions(SeekbarColorResourcePatch.reelTimeBarPlayedColorId)
) } ?: return ShortsSeekbarColorFingerprint.toErrorResult()
} ?: return CreateDarkThemeSeekbarFingerprint.toErrorResult()
SetSeekbarClickedColorFingerprint.result?.let { result -> SetSeekbarClickedColorFingerprint.result?.let { result ->
result.mutableMethod.let { result.mutableMethod.let {
@@ -62,7 +62,7 @@ class SeekbarColorBytecodePatch : BytecodePatch(
.getMethod() as MutableMethod .getMethod() as MutableMethod
method.apply { method.apply {
val colorRegister = (method.getInstruction(0) as TwoRegisterInstruction).registerA val colorRegister = getInstruction<TwoRegisterInstruction>(0).registerA
addInstructions( addInstructions(
0, 0,
""" """

View File

@@ -9,17 +9,20 @@ import org.w3c.dom.Element
@DependsOn([SettingsPatch::class, ResourceMappingPatch::class]) @DependsOn([SettingsPatch::class, ResourceMappingPatch::class])
class SeekbarColorResourcePatch : ResourcePatch { class SeekbarColorResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
// Edit theme colors via bytecode.
// For that the resource id is used in a bytecode patch to change the color.
val seekbarErrorMessage = "Could not find seekbar resource" override fun execute(context: ResourceContext): PatchResult {
inlineTimeBarColorizedBarPlayedColorDarkId = ResourceMappingPatch.resourceMappings fun findColorResource(resourceName: String): Long {
.find { it.name == "inline_time_bar_colorized_bar_played_color_dark" }?.id return ResourceMappingPatch.resourceMappings
?: return PatchResultError(seekbarErrorMessage) .find { it.type == "color" && it.name == resourceName }?.id
inlineTimeBarPlayedNotHighlightedColorId = ResourceMappingPatch.resourceMappings ?: throw PatchResultError("Could not find color resource: $resourceName")
.find { it.name == "inline_time_bar_played_not_highlighted_color" }?.id }
?: return PatchResultError(seekbarErrorMessage)
reelTimeBarPlayedColorId =
findColorResource("reel_time_bar_played_color")
inlineTimeBarColorizedBarPlayedColorDarkId =
findColorResource("inline_time_bar_colorized_bar_played_color_dark")
inlineTimeBarPlayedNotHighlightedColorId =
findColorResource("inline_time_bar_played_not_highlighted_color")
// Edit the resume playback drawable and replace the progress bar with a custom drawable // Edit the resume playback drawable and replace the progress bar with a custom drawable
context.xmlEditor["res/drawable/resume_playback_progressbar_drawable.xml"].use { editor -> context.xmlEditor["res/drawable/resume_playback_progressbar_drawable.xml"].use { editor ->
@@ -39,6 +42,7 @@ class SeekbarColorResourcePatch : ResourcePatch {
} }
companion object { companion object {
internal var reelTimeBarPlayedColorId = -1L
internal var inlineTimeBarColorizedBarPlayedColorDarkId = -1L internal var inlineTimeBarColorizedBarPlayedColorDarkId = -1L
internal var inlineTimeBarPlayedNotHighlightedColorId = -1L internal var inlineTimeBarPlayedNotHighlightedColorId = -1L
} }

View File

@@ -42,7 +42,7 @@ class SpoofAppVersionPatch : BytecodePatch(
StringResource("revanced_spoof_app_version_user_dialog_message", StringResource("revanced_spoof_app_version_user_dialog_message",
"App version will be spoofed to an older version of YouTube." "App version will be spoofed to an older version of YouTube."
+ "\\n\\nThis will change the appearance and features of the app, but unknown side effects may occur." + "\\n\\nThis will change the appearance and features of the app, but unknown side effects may occur."
+ "\\n\\nIf later turned off, the old UI may remain until you log out or clear the app data.") + "\\n\\nIf later turned off, the old UI may remain until the app data is cleared.")
), ),
ListPreference( ListPreference(
"revanced_spoof_app_version_target", "revanced_spoof_app_version_target",
@@ -53,19 +53,17 @@ class SpoofAppVersionPatch : BytecodePatch(
ArrayResource( ArrayResource(
"revanced_spoof_app_version_target_entries", "revanced_spoof_app_version_target_entries",
listOf( listOf(
StringResource("revanced_spoof_app_version_target_entry_1", "17.30.35 - Restore old UI layout"), StringResource("revanced_spoof_app_version_target_entry_1", "17.01.35 - Restore old UI layout"),
StringResource("revanced_spoof_app_version_target_entry_2", "17.01.35 - Enable sorting videos by oldest"), StringResource("revanced_spoof_app_version_target_entry_2", "16.08.35 - Restore explore tab"),
StringResource("revanced_spoof_app_version_target_entry_3", "16.08.35 - Restore explore tab"), StringResource("revanced_spoof_app_version_target_entry_3", "16.01.35 - Restore old Shorts player"),
StringResource("revanced_spoof_app_version_target_entry_4", "16.01.35 - Restore old Shorts player"),
) )
), ),
ArrayResource( ArrayResource(
"revanced_spoof_app_version_target_entry_values", "revanced_spoof_app_version_target_entry_values",
listOf( listOf(
StringResource("revanced_spoof_app_version_target_entry_value_1", "17.30.35"), StringResource("revanced_spoof_app_version_target_entry_value_1", "17.01.35"),
StringResource("revanced_spoof_app_version_target_entry_value_2", "17.01.35"), StringResource("revanced_spoof_app_version_target_entry_value_2", "16.08.35"),
StringResource("revanced_spoof_app_version_target_entry_value_3", "16.08.35"), StringResource("revanced_spoof_app_version_target_entry_value_3", "16.01.35"),
StringResource("revanced_spoof_app_version_target_entry_value_4", "16.01.35"),
) )
) )
) )

View File

@@ -9,6 +9,7 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
import app.revanced.patches.shared.settings.preference.impl.InputType import app.revanced.patches.shared.settings.preference.impl.InputType
import app.revanced.patches.shared.settings.preference.impl.StringResource import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.shared.settings.preference.impl.TextPreference import app.revanced.patches.shared.settings.preference.impl.TextPreference
import app.revanced.patches.youtube.layout.seekbar.resource.SeekbarPreferencesPatch import app.revanced.patches.youtube.layout.seekbar.resource.SeekbarPreferencesPatch
import app.revanced.patches.youtube.layout.theme.bytecode.patch.ThemeBytecodePatch.Companion.darkThemeBackgroundColor import app.revanced.patches.youtube.layout.theme.bytecode.patch.ThemeBytecodePatch.Companion.darkThemeBackgroundColor
@@ -20,10 +21,16 @@ import org.w3c.dom.Element
class ThemeResourcePatch : ResourcePatch { class ThemeResourcePatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult { override fun execute(context: ResourceContext): PatchResult {
SeekbarPreferencesPatch.addPreferences( SeekbarPreferencesPatch.addPreferences(
SwitchPreference(
"revanced_seekbar_custom_color",
StringResource("revanced_seekbar_custom_color_title", "Enable custom seekbar color"),
StringResource("revanced_seekbar_custom_color_summary_on", "Custom seekbar color is shown"),
StringResource("revanced_seekbar_custom_color_summary_off", "Original seekbar color is shown")
),
TextPreference( TextPreference(
"revanced_seekbar_color", "revanced_seekbar_custom_color_value",
StringResource("revanced_seekbar_color_title", "Seekbar color"), StringResource("revanced_seekbar_custom_color_value_title", "Custom seekbar color"),
StringResource("revanced_seekbar_color_summary", "The color of the seekbar"), StringResource("revanced_seekbar_custom_color_value_summary", "The color of the seekbar"),
InputType.TEXT_CAP_CHARACTERS InputType.TEXT_CAP_CHARACTERS
) )
) )
@@ -38,8 +45,8 @@ class ThemeResourcePatch : ResourcePatch {
node.textContent = when (node.getAttribute("name")) { node.textContent = when (node.getAttribute("name")) {
"yt_black0", "yt_black1", "yt_black1_opacity95", "yt_black1_opacity98", "yt_black2", "yt_black3", "yt_black0", "yt_black1", "yt_black1_opacity95", "yt_black1_opacity98", "yt_black2", "yt_black3",
"yt_black4", "yt_status_bar_background_dark", "material_grey_850" -> darkThemeBackgroundColor "yt_black4", "yt_status_bar_background_dark", "material_grey_850"
?: continue -> darkThemeBackgroundColor ?: continue
"yt_white1", "yt_white1_opacity95", "yt_white1_opacity98", "yt_white1", "yt_white1_opacity95", "yt_white1_opacity98",
"yt_white2", "yt_white3", "yt_white4", "yt_white2", "yt_white3", "yt_white4",
@@ -51,36 +58,43 @@ class ThemeResourcePatch : ResourcePatch {
} }
// Add a dynamic background color to the colors.xml file. // Add a dynamic background color to the colors.xml file.
addResourceColor(context, "res/values/colors.xml", lightThemeBackgroundColor?.let {
SPLASH_BACKGROUND_COLOR, lightThemeBackgroundColor!!) addColorResource(context, "res/values/colors.xml", SPLASH_BACKGROUND_COLOR, it)
addResourceColor(context, "res/values-night/colors.xml", }
SPLASH_BACKGROUND_COLOR, darkThemeBackgroundColor!!)
// Edit splash screen files and change the background color. darkThemeBackgroundColor?.let {
val splashScreenResourceFiles = listOf( addColorResource(context, "res/values-night/colors.xml", SPLASH_BACKGROUND_COLOR, it)
"res/drawable/quantum_launchscreen_youtube.xml", }
"res/drawable-sw600dp/quantum_launchscreen_youtube.xml")
splashScreenResourceFiles.forEach editSplashScreen@ { resourceFile -> // Edit splash screen files and change the background color,
context.xmlEditor[resourceFile].use { // if the background colors are set.
val layerList = it.file.getElementsByTagName("layer-list").item(0) as Element if (darkThemeBackgroundColor != null && lightThemeBackgroundColor != null) {
val splashScreenResourceFiles = listOf(
"res/drawable/quantum_launchscreen_youtube.xml",
"res/drawable-sw600dp/quantum_launchscreen_youtube.xml")
val childNodes = layerList.childNodes splashScreenResourceFiles.forEach editSplashScreen@ { resourceFile ->
for (i in 0 until childNodes.length) { context.xmlEditor[resourceFile].use {
val node = childNodes.item(i) val layerList = it.file.getElementsByTagName("layer-list").item(0) as Element
if (node is Element && node.hasAttribute("android:drawable")) {
node.setAttribute("android:drawable", "@color/$SPLASH_BACKGROUND_COLOR") val childNodes = layerList.childNodes
return@editSplashScreen for (i in 0 until childNodes.length) {
val node = childNodes.item(i)
if (node is Element && node.hasAttribute("android:drawable")) {
node.setAttribute("android:drawable", "@color/$SPLASH_BACKGROUND_COLOR")
return@editSplashScreen
}
} }
return PatchResultError("Failed to modify launch screen")
} }
return PatchResultError("Failed to modify launch screen")
} }
} }
return PatchResultSuccess() return PatchResultSuccess()
} }
private fun addResourceColor( private fun addColorResource(
context: ResourceContext, context: ResourceContext,
resourceFile: String, resourceFile: String,
colorName: String, colorName: String,