From 3fb9cf01c54bd3623b6f9bd9dcbe01fb2b4e7adc Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Wed, 20 Mar 2024 03:46:43 +0900 Subject: [PATCH] fix(YouTube Music/Intent hook): infinite loop due to dependency conflict --- .../music/actionbar/component/ActionBarComponentPatch.kt | 2 -- .../music/misc/spoofappversion/SpoofAppVersionPatch.kt | 2 -- .../patches/music/utils/intenthook/IntentHookPatch.kt | 7 +++++-- .../patches/music/utils/sponsorblock/SponsorBlockPatch.kt | 2 -- .../music/video/customspeed/CustomPlaybackSpeedPatch.kt | 3 +-- .../revanced/patches/music/video/videoid/VideoIdPatch.kt | 1 - 6 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/main/kotlin/app/revanced/patches/music/actionbar/component/ActionBarComponentPatch.kt b/src/main/kotlin/app/revanced/patches/music/actionbar/component/ActionBarComponentPatch.kt index 162feb5a7..d0879f187 100644 --- a/src/main/kotlin/app/revanced/patches/music/actionbar/component/ActionBarComponentPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/actionbar/component/ActionBarComponentPatch.kt @@ -14,7 +14,6 @@ import app.revanced.patches.music.actionbar.component.fingerprints.ActionBarComp import app.revanced.patches.music.actionbar.component.fingerprints.LikeDislikeContainerFingerprint import app.revanced.patches.music.actionbar.component.fingerprints.LikeDislikeContainerVisibilityFingerprint import app.revanced.patches.music.utils.integrations.Constants.ACTIONBAR -import app.revanced.patches.music.utils.intenthook.IntentHookPatch import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.LikeDislikeContainer import app.revanced.patches.music.utils.settings.CategoryType @@ -34,7 +33,6 @@ import kotlin.math.min name = "Hide action bar component", description = "Adds options to hide action bar components and replace the offline download button with an external download button.", dependencies = [ - IntentHookPatch::class, SettingsPatch::class, SharedResourceIdPatch::class, VideoInformationPatch::class diff --git a/src/main/kotlin/app/revanced/patches/music/misc/spoofappversion/SpoofAppVersionPatch.kt b/src/main/kotlin/app/revanced/patches/music/misc/spoofappversion/SpoofAppVersionPatch.kt index 7a13da058..883913940 100644 --- a/src/main/kotlin/app/revanced/patches/music/misc/spoofappversion/SpoofAppVersionPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/misc/spoofappversion/SpoofAppVersionPatch.kt @@ -5,7 +5,6 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.music.general.oldstylelibraryshelf.OldStyleLibraryShelfPatch import app.revanced.patches.music.utils.integrations.Constants.MISC_PATH -import app.revanced.patches.music.utils.intenthook.IntentHookPatch import app.revanced.patches.music.utils.settings.CategoryType import app.revanced.patches.music.utils.settings.SettingsPatch import app.revanced.patches.music.utils.settings.SettingsPatch.contexts @@ -17,7 +16,6 @@ import app.revanced.util.copyXmlNode description = "Adds options to spoof the YouTube Music client version. " + "This can remove the radio mode restriction in Canadian regions or disable real-time lyrics.", dependencies = [ - IntentHookPatch::class, OldStyleLibraryShelfPatch::class, SettingsPatch::class ], diff --git a/src/main/kotlin/app/revanced/patches/music/utils/intenthook/IntentHookPatch.kt b/src/main/kotlin/app/revanced/patches/music/utils/intenthook/IntentHookPatch.kt index 0ff85da41..d7019316f 100644 --- a/src/main/kotlin/app/revanced/patches/music/utils/intenthook/IntentHookPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/utils/intenthook/IntentHookPatch.kt @@ -7,11 +7,14 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patches.music.utils.integrations.Constants.INTEGRATIONS_PATH +import app.revanced.patches.music.utils.integrations.IntegrationsPatch import app.revanced.patches.music.utils.intenthook.fingerprints.GoogleApiActivityFingerprint -import app.revanced.patches.music.utils.settings.SettingsPatch import app.revanced.util.exception -@Patch(dependencies = [SettingsPatch::class]) +@Patch( + dependencies = [IntegrationsPatch::class], + requiresIntegrations = true +) object IntentHookPatch : BytecodePatch( setOf(GoogleApiActivityFingerprint) ) { diff --git a/src/main/kotlin/app/revanced/patches/music/utils/sponsorblock/SponsorBlockPatch.kt b/src/main/kotlin/app/revanced/patches/music/utils/sponsorblock/SponsorBlockPatch.kt index 4376f3c58..59ad7747c 100644 --- a/src/main/kotlin/app/revanced/patches/music/utils/sponsorblock/SponsorBlockPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/utils/sponsorblock/SponsorBlockPatch.kt @@ -4,7 +4,6 @@ import app.revanced.patcher.data.ResourceContext import app.revanced.patcher.patch.ResourcePatch import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch -import app.revanced.patches.music.utils.intenthook.IntentHookPatch import app.revanced.patches.music.utils.settings.ResourceUtils import app.revanced.patches.music.utils.settings.ResourceUtils.hookPreference import app.revanced.patches.music.utils.settings.SettingsPatch @@ -15,7 +14,6 @@ import app.revanced.util.copyResources name = "SponsorBlock", description = "Adds options to enable and configure SponsorBlock, which can skip undesired video segments such as non-music sections.", dependencies = [ - IntentHookPatch::class, SettingsPatch::class, SponsorBlockBytecodePatch::class ], diff --git a/src/main/kotlin/app/revanced/patches/music/video/customspeed/CustomPlaybackSpeedPatch.kt b/src/main/kotlin/app/revanced/patches/music/video/customspeed/CustomPlaybackSpeedPatch.kt index fab2ad69f..904503bee 100644 --- a/src/main/kotlin/app/revanced/patches/music/video/customspeed/CustomPlaybackSpeedPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/video/customspeed/CustomPlaybackSpeedPatch.kt @@ -4,7 +4,6 @@ import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.Patch import app.revanced.patches.music.utils.integrations.Constants.VIDEO_PATH -import app.revanced.patches.music.utils.intenthook.IntentHookPatch import app.revanced.patches.music.utils.settings.CategoryType import app.revanced.patches.music.utils.settings.SettingsPatch import app.revanced.patches.shared.patch.customspeed.AbstractCustomPlaybackSpeedPatch @@ -12,7 +11,7 @@ import app.revanced.patches.shared.patch.customspeed.AbstractCustomPlaybackSpeed @Patch( name = "Custom playback speed", description = "Adds an option to customize available playback speeds.", - dependencies = [IntentHookPatch::class], + dependencies = [SettingsPatch::class], compatiblePackages = [ CompatiblePackage( "com.google.android.apps.youtube.music", diff --git a/src/main/kotlin/app/revanced/patches/music/video/videoid/VideoIdPatch.kt b/src/main/kotlin/app/revanced/patches/music/video/videoid/VideoIdPatch.kt index ba8a34127..63e2e8474 100644 --- a/src/main/kotlin/app/revanced/patches/music/video/videoid/VideoIdPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/video/videoid/VideoIdPatch.kt @@ -2,7 +2,6 @@ package app.revanced.patches.music.video.videoid import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.extensions.InstructionExtensions.addInstruction -import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction