chore: Merge branch dev to main

This commit is contained in:
oSumAtrIX 2023-12-28 22:30:37 +01:00 committed by GitHub
commit c5d1c36ea8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 442 additions and 4538 deletions

16
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,16 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
- package-ecosystem: npm
directory: /
schedule:
interval: monthly
- package-ecosystem: gradle
directory: /
schedule:
interval: monthly

View File

@ -0,0 +1,18 @@
name: Update Gradle wrapper
on:
schedule:
- cron: "0 0 1 * *"
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update Gradle Wrapper
uses: gradle-update/update-gradle-wrapper-action@v1
with:
target-branch: dev

View File

@ -1,3 +1,74 @@
# [3.2.0-dev.9](https://github.com/ReVanced/revanced-patches/compare/v3.2.0-dev.8...v3.2.0-dev.9) (2023-12-27)
### Features
* **YouTube - Theme:** Add classic dark color to presets ([#2542](https://github.com/ReVanced/revanced-patches/issues/2542)) ([4e1dc00](https://github.com/ReVanced/revanced-patches/commit/4e1dc0041d6693fba08e78514787407f933a6e41))
* **YouTube:** Add `Remove viewer discretion dialog` patch ([a07f83f](https://github.com/ReVanced/revanced-patches/commit/a07f83fe89ce577fc8bd904eacad5383a639b09b))
# [3.2.0-dev.8](https://github.com/ReVanced/revanced-patches/compare/v3.2.0-dev.7...v3.2.0-dev.8) (2023-12-26)
### Bug Fixes
* **YouTube:** Fix grammer mistakes in patch descriptions ([#2543](https://github.com/ReVanced/revanced-patches/issues/2543)) ([ebf5993](https://github.com/ReVanced/revanced-patches/commit/ebf599349c508067a28526267d82030b679df045))
# [3.2.0-dev.7](https://github.com/ReVanced/revanced-patches/compare/v3.2.0-dev.6...v3.2.0-dev.7) (2023-12-24)
### Features
* **YouTube - Hide ads:** Hide fullscreen ads ([bdc9a12](https://github.com/ReVanced/revanced-patches/commit/bdc9a129eff3a5051b8b37665b3243a8b61cbbac))
* **YouTube - Hide layout components:** Hide search result recommendations ([55cc7f1](https://github.com/ReVanced/revanced-patches/commit/55cc7f1c7722f56af6d33ea2bd09a1b99d635209))
# [3.2.0-dev.6](https://github.com/ReVanced/revanced-patches/compare/v3.2.0-dev.5...v3.2.0-dev.6) (2023-12-24)
### Bug Fixes
* **Spoof SIM country:** Validate patch option value correctly ([8105463](https://github.com/ReVanced/revanced-patches/commit/81054637915a5399d15f546b2290b5d939e15732))
# [3.2.0-dev.5](https://github.com/ReVanced/revanced-patches/compare/v3.2.0-dev.4...v3.2.0-dev.5) (2023-12-23)
### Bug Fixes
* **YouTube - Alternative thumbnails:** Clarify DeArrow support is for thumbnails ([#2531](https://github.com/ReVanced/revanced-patches/issues/2531)) ([828abb0](https://github.com/ReVanced/revanced-patches/commit/828abb0558926cd6557c79abcf1a04bfe2c719e6))
# [3.2.0-dev.4](https://github.com/ReVanced/revanced-patches/compare/v3.2.0-dev.3...v3.2.0-dev.4) (2023-12-21)
### Bug Fixes
* **Tiktok - Remember clear display:** Use correct name ([d7e44cb](https://github.com/ReVanced/revanced-patches/commit/d7e44cb887396bba27ee81c70c006f0cc247c56d))
# [3.2.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v3.2.0-dev.2...v3.2.0-dev.3) (2023-12-21)
### Features
* **Tiktok:** Add `Remember clear mode` patch ([#2509](https://github.com/ReVanced/revanced-patches/issues/2509)) ([048bf59](https://github.com/ReVanced/revanced-patches/commit/048bf592ef93ee5138aa1886be1644501f88964a))
# [3.2.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v3.2.0-dev.1...v3.2.0-dev.2) (2023-12-19)
### Features
* **Public API:** Deprecate `HideEmailAddressPatch` ([866bceb](https://github.com/ReVanced/revanced-patches/commit/866bcebdd990b964d3dfd5aea792e7fffaedbf44))
* **YouTube:** Remove `Hide email address` patch ([3b84305](https://github.com/ReVanced/revanced-patches/commit/3b84305a6b97800cb147f86c642f19689548aca5))
# [3.2.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v3.1.0...v3.2.0-dev.1) (2023-12-18)
### Bug Fixes
* **YouTube - SponsorBlock:** Export local statistics with saved settings ([f8365b4](https://github.com/ReVanced/revanced-patches/commit/f8365b4e3585328506887022ac6168045ac110b9))
### Features
* **Public API:** Make `BottomControlsResource#addControls` public ([#2514](https://github.com/ReVanced/revanced-patches/issues/2514)) ([f4e2257](https://github.com/ReVanced/revanced-patches/commit/f4e2257072ca02003f7c272d6c0c8ef1aa6032ae))
# [3.1.0](https://github.com/ReVanced/revanced-patches/compare/v3.0.1...v3.1.0) (2023-12-12)

View File

@ -818,6 +818,12 @@ public final class app/revanced/patches/tiktok/feedfilter/FeedFilterPatch : app/
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/tiktok/interaction/cleardisplay/RememberClearDisplayPatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/tiktok/interaction/cleardisplay/RememberClearDisplayPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/tiktok/interaction/downloads/DownloadsPatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/tiktok/interaction/downloads/DownloadsPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
@ -1082,6 +1088,12 @@ public final class app/revanced/patches/youtube/interaction/copyvideourl/CopyVid
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/youtube/interaction/dialog/RemoveViewerDiscretionDialogPatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/interaction/dialog/RemoveViewerDiscretionDialogPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/youtube/interaction/downloads/ExternalDownloadsBytecodePatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/youtube/interaction/downloads/ExternalDownloadsBytecodePatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
@ -1464,6 +1476,7 @@ public final class app/revanced/patches/youtube/misc/minimizedplayback/Minimized
public final class app/revanced/patches/youtube/misc/playercontrols/BottomControlsResourcePatch : app/revanced/patcher/patch/ResourcePatch, java/io/Closeable {
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/playercontrols/BottomControlsResourcePatch;
public final fun addControls (Ljava/lang/String;)V
public fun close ()V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V

View File

@ -1,7 +1,7 @@
import org.gradle.kotlin.dsl.support.listFilesOrdered
plugins {
kotlin("jvm") version "1.9.10"
kotlin("jvm") version "1.9.21"
alias(libs.plugins.binary.compatibility.validator)
`maven-publish`
}
@ -49,7 +49,7 @@ tasks.withType(Jar::class) {
tasks {
register<DefaultTask>("generateBundle") {
description = "Generate dex files from build and bundle them in the jar file"
description = "Generate DEX files and add them in the JAR file"
dependsOn(build)

View File

@ -1,4 +1,4 @@
org.gradle.parallel = true
org.gradle.caching = true
kotlin.code.style = official
version = 3.1.0
version = 3.2.0-dev.9

View File

@ -1,7 +1,7 @@
[versions]
revanced-patcher = "19.1.0"
smali = "3.0.3"
guava = "32.1.2-jre"
guava = "32.1.3-jre"
gson = "2.10.1"
binary-compatibility-validator = "0.13.2"

Binary file not shown.

View File

@ -1,6 +1,8 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionSha256Sum=3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae
distributionSha256Sum=9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dist
zipStorePath=wrapper/dists

17
gradlew vendored
View File

@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@ -201,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \

4463
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
{
"devDependencies": {
"@saithodev/semantic-release-backmerge": "^3.2.1",
"@saithodev/semantic-release-backmerge": "^4.0.1",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"gradle-semantic-release-plugin": "^1.8.0",
"semantic-release": "^22.0.8"
"semantic-release": "^22.0.12"
}
}

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,6 @@ package app.revanced.patches.all.telephony.sim.spoof
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.patch.options.PatchOption
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.all.misc.transformation.AbstractTransformInstructionsPatch
@ -25,26 +24,29 @@ import java.util.*
)
@Suppress("unused")
object SpoofSimCountryPatch : AbstractTransformInstructionsPatch<Pair<Int, String>>() {
private val isoValidator: PatchOption<String>.(String?) -> Boolean =
{ it: String? -> it?.uppercase() in Locale.getISOCountries() || it == null }
private val countries = Locale.getISOCountries().associateBy { Locale("", it).displayCountry }
private val networkCountryIso by stringPatchOption(
private val networkCountryIso by isoCountryPatchOption(
"networkCountryIso",
null,
null,
"Network ISO Country Code",
"ISO-3166-1 alpha-2 country code equivalent of the MCC (Mobile Country Code) " +
"of the current registered operator or the cell nearby.",
validator = isoValidator
)
private val simCountryIso by stringPatchOption(
private val simCountryIso by isoCountryPatchOption(
"simCountryIso",
null,
null,
"Sim ISO Country Code",
)
private fun isoCountryPatchOption(
key: String,
title: String,
) = stringPatchOption(
key,
null,
countries,
title,
"ISO-3166-1 alpha-2 country code equivalent for the SIM provider's country code.",
validator = isoValidator
false,
validator = { it: String? -> it == null || it.uppercase() in countries.values }
)
override fun filterMap(

View File

@ -0,0 +1,79 @@
package app.revanced.patches.tiktok.interaction.cleardisplay
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.tiktok.interaction.cleardisplay.fingerprints.OnClearDisplayEventFingerprint
import app.revanced.patches.tiktok.interaction.cleardisplay.fingerprints.OnRenderFirstFrameFingerprint
import app.revanced.util.exception
import app.revanced.util.indexOfFirstInstruction
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction22c
@Patch(
name = "Remember clear display",
description = "Remembers the clear display configurations in between videos.",
compatiblePackages = [
CompatiblePackage("com.ss.android.ugc.trill", ["32.5.3"]),
CompatiblePackage("com.zhiliaoapp.musically", ["32.5.3"])
]
)
@Suppress("unused")
object RememberClearDisplayPatch : BytecodePatch(
setOf(
OnClearDisplayEventFingerprint,
OnRenderFirstFrameFingerprint
)
) {
override fun execute(context: BytecodeContext) {
OnClearDisplayEventFingerprint.result?.mutableMethod?.let {
// region Hook the "Clear display" configuration save event to remember the state of clear display.
val isEnabledIndex = it.indexOfFirstInstruction { opcode == Opcode.IGET_BOOLEAN } + 1
val isEnabledRegister = it.getInstruction<Instruction22c>(isEnabledIndex - 1).registerA
it.addInstructions(
isEnabledIndex,
"invoke-static { v$isEnabledRegister }, " +
"Lapp/revanced/tiktok/cleardisplay/RememberClearDisplayPatch;->rememberClearDisplayState(Z)V"
)
// endregion
// region Override the "Clear display" configuration load event to load the state of clear display.
val clearDisplayEventClass = it.parameters[0].type
OnRenderFirstFrameFingerprint.result?.mutableMethod?.apply {
addInstructionsWithLabels(
0,
"""
# Create a new clearDisplayEvent and post it to the EventBus (https://github.com/greenrobot/EventBus)
# The state of clear display.
invoke-static { }, Lapp/revanced/tiktok/cleardisplay/RememberClearDisplayPatch;->getClearDisplayState()Z
move-result v3
if-eqz v3, :clear_display_disabled
# Clear display type such as 0 = LONG_PRESS, 1 = SCREEN_RECORD etc.
const/4 v1, 0x0
# Name of the clear display type which is equivalent to the clear display type.
const-string v2, "long_press"
new-instance v0, $clearDisplayEventClass
invoke-direct { v0, v1, v2, v3 }, $clearDisplayEventClass-><init>(ILjava/lang/String;Z)V
invoke-virtual { v0 }, $clearDisplayEventClass->post()Lcom/ss/android/ugc/governance/eventbus/IEvent;
""",
ExternalLabel("clear_display_disabled", getInstruction(0))
)
} ?: throw OnRenderFirstFrameFingerprint.exception
// endregion
} ?: throw OnClearDisplayEventFingerprint.exception
}
}

View File

@ -0,0 +1,10 @@
package app.revanced.patches.tiktok.interaction.cleardisplay.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint
internal object OnClearDisplayEventFingerprint : MethodFingerprint(
customFingerprint = { methodDef, _ ->
// Internally the feature is called "Clear mode".
methodDef.definingClass.endsWith("/ClearModePanelComponent;") && methodDef.name == "onClearModeEvent"
}
)

View File

@ -0,0 +1,9 @@
package app.revanced.patches.tiktok.interaction.cleardisplay.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint
internal object OnRenderFirstFrameFingerprint : MethodFingerprint(
customFingerprint = { methodDef, _ ->
methodDef.definingClass.endsWith("/BaseListFragmentPanel;") && methodDef.name == "onRenderFirstFrame"
}
)

View File

@ -31,6 +31,12 @@ object HideAdsResourcePatch : ResourcePatch() {
StringResource("revanced_hide_general_ads_summary_on", "General ads are hidden"),
StringResource("revanced_hide_general_ads_summary_off", "General ads are shown")
),
SwitchPreference(
"revanced_hide_fullscreen_ads",
StringResource("revanced_hide_fullscreen_ads_title", "Hide fullscreen ads"),
StringResource("revanced_hide_fullscreen_ads_summary_on", "Fullscreen ads are hidden"),
StringResource("revanced_hide_fullscreen_ads_summary_off", "Fullscreen ads are shown")
),
SwitchPreference(
"revanced_hide_buttoned_ads",
StringResource("revanced_hide_buttoned_ads_title", "Hide buttoned ad"),

View File

@ -45,11 +45,11 @@ object HideGetPremiumPatch : BytecodePatch(setOf(GetPremiumViewFingerprint)) {
),
StringResource(
"revanced_hide_get_premium_summary_on",
"YouTube Premium promotions under video player is hidden"
"YouTube Premium promotions under video player are hidden"
),
StringResource(
"revanced_hide_get_premium_summary_off",
"YouTube Premium promotions under video player is shown"
"YouTube Premium promotions under video player are shown"
)
)
)

View File

@ -28,30 +28,39 @@ internal object CopyVideoUrlResourcePatch : ResourcePatch() {
SwitchPreference(
"revanced_copy_video_url",
StringResource("revanced_copy_video_url_title", "Show copy video URL button"),
StringResource("revanced_copy_video_url_summary_on", "Button is shown. Tap to copy video URL. Tap and hold to copy video URL with timestamp"),
StringResource(
"revanced_copy_video_url_summary_on",
"Button is shown. Tap to copy video URL. Tap and hold to copy video URL with timestamp"
),
StringResource("revanced_copy_video_url_summary_off", "Button is not shown")
),
SwitchPreference(
"revanced_copy_video_url_timestamp",
StringResource("revanced_copy_video_url_timestamp_title", "Show copy timestamp URL button"),
StringResource("revanced_copy_video_url_timestamp_summary_on", "Button is shown. Tap to copy video URL with timestamp. Tap and hold to copy video without timestamp"),
StringResource(
"revanced_copy_video_url_timestamp_summary_on",
"Button is shown. Tap to copy video URL with timestamp. Tap and hold to copy video without timestamp"
),
StringResource("revanced_copy_video_url_timestamp_summary_off", "Button is not shown")
)
),
StringResource("revanced_copy_video_url_preference_screen_summary", "Settings related to copy URL buttons in video player")
StringResource(
"revanced_copy_video_url_preference_screen_summary",
"Settings related to copy URL buttons in video player"
)
)
)
context.copyResources("copyvideourl", ResourceGroup(
resourceDirectoryName = "drawable",
"revanced_yt_copy.xml",
"revanced_yt_copy_timestamp.xml"
)
context.copyResources(
"copyvideourl", ResourceGroup(
resourceDirectoryName = "drawable",
"revanced_yt_copy.xml",
"revanced_yt_copy_timestamp.xml"
)
)
// merge strings
context.mergeStrings("copyvideourl/host/values/strings.xml")
BottomControlsResourcePatch.addControls("copyvideourl/host/layout/${BottomControlsResourcePatch.TARGET_RESOURCE_NAME}")
BottomControlsResourcePatch.addControls("copyvideourl")
}
}

View File

@ -0,0 +1,69 @@
package app.revanced.patches.youtube.interaction.dialog
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.interaction.dialog.fingerprints.CreateDialogFingerprint
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import app.revanced.util.exception
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
@Patch(
name = "Remove viewer discretion dialog",
description = "Removes the dialog that appears when you try to watch a video that has been age-restricted " +
"by accepting it automatically. This does not bypass the age restriction.",
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.youtube"
)
]
)
@Suppress("unused")
object RemoveViewerDiscretionDialogPatch : BytecodePatch(
setOf(CreateDialogFingerprint)
) {
private const val INTEGRATIONS_METHOD_DESCRIPTOR =
"Lapp/revanced/integrations/patches/RemoveViewerDiscretionDialogPatch;->" +
"confirmDialog(Landroid/app/AlertDialog;)V"
override fun execute(context: BytecodeContext) {
SettingsPatch.PreferenceScreen.INTERACTIONS.addPreferences(
SwitchPreference(
"revanced_remove_viewer_discretion_dialog",
StringResource(
"revanced_remove_viewer_discretion_dialog_title",
"Remove viewer discretion dialog"
),
StringResource(
"revanced_remove_viewer_discretion_dialog_summary_on",
"Dialog will be removed"
),
StringResource(
"revanced_remove_viewer_discretion_dialog_summary_off",
"Dialog will be shown"
),
StringResource(
"revanced_remove_viewer_discretion_dialog_user_dialog_message",
"This does not bypass the age restriction, it just accepts it automatically."
)
)
)
CreateDialogFingerprint.result?.mutableMethod?.apply {
val showDialogIndex = implementation!!.instructions.lastIndex - 2
val dialogRegister = getInstruction<FiveRegisterInstruction>(showDialogIndex).registerC
replaceInstructions(
showDialogIndex,
"invoke-static { v$dialogRegister }, $INTEGRATIONS_METHOD_DESCRIPTOR",
)
} ?: throw CreateDialogFingerprint.exception
}
}

View File

@ -0,0 +1,22 @@
package app.revanced.patches.youtube.interaction.dialog.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
internal object CreateDialogFingerprint : MethodFingerprint(
"V",
AccessFlags.PROTECTED.value,
listOf("L", "L", "Ljava/lang/String;"),
listOf(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.IPUT_OBJECT,
Opcode.IGET_OBJECT,
Opcode.INVOKE_VIRTUAL // dialog.show()
)
)

View File

@ -28,27 +28,35 @@ internal object ExternalDownloadsResourcePatch : ResourcePatch() {
"revanced_external_downloader",
StringResource("revanced_external_downloader_title", "Show external download button"),
StringResource("revanced_external_downloader_summary_on", "Download button shown in player"),
StringResource("revanced_external_downloader_summary_off", "Download button not shown in player")
StringResource(
"revanced_external_downloader_summary_off",
"Download button not shown in player"
)
),
TextPreference(
"revanced_external_downloader_name",
StringResource("revanced_external_downloader_name_title", "Downloader package name"),
StringResource("revanced_external_downloader_name_summary", "Package name of your installed external downloader app, such as NewPipe or Seal"),
StringResource(
"revanced_external_downloader_name_summary",
"Package name of your installed external downloader app, such as NewPipe or Seal"
),
InputType.TEXT
)
),
StringResource("revanced_external_downloader_preference_screen_summary", "Settings for using an external downloader")
StringResource(
"revanced_external_downloader_preference_screen_summary",
"Settings for using an external downloader"
)
)
)
// Copy strings
context.mergeStrings("downloads/host/values/strings.xml")
// Copy resources
context.copyResources("downloads", ResourceGroup("drawable", "revanced_yt_download_button.xml"))
context.copyResources(
"downloads",
ResourceGroup("drawable", "revanced_yt_download_button.xml")
)
// Add download button node
BottomControlsResourcePatch.addControls("downloads/host/layout/${BottomControlsResourcePatch.TARGET_RESOURCE_NAME}")
BottomControlsResourcePatch.addControls("downloads")
}
}

View File

@ -1,6 +1,5 @@
package app.revanced.patches.youtube.layout.hide.general
import app.revanced.util.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
@ -18,6 +17,7 @@ import app.revanced.patches.youtube.layout.hide.general.fingerprints.ShowWaterma
import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch.PreferenceScreen
import app.revanced.util.exception
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
@ -93,6 +93,21 @@ object HideLayoutComponentsPatch : BytecodePatch(
StringResource("revanced_hide_timed_reactions_summary_on", "Timed reactions are hidden"),
StringResource("revanced_hide_timed_reactions_summary_off", "Timed reactions are shown")
),
SwitchPreference(
"revanced_hide_search_result_recommendations",
StringResource(
"revanced_hide_search_result_recommendations_title",
"Hide search result recommendations (e.g People also watched)"
),
StringResource(
"revanced_hide_search_result_recommendations_summary_on",
"Recommendations are hidden"
),
StringResource(
"revanced_hide_search_result_recommendations_summary_off",
"Recommendations are shown"
)
),
SwitchPreference(
"revanced_hide_search_result_shelf_header",
StringResource(
@ -285,8 +300,8 @@ object HideLayoutComponentsPatch : BytecodePatch(
SwitchPreference(
"revanced_hide_artist_cards",
StringResource("revanced_hide_artist_cards_title", "Hide artist cards"),
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_on", "Artist cards are hidden"),
StringResource("revanced_hide_artist_cards_off", "Artist cards are shown")
),
SwitchPreference(
"revanced_hide_chips_shelf",

View File

@ -1,6 +1,5 @@
package app.revanced.patches.youtube.layout.hide.personalinformation
import app.revanced.util.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
@ -9,10 +8,11 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.youtube.layout.hide.personalinformation.fingerprints.AccountSwitcherAccessibilityLabelFingerprint
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.util.exception
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Deprecated("This patch is no longer working and will be removed in a future release.")
@Patch(
name = "Hide email address",
description = "Hides the email address in the account switcher.",
dependencies = [IntegrationsPatch::class, HideEmailAddressResourcePatch::class],
compatiblePackages = [

View File

@ -59,6 +59,7 @@ object ThemeBytecodePatch : BytecodePatch(
values = mapOf(
"Amoled black" to AMOLED_BLACK_COLOR,
"Material You" to "@android:color/system_neutral1_900",
"Classic (old YouTube)" to "#FF212121",
"Catppuccin (Mocha)" to "#FF181825",
"Dark pink" to "#FF290025",
"Dark blue" to "#FF001029",

View File

@ -119,9 +119,9 @@ object AlternativeThumbnailsPatch : BytecodePatch(
),
SwitchPreference(
"revanced_alt_thumbnail_dearrow",
StringResource("revanced_alt_thumbnail_dearrow_title", "Enable DeArrow"),
StringResource("revanced_alt_thumbnail_dearrow_summary_on", "Using DeArrow"),
StringResource("revanced_alt_thumbnail_dearrow_summary_off", "Not using DeArrow")
StringResource("revanced_alt_thumbnail_dearrow_title", "Enable DeArrow thumbnails"),
StringResource("revanced_alt_thumbnail_dearrow_summary_on", "Using DeArrow thumbnails"),
StringResource("revanced_alt_thumbnail_dearrow_summary_off", "Not using DeArrow thumbnails")
),
SwitchPreference(
"revanced_alt_thumbnail_dearrow_connection_toast",

View File

@ -11,15 +11,15 @@ import java.io.Closeable
object BottomControlsResourcePatch : ResourcePatch(), Closeable {
internal var bottomUiContainerResourceId: Long = -1
internal const val TARGET_RESOURCE_NAME = "youtube_controls_bottom_ui_container.xml"
private const val TARGET_RESOURCE_NAME = "youtube_controls_bottom_ui_container.xml"
private const val TARGET_RESOURCE = "res/layout/$TARGET_RESOURCE_NAME"
// The element to the left of the element being added.
private var lastLeftOf = "fullscreen_button"
private lateinit var resourceContext: ResourceContext
private lateinit var targetXmlEditor: DomFileEditor
// The element to which to add the new elements to
private var lastLeftOf = "fullscreen_button"
override fun execute(context: ResourceContext) {
resourceContext = context
targetXmlEditor = context.xmlEditor[TARGET_RESOURCE]
@ -30,46 +30,44 @@ object BottomControlsResourcePatch : ResourcePatch(), Closeable {
/**
* Add new controls to the bottom of the YouTube player.
* @param hostYouTubeControlsBottomUiResourceName The hosting resource name containing the elements.
*
* @param resourceDirectoryName The name of the directory containing the hosting resource.
*/
internal fun addControls(hostYouTubeControlsBottomUiResourceName: String) {
val sourceXmlEditor =
resourceContext.xmlEditor[this::class.java.classLoader.getResourceAsStream(
hostYouTubeControlsBottomUiResourceName
)!!]
fun addControls(resourceDirectoryName: String) {
val sourceXmlEditor = resourceContext.xmlEditor[
this::class.java.classLoader.getResourceAsStream(
"$resourceDirectoryName/host/layout/$TARGET_RESOURCE_NAME"
)!!
]
val targetElement =
"android.support.constraint.ConstraintLayout"
val targetElement = "android.support.constraint.ConstraintLayout"
val hostElements = sourceXmlEditor.file.getElementsByTagName(targetElement).item(0).childNodes
val destinationResourceFile = targetXmlEditor.file
val destinationElement =
destinationResourceFile.getElementsByTagName(targetElement).item(0)
val destinationElement = destinationResourceFile.getElementsByTagName(targetElement).item(0)
for (index in 1 until hostElements.length) {
val element = hostElements.item(index).cloneNode(true)
// if the element has no attributes theres no point to adding it to the destination
// If the element has no attributes there's no point to adding it to the destination.
if (!element.hasAttributes()) continue
// set the elements lastLeftOf attribute to the lastLeftOf value
// Set the elements lastLeftOf attribute to the lastLeftOf value.
val namespace = "@+id"
element.attributes.getNamedItem("yt:layout_constraintRight_toLeftOf").nodeValue =
"$namespace/$lastLeftOf"
// set lastLeftOf attribute to the current element
// Set lastLeftOf attribute to the current element.
val nameSpaceLength = 5
lastLeftOf = element.attributes.getNamedItem("android:id").nodeValue.substring(nameSpaceLength)
// copy the element
// Add the element.
destinationResourceFile.adoptNode(element)
destinationElement.appendChild(element)
}
sourceXmlEditor.close()
}
override fun close() {
targetXmlEditor.close()
}
override fun close() = targetXmlEditor.close()
}

View File

@ -176,9 +176,9 @@
<string name="sb_stats_self_saved" formatted="false">You\'ve skipped &lt;b>%s&lt;/b> segments</string>
<string name="sb_stats_self_saved_sum" formatted="false">That\'s &lt;b>%s&lt;/b></string>
<string name="sb_stats_self_saved_reset_title">Reset skipped segments counter?</string>
<string name="sb_stats_saved_hour_format" formatted="false">%d hours %d minutes</string>
<string name="sb_stats_saved_minute_format" formatted="false">%d minutes %d seconds</string>
<string name="sb_stats_saved_second_format" formatted="false">%d seconds</string>
<string name="sb_stats_saved_hour_format" formatted="false">%s hours %s minutes</string>
<string name="sb_stats_saved_minute_format" formatted="false">%s minutes %s seconds</string>
<string name="sb_stats_saved_second_format" formatted="false">%s seconds</string>
<string name="sb_color_dot_label">Color:</string>
<string name="sb_color_changed">Color changed</string>