Compare commits

..

8 Commits

Author SHA1 Message Date
semantic-release-bot
c1d6aa3e49 chore(release): 2.85.2 [skip ci]
## [2.85.2](https://github.com/revanced/revanced-patches/compare/v2.85.1...v2.85.2) (2022-10-22)

### Bug Fixes

* **youtube/integrations:** set context for remaining activities ([#828](https://github.com/revanced/revanced-patches/issues/828)) ([ba515d2](c097370960))
2022-10-22 10:46:54 +00:00
Canny
c097370960 fix(youtube/integrations): set context for remaining activities (#828) 2022-10-22 12:45:10 +02:00
semantic-release-bot
8ffa3b4746 chore(release): 2.85.1 [skip ci]
## [2.85.1](https://github.com/revanced/revanced-patches/compare/v2.85.0...v2.85.1) (2022-10-21)

### Bug Fixes

* **youtube/theme:** extend dark mode theming ([#827](https://github.com/revanced/revanced-patches/issues/827)) ([1e26d6a](1e6d0f7f62))
2022-10-21 13:16:26 +00:00
OxrxL
1e6d0f7f62 fix(youtube/theme): extend dark mode theming (#827) 2022-10-21 15:14:24 +02:00
semantic-release-bot
e73c5dfebd chore(release): 2.85.0 [skip ci]
# [2.85.0](https://github.com/revanced/revanced-patches/compare/v2.84.1...v2.85.0) (2022-10-20)

### Features

* **youtube:** `hide-captions-button` patch ([#770](https://github.com/revanced/revanced-patches/issues/770)) ([a13fdbd](32309ac007))
2022-10-20 20:07:51 +00:00
OxrxL
32309ac007 feat(youtube): hide-captions-button patch (#770)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-10-20 22:05:34 +02:00
semantic-release-bot
079800aa1a chore(release): 2.84.1 [skip ci]
## [2.84.1](https://github.com/revanced/revanced-patches/compare/v2.84.0...v2.84.1) (2022-10-20)

### Bug Fixes

* **youtube/hide-mix-playlists:** correct switch title, summary and defaults ([#821](https://github.com/revanced/revanced-patches/issues/821)) ([c37b8cd](06f0d05d19))
2022-10-20 18:31:56 +00:00
johnconner122
06f0d05d19 fix(youtube/hide-mix-playlists): correct switch title, summary and defaults (#821) 2022-10-20 20:29:41 +02:00
11 changed files with 147 additions and 38 deletions

View File

@@ -1,3 +1,31 @@
## [2.85.2](https://github.com/revanced/revanced-patches/compare/v2.85.1...v2.85.2) (2022-10-22)
### Bug Fixes
* **youtube/integrations:** set context for remaining activities ([#828](https://github.com/revanced/revanced-patches/issues/828)) ([b2b6a3d](https://github.com/revanced/revanced-patches/commit/b2b6a3d1492bc2d5a6e27c68c74e3904764dda4b))
## [2.85.1](https://github.com/revanced/revanced-patches/compare/v2.85.0...v2.85.1) (2022-10-21)
### Bug Fixes
* **youtube/theme:** extend dark mode theming ([#827](https://github.com/revanced/revanced-patches/issues/827)) ([6d803c5](https://github.com/revanced/revanced-patches/commit/6d803c5386e1f6f6fb6a7fa0a9f0bb81ee1022ac))
# [2.85.0](https://github.com/revanced/revanced-patches/compare/v2.84.1...v2.85.0) (2022-10-20)
### Features
* **youtube:** `hide-captions-button` patch ([#770](https://github.com/revanced/revanced-patches/issues/770)) ([478af6a](https://github.com/revanced/revanced-patches/commit/478af6ad54ffdf6f99abab35a84a4f50b59d28c8))
## [2.84.1](https://github.com/revanced/revanced-patches/compare/v2.84.0...v2.84.1) (2022-10-20)
### Bug Fixes
* **youtube/hide-mix-playlists:** correct switch title, summary and defaults ([#821](https://github.com/revanced/revanced-patches/issues/821)) ([f9eea33](https://github.com/revanced/revanced-patches/commit/f9eea332cea0b8c3d5c3dfff645b60861e925b5a))
# [2.84.0](https://github.com/revanced/revanced-patches/compare/v2.83.3...v2.84.0) (2022-10-20)

View File

@@ -68,6 +68,7 @@ The official Patch bundle provided by ReVanced and the community.
| `hide-time-and-seekbar` | Hides progress bar and time counter on videos. | 17.36.37 |
| `hide-video-buttons` | Adds options to hide action buttons under a video. | 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 |
| `hide-captions-button` | Hides the captions button on video player. | 17.36.37 |
| `hide-shorts-button` | Hides the shorts button on the navigation bar. | 17.36.37 |
| `hide-create-button` | Hides the create button in the navigation bar. | 17.36.37 |
| `disable-startup-shorts-player` | Disables playing YouTube Shorts when launching YouTube. | 17.36.37 |

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official
version = 2.84.0
version = 2.85.2

File diff suppressed because one or more lines are too long

View File

@@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37")
"com.google.android.youtube", arrayOf("17.33.42", "17.34.35", "17.34.36", "17.36.37")
)]
)
@Target(AnnotationTarget.CLASS)

View File

@@ -0,0 +1,56 @@
package app.revanced.patches.youtube.layout.hidecaptionsbutton.patch
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.addInstructions
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.youtube.layout.autocaptions.annotations.AutoCaptionsCompatibility
import app.revanced.patches.youtube.layout.autocaptions.fingerprints.SubtitleButtonControllerFingerprint
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.Opcode
@Patch
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
@Name("hide-captions-button")
@Description("Hides the captions button on video player.")
@AutoCaptionsCompatibility
@Version("0.0.1")
class HideCaptionsButtonPatch : BytecodePatch(listOf(
SubtitleButtonControllerFingerprint,
)) {
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_hide_captions_button",
StringResource("revanced_hide_captions_button_title", "Hide captions button"),
false,
StringResource("revanced_hide_captions_button_summary_on", "Captions button is hidden"),
StringResource("revanced_hide_captions_button_summary_off", "Captions button is shown")
)
)
val subtitleButtonControllerMethod = SubtitleButtonControllerFingerprint.result!!.mutableMethod
// Due to previously applied patches, scanResult index cannot be used in this context
val igetBooleanIndex = subtitleButtonControllerMethod.implementation!!.instructions.indexOfFirst {
it.opcode == Opcode.IGET_BOOLEAN
}
subtitleButtonControllerMethod.addInstructions(
igetBooleanIndex + 1, """
invoke-static {v0}, Lapp/revanced/integrations/patches/HideCaptionsButtonPatch;->hideCaptionsButton(Landroid/widget/ImageView;)V
"""
)
return PatchResultSuccess()
}
}

View File

@@ -33,10 +33,10 @@ class MixPlaylistsPatch : BytecodePatch(
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_mix_playlists_hidden",
StringResource("revanced_mix_playlists_title", "Show mix playlists"),
true,
StringResource("revanced_mix_playlists_summary_on", "Mix playlists are shown"),
StringResource("revanced_mix_playlists_summary_off", "Mix playlists are hidden")
StringResource("revanced_mix_playlists_title", "Hide mix playlists"),
false,
StringResource("revanced_mix_playlists_summary_on", "Mix playlists are hidden"),
StringResource("revanced_mix_playlists_summary_off", "Mix playlists are shown")
)
)

View File

@@ -30,7 +30,8 @@ class ThemePatch : ResourcePatch {
node.textContent = when (node.getAttribute("name")) {
"yt_black1", "yt_black1_opacity95", "yt_black1_opacity98", "yt_black2", "yt_black3", "yt_black4",
"yt_status_bar_background_dark" -> darkThemeBackgroundColor
"yt_status_bar_background_dark", "material_grey_100", "material_grey_50", "material_grey_600",
"material_grey_800", "material_grey_850", "material_grey_900", "material_grey_white_1000" -> darkThemeBackgroundColor
"yt_white1", "yt_white1_opacity95", "yt_white1_opacity98", "yt_white2", "yt_white3",
"yt_white4" -> lightThemeBackgroundColor

View File

@@ -0,0 +1,13 @@
package app.revanced.patches.youtube.misc.integrations.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.integrations.annotations.IntegrationsCompatibility
@Name("service-fingerprint")
@IntegrationsCompatibility
@Version("0.0.1")
object ServiceFingerprint : MethodFingerprint(
customFingerprint = { methodDef -> methodDef.definingClass.endsWith("ApiPlayerService;") && methodDef.name == "<init>" }
)

View File

@@ -0,0 +1,16 @@
package app.revanced.patches.youtube.misc.integrations.fingerprints
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.misc.integrations.annotations.IntegrationsCompatibility
@Name("standalone-player-fingerprint")
@IntegrationsCompatibility
@Version("0.0.1")
object StandalonePlayerFingerprint : MethodFingerprint(
strings = listOf(
"Invalid PlaybackStartDescriptor. Returning the instance itself.",
"com.google.android.music",
)
)

View File

@@ -4,6 +4,7 @@ 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.MethodFingerprintExtensions.name
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.or
import app.revanced.patcher.patch.BytecodePatch
@@ -14,6 +15,8 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMu
import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.youtube.misc.integrations.annotations.IntegrationsCompatibility
import app.revanced.patches.youtube.misc.integrations.fingerprints.InitFingerprint
import app.revanced.patches.youtube.misc.integrations.fingerprints.ServiceFingerprint
import app.revanced.patches.youtube.misc.integrations.fingerprints.StandalonePlayerFingerprint
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.immutable.ImmutableMethod
import org.jf.dexlib2.immutable.ImmutableMethodImplementation
@@ -24,42 +27,33 @@ import org.jf.dexlib2.immutable.ImmutableMethodImplementation
@Version("0.0.1")
class IntegrationsPatch : BytecodePatch(
listOf(
InitFingerprint
InitFingerprint, StandalonePlayerFingerprint, ServiceFingerprint
)
) {
companion object {
private const val INTEGRATIONS_DESCRIPTOR = "Lapp/revanced/integrations/utils/ReVancedUtils;"
}
override fun execute(context: BytecodeContext): PatchResult {
if (context.findClass("Lapp/revanced/integrations/utils/ReVancedUtils") == null)
return PatchResultError("Integrations have not been merged yet. This patch can not succeed without the integrations.")
if (context.findClass(INTEGRATIONS_DESCRIPTOR) == null)
return PatchResultError("Integrations have not been merged yet. This patch can not succeed without merging the integrations.")
val result = InitFingerprint.result!!
arrayOf(InitFingerprint, StandalonePlayerFingerprint, ServiceFingerprint).map {
it to (it.result ?: return PatchResultError("${it.name} failed to resolve"))
}.forEach { (fingerprint, result) ->
with(result.mutableMethod) {
// parameter which holds the context
val contextParameter = if (fingerprint == ServiceFingerprint) parameters.size else 1
// register which holds the context
val contextRegister = implementation!!.registerCount - contextParameter
val method = result.mutableMethod
val implementation = method.implementation!!
val count = implementation.registerCount - 1
method.addInstruction(
0, "sput-object v$count, Lapp/revanced/integrations/utils/ReVancedUtils;->context:Landroid/content/Context;"
)
val classDef = result.mutableClass
classDef.methods.add(
ImmutableMethod(
classDef.type,
"getAppContext",
null,
"Landroid/content/Context;",
AccessFlags.PUBLIC or AccessFlags.STATIC,
null,
null,
ImmutableMethodImplementation(
1, """
invoke-static { }, Lapp/revanced/integrations/utils/ReVancedUtils;->getAppContext()Landroid/content/Context;
move-result-object v0
return-object v0
""".toInstructions(), null, null
addInstruction(
0,
"sput-object v$contextRegister, $INTEGRATIONS_DESCRIPTOR->context:Landroid/content/Context;"
)
).toMutable()
)
}
}
return PatchResultSuccess()
}
}