Compare commits

...

11 Commits

Author SHA1 Message Date
semantic-release-bot
3fdfce5b2a chore(release): 1.4.1 [skip ci]
## [1.4.1](https://github.com/revanced/revanced-patches/compare/v1.4.0...v1.4.1) (2022-06-15)

### Bug Fixes

* `hide-cast-button` patch ([e85c30c](e85c30c9c2))
* comments ([903c01b](903c01b765))
2022-06-15 22:32:01 +00:00
oSumAtrIX
1616e42a4c Merge branch 'Canny1913-main' 2022-06-16 00:30:21 +02:00
oSumAtrIX
e85c30c9c2 fix: hide-cast-button patch 2022-06-16 00:25:21 +02:00
Canny1913
887a916c1a Update annotation
Co-authored-by: Sculas <contact@sculas.xyz>
2022-06-15 23:52:41 +03:00
Canny1913
903c01b765 fix: comments 2022-06-15 23:08:16 +03:00
Canny1913
a8940d8cd0 more comments 2022-06-15 23:06:40 +03:00
Canny1913
9b0e6b5ed8 comments 2022-06-15 23:04:27 +03:00
Canny1913
c3208ff2d1 comments 2022-06-15 23:02:54 +03:00
Canny1913
0e3c705dc9 cast work in progress
some terrible code
2022-06-15 22:58:24 +03:00
Affan Zaman
d733981342 Changed app name to ReVanced (#21) 2022-06-15 15:44:47 +02:00
bibarub
cc59f47f4c refactor: rename shorts-button to disable-shorts-button (#20) 2022-06-15 13:22:09 +02:00
6 changed files with 72 additions and 16 deletions

View File

@@ -1,3 +1,11 @@
## [1.4.1](https://github.com/revanced/revanced-patches/compare/v1.4.0...v1.4.1) (2022-06-15)
### Bug Fixes
* `hide-cast-button` patch ([6a9ffe0](https://github.com/revanced/revanced-patches/commit/6a9ffe05734a775a555e98cb365df96133f7cd8b))
* comments ([d102883](https://github.com/revanced/revanced-patches/commit/d1028831ca889f1214801174d1d75ce24505e7ba))
# [1.4.0](https://github.com/revanced/revanced-patches/compare/v1.3.1...v1.4.0) (2022-06-15)

View File

@@ -0,0 +1,13 @@
package app.revanced.patches.youtube.layout.castbutton.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.google.android.youtube", arrayOf()
)]
)
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class CastButtonCompatibility

View File

@@ -0,0 +1,44 @@
package app.revanced.patches.youtube.layout.castbutton.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.implementation.BytecodeData
import app.revanced.patcher.data.implementation.proxy
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.annotations.Dependencies
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.implementation.BytecodePatch
import app.revanced.patcher.patch.implementation.misc.PatchResult
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.youtube.layout.castbutton.annotations.CastButtonCompatibility
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
@Patch
@Dependencies(dependencies = [IntegrationsPatch::class])
@Name("hide-cast-button")
@Description("Patch to hide the cast button.")
@CastButtonCompatibility
@Version("0.0.1")
class HideCastButtonPatch : BytecodePatch(listOf()) {
override fun execute(data: BytecodeData): PatchResult {
data.classes.forEach { classDef ->
classDef.methods.forEach { method ->
if (classDef.type.endsWith("MediaRouteButton;") && method.name == "setVisibility") {
val implementation =
data.proxy(classDef).resolve().methods.first { it.name == "setVisibility" }.implementation!!
implementation.addInstructions(
0, """
invoke-static {p1}, Lfi/razerman/youtube/XGlobals;->getCastButtonOverrideV2(I)I
move-result p1
""".trimIndent().toInstructions("I", 2, false)
)
}
}
}
return PatchResultSuccess()
}
}

View File

@@ -18,7 +18,7 @@ import org.jf.dexlib2.iface.instruction.formats.Instruction11x
@Patch
@Dependencies(dependencies = [IntegrationsPatch::class])
@Name("shorts-button")
@Name("disable-shorts-button")
@Description("Hide the shorts button.")
@ShortsButtonCompatibility
@Version("0.0.1")

View File

@@ -15,6 +15,7 @@ import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
import app.revanced.patcher.util.smali.toInstruction
import app.revanced.patcher.util.smali.toInstructions
import app.revanced.patches.youtube.layout.castbutton.patch.HideCastButtonPatch
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
import app.revanced.patches.youtube.misc.microg.patch.resource.MicroGResourcePatch
import app.revanced.patches.youtube.misc.microg.patch.resource.enum.StringReplaceMode
@@ -24,13 +25,14 @@ import app.revanced.patches.youtube.misc.microg.signatures.*
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.builder.MutableMethodImplementation
import org.jf.dexlib2.builder.instruction.BuilderInstruction21c
import org.jf.dexlib2.builder.instruction.BuilderInstruction21s
import org.jf.dexlib2.iface.instruction.formats.Instruction21c
import org.jf.dexlib2.iface.reference.StringReference
import org.jf.dexlib2.immutable.reference.ImmutableStringReference
@Patch(include = false)
@Dependencies(dependencies = [MicroGResourcePatch::class])
@Dependencies(
dependencies = [MicroGResourcePatch::class, HideCastButtonPatch::class]
)
@Name("microg-support")
@Description("Patch to allow YouTube ReVanced to run without root and under a different package name.")
@MicroGPatchCompatibility
@@ -56,17 +58,6 @@ class MicroGBytecodePatch : BytecodePatch(
var proxiedImplementation: MutableMethodImplementation? = null
// disable cast button since it is unsupported by microg and causes battery issues
// the code is here instead of the fixCastIssues method because we do not need a signature this way
if (classDef.type.endsWith("MediaRouteButton;") && method.name == "setVisibility") {
proxiedClass = data.proxy(classDef).resolve()
proxiedImplementation = proxiedClass!!.methods.first { it.name == "setVisibility" }.implementation
proxiedImplementation!!.replaceInstruction(
0, BuilderInstruction21s(Opcode.CONST_16, 1, 8) // 8 == HIDDEN
)
}
implementation.instructions.forEachIndexed { i, instruction ->
if (instruction.opcode != Opcode.CONST_STRING) return@forEachIndexed

View File

@@ -3,5 +3,5 @@ package app.revanced.patches.youtube.misc.microg.shared
object Constants {
internal const val BASE_MICROG_PACKAGE_NAME = "com.mgoogle"
internal const val REVANCED_PACKAGE_NAME = "app.revanced.android.youtube"
internal const val REVANCED_APP_NAME = "YouTube ReVanced"
}
internal const val REVANCED_APP_NAME = "ReVanced"
}