Skip to content

Commit

Permalink
feat: Add channel page setting
Browse files Browse the repository at this point in the history
  • Loading branch information
LisoUseInAIKyrios committed Mar 28, 2024
1 parent 2dfb1cb commit d94a640
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import app.revanced.patches.youtube.layout.thumbnails.fingerprints.cronet.reques
import app.revanced.patches.youtube.layout.thumbnails.fingerprints.cronet.request.callback.OnResponseStartedFingerprint
import app.revanced.patches.youtube.layout.thumbnails.fingerprints.cronet.request.callback.OnSucceededFingerprint
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
import app.revanced.patches.youtube.misc.litho.filter.LithoFilterPatch
import app.revanced.patches.youtube.misc.navigation.NavigationBarHookPatch
import app.revanced.patches.youtube.misc.playertype.PlayerTypeHookPatch
import app.revanced.patches.youtube.misc.settings.SettingsPatch
Expand All @@ -41,7 +42,8 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
SettingsPatch::class,
AddResourcesPatch::class,
NavigationBarHookPatch::class,
PlayerTypeHookPatch::class
PlayerTypeHookPatch::class,
LithoFilterPatch::class
],
compatiblePackages = [
CompatiblePackage(
Expand Down Expand Up @@ -79,6 +81,9 @@ object AlternativeThumbnailsPatch : BytecodePatch(
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
"Lapp/revanced/integrations/youtube/patches/AlternativeThumbnailsPatch;"

private const val FILTER_CLASS_DESCRIPTOR =
"Lapp/revanced/integrations/youtube/patches/components/AlternativeThumbnailsFilter;"

private lateinit var loadImageUrlMethod: MutableMethod
private var loadImageUrlIndex = 0

Expand Down Expand Up @@ -149,6 +154,11 @@ object AlternativeThumbnailsPatch : BytecodePatch(
entriesKey = entries,
entryValuesKey = values
),
ListPreference("revanced_alt_thumbnail_channel_pages",
summaryKey = null,
entriesKey = entries,
entryValuesKey = values
),
ListPreference("revanced_alt_thumbnail_history",
summaryKey = null,
entriesKey = entries,
Expand All @@ -167,6 +177,8 @@ object AlternativeThumbnailsPatch : BytecodePatch(
ListPreference("revanced_alt_thumbnail_stills_time", summaryKey = null)
)

LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)

fun MethodFingerprint.alsoResolve(fingerprint: MethodFingerprint) =
also { resolve(context, fingerprint.resultOrThrow().classDef) }.resultOrThrow()

Expand Down Expand Up @@ -221,7 +233,7 @@ object AlternativeThumbnailsPatch : BytecodePatch(
return-object v0
""",
)
},
}
)
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/addresources/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,7 @@
<string name="revanced_alt_thumbnail_home_title">Thumbnails for home feed</string>
<string name="revanced_alt_thumbnail_subscription_title">Thumbnails for subscription tab</string>
<string name="revanced_alt_thumbnail_search_title">Thumbnails for search results</string>
<string name="revanced_alt_thumbnail_channel_pages_title">Thumbnails for channel pages</string>
<string name="revanced_alt_thumbnail_history_title">Thumbnails for watch history</string>
<string name="revanced_alt_thumbnail_options_entry_1">Original thumbnails</string>
<string name="revanced_alt_thumbnail_options_entry_2">DeArrow &amp; Original thumbnails</string>
Expand Down

0 comments on commit d94a640

Please sign in to comment.