feat(YouTube/Shorts components): add Fetch from rss feed setting

This commit is contained in:
inotia00 2024-05-02 23:59:59 +09:00
parent cccd2298dc
commit 5533f81167
3 changed files with 14 additions and 2 deletions

View File

@ -21,6 +21,7 @@ import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PAC
import app.revanced.patches.youtube.utils.fingerprints.TextComponentSpecFingerprint
import app.revanced.patches.youtube.utils.integrations.Constants.COMPONENTS_PATH
import app.revanced.patches.youtube.utils.integrations.Constants.SHORTS_CLASS_DESCRIPTOR
import app.revanced.patches.youtube.utils.integrations.Constants.UTILS_PATH
import app.revanced.patches.youtube.utils.playertype.PlayerTypeHookPatch
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch.ReelDynRemix
@ -68,10 +69,15 @@ object ShortsComponentPatch : BaseBytecodePatch(
TextComponentSpecFingerprint
)
) {
private const val INTEGRATION_CLASS_DESCRIPTOR =
"$UTILS_PATH/ReturnYouTubeChannelNamePatch;"
private const val BUTTON_FILTER_CLASS_DESCRIPTOR =
"$COMPONENTS_PATH/ShortsButtonFilter;"
private const val SHELF_FILTER_CLASS_DESCRIPTOR =
"$COMPONENTS_PATH/ShortsShelfFilter;"
private const val RETURN_YOUTUBE_CHANNEL_NAME_FILTER_CLASS_DESCRIPTOR =
"$COMPONENTS_PATH/ReturnYouTubeChannelNameFilterPatch;"
override fun execute(context: BytecodeContext) {
@ -258,7 +264,7 @@ object ShortsComponentPatch : BaseBytecodePatch(
addInstructions(
insertIndex + 1, """
invoke-static {v$conversionContextRegister, v$charSequenceRegister}, $SHORTS_CLASS_DESCRIPTOR->onCharSequenceLoaded(Ljava/lang/Object;Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
invoke-static {v$conversionContextRegister, v$charSequenceRegister}, $INTEGRATION_CLASS_DESCRIPTOR->onCharSequenceLoaded(Ljava/lang/Object;Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
move-result-object v$charSequenceRegister
invoke-static {v$charSequenceRegister}, $replaceReference
"""
@ -267,12 +273,13 @@ object ShortsComponentPatch : BaseBytecodePatch(
}
}
VideoInformationPatch.hookShorts("$SHORTS_CLASS_DESCRIPTOR->newShortsVideoStarted(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;JZ)V")
VideoInformationPatch.hookShorts("$INTEGRATION_CLASS_DESCRIPTOR->newShortsVideoStarted(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;JZ)V")
// endregion
LithoFilterPatch.addFilter(BUTTON_FILTER_CLASS_DESCRIPTOR)
LithoFilterPatch.addFilter(SHELF_FILTER_CLASS_DESCRIPTOR)
LithoFilterPatch.addFilter(RETURN_YOUTUBE_CHANNEL_NAME_FILTER_CLASS_DESCRIPTOR)
/**
* Add settings

View File

@ -987,6 +987,10 @@ Limitation: Official headers in search results will be hidden."</string>
<string name="revanced_return_shorts_channel_name_title">Return shorts channel name</string>
<string name="revanced_return_shorts_channel_name_summary_on">Channel name is used.</string>
<string name="revanced_return_shorts_channel_name_summary_off">Channel handle is used.</string>
<string name="revanced_return_shorts_channel_name_fetch_title">Fetch from rss feed</string>
<string name="revanced_return_shorts_channel_name_fetch_summary_on">"Use the channel name taken from RSS feed.
It may take longer to fetch the channel name."</string>
<string name="revanced_return_shorts_channel_name_fetch_summary_off">"Use YouTube's built-in channel name."</string>
<!-- PreferenceScreen: Swipe controls -->

View File

@ -431,6 +431,7 @@
<SwitchPreference android:title="@string/revanced_hide_shorts_toolbar_title" android:key="revanced_hide_shorts_toolbar" android:defaultValue="false" android:summaryOn="@string/revanced_hide_shorts_toolbar_summary_on" android:summaryOff="@string/revanced_hide_shorts_toolbar_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_shorts_navigation_bar_title" android:key="revanced_hide_shorts_navigation_bar" android:defaultValue="false" android:summaryOn="@string/revanced_hide_shorts_navigation_bar_summary_on" android:summaryOff="@string/revanced_hide_shorts_navigation_bar_summary_off" />
<SwitchPreference android:title="@string/revanced_return_shorts_channel_name_title" android:key="revanced_return_shorts_channel_name" android:defaultValue="false" android:summaryOn="@string/revanced_return_shorts_channel_name_summary_on" android:summaryOff="@string/revanced_return_shorts_channel_name_summary_off" />
<SwitchPreference android:title="@string/revanced_return_shorts_channel_name_fetch_title" android:key="revanced_return_shorts_channel_name_fetch" android:defaultValue="false" android:summaryOn="@string/revanced_return_shorts_channel_name_fetch_summary_on" android:summaryOff="@string/revanced_return_shorts_channel_name_fetch_summary_off" />
</PreferenceScreen>SETTINGS: SHORTS_COMPONENTS -->
<!-- SETTINGS: CHANGE_SHORTS_REPEAT_STATE