mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 21:27:43 +02:00
refactor(music): renamed some patches description
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.ads.video.patch
|
||||
package app.revanced.patches.music.ads.music.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
@ -11,13 +11,13 @@ import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.music.utils.annotations.MusicCompatibility
|
||||
import app.revanced.patches.music.utils.litho.patch.LithoFilterPatch
|
||||
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.patches.shared.patch.videoads.AbstractVideoAdsPatch
|
||||
import app.revanced.patches.shared.patch.ads.AbstractAdsPatch
|
||||
import app.revanced.util.enum.CategoryType
|
||||
import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
|
||||
|
||||
@Patch
|
||||
@Name("hide-video-ads")
|
||||
@Description("Removes ads in the music video.")
|
||||
@Name("hide-music-ads")
|
||||
@Description("Hides ads before playing a music.")
|
||||
@DependsOn(
|
||||
[
|
||||
LithoFilterPatch::class,
|
||||
@ -26,7 +26,7 @@ import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
|
||||
)
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class VideoAdsPatch : AbstractVideoAdsPatch(
|
||||
class MusicAdsPatch : AbstractAdsPatch(
|
||||
"$MUSIC_ADS_PATH/HideMusicAdsPatch;->hideMusicAds()Z"
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
@ -21,7 +21,7 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("disable-auto-captions")
|
||||
@Description("Disable forced captions from automatically enabling in video player.")
|
||||
@Description("Disables forced auto captions.")
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.layout.blacknavbar.patch
|
||||
package app.revanced.patches.music.layout.blacknavigationbar.patch
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Description
|
||||
@ -21,7 +21,7 @@ import app.revanced.util.integrations.Constants.MUSIC_LAYOUT
|
||||
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch
|
||||
@Name("enable-black-navbar")
|
||||
@Name("enable-black-navigation-bar")
|
||||
@Description("Sets the navigation bar color to black.")
|
||||
@DependsOn(
|
||||
[
|
||||
@ -31,7 +31,7 @@ import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
)
|
||||
@MusicCompatibility
|
||||
@Version("0.0.1")
|
||||
class BlackNavbarPatch : BytecodePatch(
|
||||
class BlackNavigationBarPatch : BytecodePatch(
|
||||
listOf(TabLayoutFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
@ -43,7 +43,7 @@ class BlackNavbarPatch : BytecodePatch(
|
||||
|
||||
addInstructions(
|
||||
targetIndex + 1, """
|
||||
invoke-static {}, $MUSIC_LAYOUT->enableBlackNavbar()I
|
||||
invoke-static {}, $MUSIC_LAYOUT->enableBlackNavigationBar()I
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
@ -52,7 +52,7 @@ class BlackNavbarPatch : BytecodePatch(
|
||||
|
||||
SettingsPatch.addMusicPreference(
|
||||
CategoryType.LAYOUT,
|
||||
"revanced_enable_black_navbar",
|
||||
"revanced_enable_black_navigation_bar",
|
||||
"true"
|
||||
)
|
||||
|
@ -52,9 +52,10 @@ class ShareButtonHookPatch : BytecodePatch(
|
||||
|
||||
addInstructionsWithLabels(
|
||||
targetIndex, """
|
||||
invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->overrideSharePanel()Z
|
||||
invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->shouldHookShareButton()Z
|
||||
move-result p1
|
||||
if-eqz p1, :default
|
||||
invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->startDownloadActivity()V
|
||||
return-void
|
||||
""", ExternalLabel("default", getInstruction(targetIndex))
|
||||
)
|
||||
@ -87,7 +88,7 @@ class ShareButtonHookPatch : BytecodePatch(
|
||||
)
|
||||
SettingsPatch.addMusicPreferenceWithIntent(
|
||||
CategoryType.MISC,
|
||||
"revanced_default_downloader",
|
||||
"revanced_external_downloader_package_name",
|
||||
"revanced_hook_share_button"
|
||||
)
|
||||
|
||||
|
@ -21,6 +21,7 @@ import app.revanced.util.resources.MusicResourceHelper.addMusicPreferenceWithInt
|
||||
import app.revanced.util.resources.MusicResourceHelper.addReVancedMusicPreference
|
||||
import app.revanced.util.resources.MusicResourceHelper.sortMusicPreferenceCategory
|
||||
import app.revanced.util.resources.ResourceUtils
|
||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||
import org.w3c.dom.Element
|
||||
import java.io.File
|
||||
import java.nio.file.Paths
|
||||
@ -40,6 +41,20 @@ class SettingsPatch : AbstractSettingsResourcePatch(
|
||||
super.execute(context)
|
||||
contexts = context
|
||||
|
||||
/**
|
||||
* create directory for the untranslated language resources
|
||||
*/
|
||||
context["res/values-v21"].mkdirs()
|
||||
|
||||
arrayOf(
|
||||
ResourceUtils.ResourceGroup(
|
||||
"values-v21",
|
||||
"strings.xml"
|
||||
)
|
||||
).forEach { resourceGroup ->
|
||||
context.copyResources("music/settings", resourceGroup)
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy colors
|
||||
*/
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.shared.fingerprints.videoads
|
||||
package app.revanced.patches.shared.fingerprints.ads
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
@ -6,7 +6,7 @@ import org.jf.dexlib2.AccessFlags
|
||||
import org.jf.dexlib2.Opcode
|
||||
import org.jf.dexlib2.iface.instruction.NarrowLiteralInstruction
|
||||
|
||||
object LegacyVideoAdsFingerprint : MethodFingerprint(
|
||||
object LegacyAdsFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf(),
|
@ -1,8 +1,8 @@
|
||||
package app.revanced.patches.shared.fingerprints.videoads
|
||||
package app.revanced.patches.shared.fingerprints.ads
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
||||
object MainstreamVideoAdsFingerprint : MethodFingerprint(
|
||||
object MainstreamAdsFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
strings = listOf("markFillRequested", "requestEnterSlot")
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.shared.patch.videoads
|
||||
package app.revanced.patches.shared.patch.ads
|
||||
|
||||
import app.revanced.extensions.toErrorResult
|
||||
import app.revanced.patcher.annotation.Name
|
||||
@ -13,42 +13,42 @@ import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.shared.fingerprints.videoads.LegacyVideoAdsFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.videoads.MainstreamVideoAdsFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.ads.LegacyAdsFingerprint
|
||||
import app.revanced.patches.shared.fingerprints.ads.MainstreamAdsFingerprint
|
||||
|
||||
@Name("abstract-video-ads-patch")
|
||||
@Name("abstract-ads-patch")
|
||||
@Version("0.0.1")
|
||||
abstract class AbstractVideoAdsPatch(
|
||||
abstract class AbstractAdsPatch(
|
||||
private val descriptor: String
|
||||
) : BytecodePatch(
|
||||
listOf(
|
||||
LegacyVideoAdsFingerprint,
|
||||
MainstreamVideoAdsFingerprint
|
||||
LegacyAdsFingerprint,
|
||||
MainstreamAdsFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
LegacyVideoAdsFingerprint.result?.let {
|
||||
LegacyAdsFingerprint.result?.let {
|
||||
(context.toMethodWalker(it.method)
|
||||
.nextMethod(13, true)
|
||||
.getMethod() as MutableMethod).apply {
|
||||
addInstructions(
|
||||
0, """
|
||||
invoke-static {}, $descriptor
|
||||
move-result v1
|
||||
"""
|
||||
invoke-static {}, $descriptor
|
||||
move-result v1
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: return LegacyVideoAdsFingerprint.toErrorResult()
|
||||
} ?: return LegacyAdsFingerprint.toErrorResult()
|
||||
|
||||
MainstreamVideoAdsFingerprint.result?.let {
|
||||
MainstreamAdsFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
addInstructionsWithLabels(
|
||||
0, """
|
||||
invoke-static {}, $descriptor
|
||||
move-result v0
|
||||
if-nez v0, :show_video_ads
|
||||
if-nez v0, :show_ads
|
||||
return-void
|
||||
""", ExternalLabel("show_video_ads", getInstruction(0))
|
||||
""", ExternalLabel("show_ads", getInstruction(0))
|
||||
)
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@ 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.shared.patch.videoads.AbstractVideoAdsPatch
|
||||
import app.revanced.patches.shared.patch.ads.AbstractAdsPatch
|
||||
import app.revanced.patches.youtube.utils.annotations.YouTubeCompatibility
|
||||
import app.revanced.patches.youtube.utils.settings.resource.patch.SettingsPatch
|
||||
import app.revanced.util.integrations.Constants.ADS_PATH
|
||||
@ -19,7 +19,7 @@ import app.revanced.util.integrations.Constants.ADS_PATH
|
||||
@DependsOn([SettingsPatch::class])
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class VideoAdsPatch : AbstractVideoAdsPatch(
|
||||
class VideoAdsPatch : AbstractAdsPatch(
|
||||
"$ADS_PATH/HideVideoAdsPatch;->hideVideoAds()Z"
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
@ -1,11 +1,13 @@
|
||||
package app.revanced.patches.youtube.utils.litho.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
import org.jf.dexlib2.AccessFlags
|
||||
|
||||
object LithoFilterFingerprint : MethodFingerprint(
|
||||
customFingerprint = custom@{ method, classDef ->
|
||||
if (method.name != "<clinit>") return@custom false
|
||||
|
||||
classDef.type.endsWith("LithoFilterPatch;")
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC or AccessFlags.CONSTRUCTOR,
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.definingClass == "Lapp/revanced/integrations/patches/ads/LithoFilterPatch;"
|
||||
}
|
||||
)
|
Reference in New Issue
Block a user