feat(YouTube/YT Music): add Return YouTube Username patch

This commit is contained in:
inotia00
2024-10-13 22:54:56 +09:00
parent 504998f326
commit 9733b6090d
13 changed files with 179 additions and 3 deletions

View File

@ -195,6 +195,7 @@ object VisualPreferencesIconsPatch : BaseResourcePatch(
"revanced_preference_screen_swipe_controls",
"revanced_preference_screen_video",
"revanced_preference_screen_ryd",
"revanced_preference_screen_return_youtube_username",
"revanced_preference_screen_sb",
"revanced_preference_screen_misc",
)

View File

@ -0,0 +1,34 @@
package app.revanced.patches.youtube.utils.returnyoutubeusername
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patches.shared.returnyoutubeusername.BaseReturnYouTubeUsernamePatch
import app.revanced.patches.youtube.utils.compatibility.Constants.COMPATIBLE_PACKAGE
import app.revanced.patches.youtube.utils.settings.SettingsPatch
import app.revanced.util.patch.BaseBytecodePatch
@Suppress("unused")
object ReturnYouTubeUsernamePatch : BaseBytecodePatch(
name = "Return YouTube Username",
description = "Adds option to replace YouTube Handle with Username in comments using YouTube Data API v3.",
dependencies = setOf(
BaseReturnYouTubeUsernamePatch::class,
SettingsPatch::class,
),
compatiblePackages = COMPATIBLE_PACKAGE,
use = false
) {
override fun execute(context: BytecodeContext) {
/**
* Add settings
*/
SettingsPatch.addPreference(
arrayOf(
"PREFERENCE_SCREEN: RETURN_YOUTUBE_USERNAME"
)
)
SettingsPatch.updatePatchStatus(this)
}
}

View File

@ -8,8 +8,8 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.shared.integrations.Constants.INTEGRATIONS_UTILS_CLASS_DESCRIPTOR
import app.revanced.patches.shared.integrations.Constants.INTEGRATIONS_UTILS_PATH
import app.revanced.patches.shared.mapping.ResourceMappingPatch
import app.revanced.patches.youtube.utils.integrations.Constants.INTEGRATIONS_PATH
import app.revanced.patches.youtube.utils.integrations.Constants.UTILS_PATH
import app.revanced.patches.youtube.utils.mainactivity.MainActivityResolvePatch
import app.revanced.patches.youtube.utils.resourceid.SharedResourceIdPatch
@ -31,7 +31,7 @@ object SettingsBytecodePatch : BytecodePatch(
"$UTILS_PATH/InitializationPatch;"
private const val INTEGRATIONS_THEME_METHOD_DESCRIPTOR =
"$INTEGRATIONS_PATH/utils/ThemeUtils;->setTheme(Ljava/lang/Enum;)V"
"$INTEGRATIONS_UTILS_PATH/BaseThemeUtils;->setTheme(Ljava/lang/Enum;)V"
internal lateinit var contexts: BytecodeContext