diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/bytecode/patch/CopyVideoUrlBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/bytecode/patch/CopyVideoUrlBytecodePatch.kt index ee9d281e6..46823e409 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/bytecode/patch/CopyVideoUrlBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/bytecode/patch/CopyVideoUrlBytecodePatch.kt @@ -26,8 +26,7 @@ import app.revanced.patches.youtube.video.information.patch.VideoInformationPatc @Version("0.0.1") class CopyVideoUrlBytecodePatch : BytecodePatch() { private companion object { - const val INTEGRATIONS_PACKAGE = "Lapp/revanced/integrations" - const val INTEGRATIONS_PLAYER_PACKAGE = "$INTEGRATIONS_PACKAGE/videoplayer" + const val INTEGRATIONS_PLAYER_PACKAGE = "Lapp/revanced/integrations/videoplayer" val BUTTONS_DESCRIPTORS = listOf( "$INTEGRATIONS_PLAYER_PACKAGE/CopyVideoUrlButton;", "$INTEGRATIONS_PLAYER_PACKAGE/CopyVideoUrlTimestampButton;" @@ -38,10 +37,8 @@ class CopyVideoUrlBytecodePatch : BytecodePatch() { // Initialize buttons and inject visibility control BUTTONS_DESCRIPTORS.forEach { descriptor -> - val initializeButtonDescriptor = "$descriptor->initializeButton(Ljava/lang/Object;)V" - val visibilityDescriptor = "$descriptor->changeVisibility(Z)V" - PlayerControlsBytecodePatch.initializeControl(initializeButtonDescriptor) - PlayerControlsBytecodePatch.injectVisibilityCheckCall(visibilityDescriptor) + PlayerControlsBytecodePatch.initializeControl("$descriptor->initializeButton(Landroid/view/View;)V") + PlayerControlsBytecodePatch.injectVisibilityCheckCall("$descriptor->changeVisibility(Z)V") } return PatchResultSuccess() diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/resource/patch/CopyVideoUrlResourcePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/resource/patch/CopyVideoUrlResourcePatch.kt index e5a34b91f..3d0124fd4 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/resource/patch/CopyVideoUrlResourcePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/copyvideourl/resource/patch/CopyVideoUrlResourcePatch.kt @@ -14,6 +14,7 @@ import app.revanced.patches.youtube.misc.playercontrols.resource.patch.BottomCon import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch import app.revanced.util.resources.ResourceUtils import app.revanced.util.resources.ResourceUtils.copyResources +import app.revanced.util.resources.ResourceUtils.mergeStrings @Name("copy-video-url-resource") @DependsOn([BottomControlsResourcePatch::class, SettingsPatch::class]) @@ -28,13 +29,13 @@ class 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, click to copy video URL without 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, click to copy video URL with 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") ) ), @@ -48,6 +49,9 @@ class CopyVideoUrlResourcePatch : ResourcePatch { "revanced_yt_copy_timestamp.xml" )) + // merge strings + context.mergeStrings("copyvideourl/host/values/strings.xml") + BottomControlsResourcePatch.addControls("copyvideourl/host/layout/${BottomControlsResourcePatch.TARGET_RESOURCE_NAME}") return PatchResultSuccess() diff --git a/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/bytecode/patch/DownloadsBytecodePatch.kt b/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/bytecode/patch/DownloadsBytecodePatch.kt index ab2e4eef6..d296b396f 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/bytecode/patch/DownloadsBytecodePatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/interaction/downloads/bytecode/patch/DownloadsBytecodePatch.kt @@ -21,23 +21,24 @@ import app.revanced.patches.youtube.video.information.patch.VideoInformationPatc @DownloadsCompatibility @Version("0.0.1") class DownloadsBytecodePatch : BytecodePatch() { - override fun execute(context: BytecodeContext): PatchResult { - val integrationsPackage = "app/revanced/integrations" - val classDescriptor = "L$integrationsPackage/videoplayer/DownloadButton;" + private companion object { + const val BUTTON_DESCRIPTOR = "Lapp/revanced/integrations/videoplayer/DownloadButton;" + } + override fun execute(context: BytecodeContext): PatchResult { /* initialize the control */ - val initializeDownloadsDescriptor = "$classDescriptor->initializeButton(Ljava/lang/Object;)V" - PlayerControlsBytecodePatch.initializeControl(initializeDownloadsDescriptor) + PlayerControlsBytecodePatch.initializeControl( + "$BUTTON_DESCRIPTOR->initializeButton(Landroid/view/View;)V") /* add code to change the visibility of the control */ - val changeVisibilityDescriptor = "$classDescriptor->changeVisibility(Z)V" - PlayerControlsBytecodePatch.injectVisibilityCheckCall(changeVisibilityDescriptor) + PlayerControlsBytecodePatch.injectVisibilityCheckCall( + "$BUTTON_DESCRIPTOR->changeVisibility(Z)V") return PatchResultSuccess() } diff --git a/src/main/resources/copyvideourl/host/values/strings.xml b/src/main/resources/copyvideourl/host/values/strings.xml new file mode 100644 index 000000000..8452816c3 --- /dev/null +++ b/src/main/resources/copyvideourl/host/values/strings.xml @@ -0,0 +1,5 @@ + + + URL copied to clipboard + URL with timestamp copied +