Compare commits

...

7 Commits

Author SHA1 Message Date
semantic-release-bot
ca3438b640 chore(release): 2.92.1 [skip ci]
## [2.92.1](https://github.com/revanced/revanced-patches/compare/v2.92.0...v2.92.1) (2022-10-26)

### Bug Fixes

* **youtube/custom-branding:** use proper scaled icons ([ba82fb8](666b241a53))
2022-10-26 23:13:00 +00:00
oSumAtrIX
5121c3d45b refactor(youtube/custom-branding): improve general code quality 2022-10-27 01:11:10 +02:00
oSumAtrIX
666b241a53 fix(youtube/custom-branding): use proper scaled icons 2022-10-27 01:11:10 +02:00
semantic-release-bot
b961bdf9d3 chore(release): 2.92.0 [skip ci]
# [2.92.0](https://github.com/revanced/revanced-patches/compare/v2.91.0...v2.92.0) (2022-10-26)

### Features

* **youtube/hide-mix-playlists:** hide in video suggestions ([#854](https://github.com/revanced/revanced-patches/issues/854)) ([2bf9a54](8aa1d58b76))
2022-10-26 20:54:00 +00:00
johnconner122
8aa1d58b76 feat(youtube/hide-mix-playlists): hide in video suggestions (#854)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-10-26 22:51:49 +02:00
semantic-release-bot
570723bb59 chore(release): 2.91.0 [skip ci]
# [2.91.0](https://github.com/revanced/revanced-patches/compare/v2.90.0...v2.91.0) (2022-10-26)

### Features

* remove partially complete patch ([74f7d57](7027929e30))
2022-10-26 04:59:06 +00:00
oSumAtrIX
7027929e30 feat: remove partially complete patch 2022-10-26 06:56:18 +02:00
45 changed files with 112 additions and 104 deletions

View File

@@ -1,3 +1,24 @@
## [2.92.1](https://github.com/revanced/revanced-patches/compare/v2.92.0...v2.92.1) (2022-10-26)
### Bug Fixes
* **youtube/custom-branding:** use proper scaled icons ([24b5bcd](https://github.com/revanced/revanced-patches/commit/24b5bcdd703474c940fd436a37f0ae924d8b8c74))
# [2.92.0](https://github.com/revanced/revanced-patches/compare/v2.91.0...v2.92.0) (2022-10-26)
### Features
* **youtube/hide-mix-playlists:** hide in video suggestions ([#854](https://github.com/revanced/revanced-patches/issues/854)) ([acde5f0](https://github.com/revanced/revanced-patches/commit/acde5f066053ca3d58ca09fc2a6a1381ba27d84b))
# [2.91.0](https://github.com/revanced/revanced-patches/compare/v2.90.0...v2.91.0) (2022-10-26)
### Features
* remove partially complete patch ([d212e19](https://github.com/revanced/revanced-patches/commit/d212e19c3276c2ba6550f03dfd9bba47b7773524))
# [2.90.0](https://github.com/revanced/revanced-patches/compare/v2.89.0...v2.90.0) (2022-10-25)

View File

@@ -4,14 +4,6 @@ The official Patch bundle provided by ReVanced and the community.
> Looking for the JSON variant of this? [Click here](patches.json).
### 📦 `com.metanav`
<details>
| 💊 Patch | 📜 Description | 🏹 Target Version |
|:--------:|:--------------:|:-----------------:|
| `fix-scaling` | Scales the content properly. | 0.1.0 |
</details>
### 📦 `com.ss.android.ugc.trill`
<details>
@@ -95,7 +87,7 @@ The official Patch bundle provided by ReVanced and the community.
| `hide-email-address` | Hides the email address in the account switcher. | 17.36.37 |
| `tablet-mini-player` | Enables the tablet mini player layout. | 17.36.37 |
| `hide-watermark` | Hides creator's watermarks on videos. | 17.36.37 |
| `hide-my-mix` | Removes mix playlists from the feed. | 17.40.41 |
| `hide-my-mix` | Hides mix playlists. | 17.40.41 |
| `custom-branding` | Changes the YouTube launcher icon and name to your choice (defaults to ReVanced). | all |
| `premium-heading` | Shows premium branding on the home screen. | all |
| `old-quality-layout` | Enables the original quality flyout menu. | 17.36.37 |

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official
version = 2.90.0
version = 2.92.1

File diff suppressed because one or more lines are too long

View File

@@ -1,9 +0,0 @@
package app.revanced.patches.metanav.scaling.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.metanav", arrayOf("0.1.0"))])
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class FixScalingCompatibility

View File

@@ -1,32 +0,0 @@
package app.revanced.patches.metanav.scaling.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.metanav.scaling.annotations.FixScalingCompatibility
import org.w3c.dom.Element
@Patch
@Name("fix-scaling")
@Description("Scales the content properly.")
@FixScalingCompatibility
@Version("0.0.1")
class FixScalingPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
context.xmlEditor["assets/startScreenCanvas.html"].use { editor ->
val svgNode = editor
.file
.getElementsByTagName("svg")
.item(0) as Element
svgNode.setAttribute("height", "750")
}
return PatchResultSuccess()
}
}

View File

@@ -9,9 +9,9 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.youtube.layout.branding.icon.annotations.CustomBrandingCompatibility
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
import app.revanced.util.resources.ResourceUtils
import app.revanced.util.resources.ResourceUtils.copyResources
import java.io.File
import java.io.FileInputStream
import java.io.InputStream
import java.nio.file.Files
@Patch
@@ -22,36 +22,43 @@ import java.nio.file.Files
@Version("0.0.1")
class CustomBrandingPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
val resDirectory = context["res"]
if (!resDirectory.isDirectory) return PatchResultError("The res folder can not be found.")
fun copyResources(resourceGroups: List<ResourceUtils.ResourceGroup>) {
iconPath?.let { iconPathString ->
val iconPath = File(iconPathString)
val resourceDirectory = context["res"]
// Icon branding
val iconNames = arrayOf(
resourceGroups.forEach { group ->
val fromDirectory = iconPath.resolve(group.resourceDirectoryName)
val toDirectory = resourceDirectory.resolve(group.resourceDirectoryName)
group.resources.forEach { iconFileName ->
Files.write(
toDirectory.resolve(iconFileName).toPath(),
fromDirectory.resolve(iconFileName).readBytes()
)
}
}
} ?: resourceGroups.forEach { context.copyResources("branding", it) }
}
val iconResourceFileNames = arrayOf(
"adaptiveproduct_youtube_background_color_108",
"adaptiveproduct_youtube_foreground_color_108",
"ic_launcher",
"ic_launcher_round"
).map { "$it.png" }.toTypedArray()
fun createGroup(directory: String) = ResourceUtils.ResourceGroup(
directory, *iconResourceFileNames
)
mapOf(
"xxxhdpi" to 192,
"xxhdpi" to 144,
"xhdpi" to 96,
"hdpi" to 72,
"mdpi" to 48
).forEach { (iconDirectory, size) ->
iconNames.forEach { iconName ->
val iconFile = getIconStream("branding/$size/$iconName.png")
?: return PatchResultError("The icon $iconName can not be found.")
// change the app icon
arrayOf("xxxhdpi", "xxhdpi", "xhdpi", "hdpi", "mdpi")
.map { "mipmap-$it" }
.map(::createGroup)
.let(::copyResources)
Files.write(
resDirectory.resolve("mipmap-$iconDirectory").resolve("$iconName.png").toPath(),
iconFile.readBytes()
)
}
}
// Name branding
// change the name of the app
val manifest = context["AndroidManifest.xml"]
manifest.writeText(
manifest.readText()
@@ -64,15 +71,6 @@ class CustomBrandingPatch : ResourcePatch {
return PatchResultSuccess()
}
private fun getIconStream(iconPath: String): InputStream? {
if (appIconPath == null) {
return this.javaClass.classLoader.getResourceAsStream(iconPath)
}
val file = File(appIconPath!!).resolve(iconPath)
if (!file.exists()) return null
return FileInputStream(file)
}
companion object : OptionsContainer() {
private var appName: String? by option(
PatchOption.StringOption(
@@ -84,12 +82,12 @@ class CustomBrandingPatch : ResourcePatch {
)
)
private var appIconPath: String? by option(
private var iconPath: String? by option(
PatchOption.StringOption(
key = "appIconPath",
key = "iconPath",
default = null,
title = "Application Icon Path",
description = "A path to the icon of the application."
title = "App Icon Path",
description = "A path containing mipmap resource folders with icons."
)
)
}

View File

@@ -8,10 +8,10 @@ import app.revanced.patches.youtube.layout.hidemixplaylists.annotations.MixPlayl
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@Name("mix-playlists-fingerprint")
@Name("create-mix-playlist-fingerprint")
@MixPlaylistsPatchCompatibility
@Version("0.0.1")
object MixPlaylistsPatchFingerprint : MethodFingerprint(
object CreateMixPlaylistFingerprint : MethodFingerprint(
"V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "L", "L", "L", "L", "L", "L"), listOf(
Opcode.INVOKE_DIRECT,
Opcode.IPUT_OBJECT,
@@ -26,6 +26,5 @@ object MixPlaylistsPatchFingerprint : MethodFingerprint(
Opcode.IPUT_OBJECT,
Opcode.IPUT_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.RETURN_VOID
)
)

View File

@@ -0,0 +1,30 @@
package app.revanced.patches.youtube.layout.hidemixplaylists.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.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.hidemixplaylists.annotations.MixPlaylistsPatchCompatibility
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
@Name("second-create-mix-playlist-fingerprint")
@MixPlaylistsPatchCompatibility
@Version("0.0.1")
object SecondCreateMixPlaylistFingerprint : MethodFingerprint(
"V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "L", "L", "L", "L", "L"), listOf(
Opcode.INVOKE_DIRECT,
Opcode.IPUT_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.IPUT_OBJECT,
Opcode.IPUT_OBJECT,
Opcode.IPUT_OBJECT,
Opcode.IPUT_OBJECT,
Opcode.NEW_INSTANCE,
Opcode.INVOKE_DIRECT,
Opcode.IPUT_OBJECT,
Opcode.IPUT_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.RETURN_VOID
)
)

View File

@@ -5,13 +5,16 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
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.BytecodePatch
import app.revanced.patches.youtube.layout.hidemixplaylists.annotations.MixPlaylistsPatchCompatibility
import app.revanced.patches.youtube.layout.hidemixplaylists.fingerprints.MixPlaylistsPatchFingerprint
import app.revanced.patches.youtube.layout.hidemixplaylists.fingerprints.CreateMixPlaylistFingerprint
import app.revanced.patches.youtube.layout.hidemixplaylists.fingerprints.SecondCreateMixPlaylistFingerprint
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
@@ -21,12 +24,12 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@DependsOn([IntegrationsPatch::class])
@Name("hide-my-mix")
@Description("Removes mix playlists from the feed.")
@Description("Hides mix playlists.")
@MixPlaylistsPatchCompatibility
@Version("0.0.1")
class MixPlaylistsPatch : BytecodePatch(
listOf(
MixPlaylistsPatchFingerprint
CreateMixPlaylistFingerprint, SecondCreateMixPlaylistFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
@@ -40,16 +43,22 @@ class MixPlaylistsPatch : BytecodePatch(
)
)
val result = MixPlaylistsPatchFingerprint.result!!
val method = result.mutableMethod
val index = result.scanResult.patternScanResult!!.endIndex - 6
val register = (method.implementation!!.instructions[index] as OneRegisterInstruction).registerA
method.addInstruction(
index + 2,
"invoke-static {v$register}, Lapp/revanced/integrations/patches/HideMixPlaylistsPatch;->hideMixPlaylists(Landroid/view/View;)V"
)
arrayOf(CreateMixPlaylistFingerprint, SecondCreateMixPlaylistFingerprint).forEach(::addHook)
return PatchResultSuccess()
}
private fun addHook(fingerprint: MethodFingerprint) {
with (fingerprint.result!!) {
val insertIndex = scanResult.patternScanResult!!.endIndex - 3
val register = (mutableMethod.instruction(insertIndex - 2) as OneRegisterInstruction).registerA
mutableMethod.addInstruction(
insertIndex,
"invoke-static {v$register}, Lapp/revanced/integrations/patches/HideMixPlaylistsPatch;->hideMixPlaylists(Landroid/view/View;)V"
)
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB