generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
OxrxL
committed
Oct 25, 2022
1 parent
4f99a29
commit f0f6c52
Showing
3 changed files
with
66 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
.../kotlin/app/revanced/patches/youtube/layout/comments/annotations/CommentsCompatibility.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package app.revanced.patches.youtube.layout.comments.annotations | ||
|
||
import app.revanced.patcher.annotation.Compatibility | ||
import app.revanced.patcher.annotation.Package | ||
|
||
@Compatibility( | ||
[Package( | ||
"com.google.android.youtube", arrayOf("17.25.34", "17.26.35", "17.27.39", "17.28.34", "17.29.34", "17.32.35", "17.33.42", "17.34.35", "17.34.36", "17.36.37") | ||
)] | ||
) | ||
@Target(AnnotationTarget.CLASS) | ||
@Retention(AnnotationRetention.RUNTIME) | ||
internal annotation class CommentsCompatibility |
53 changes: 53 additions & 0 deletions
53
src/main/kotlin/app/revanced/patches/youtube/layout/comments/patch/CommentsPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package app.revanced.patches.youtube.layout.comments.patch | ||
|
||
import app.revanced.patcher.annotation.Description | ||
import app.revanced.patcher.annotation.Name | ||
import app.revanced.patcher.annotation.Version | ||
import app.revanced.patcher.data.ResourceContext | ||
import app.revanced.patcher.patch.PatchResult | ||
import app.revanced.patcher.patch.PatchResultSuccess | ||
import app.revanced.patcher.patch.ResourcePatch | ||
import app.revanced.patcher.patch.annotations.DependsOn | ||
import app.revanced.patcher.patch.annotations.Patch | ||
import app.revanced.patches.youtube.ad.general.bytecode.patch.GeneralBytecodeAdsPatch | ||
import app.revanced.patches.youtube.layout.comments.annotations.CommentsCompatibility | ||
import app.revanced.patches.youtube.misc.mapping.patch.ResourceMappingResourcePatch | ||
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch | ||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.PreferenceScreen | ||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.StringResource | ||
import app.revanced.patches.youtube.misc.settings.framework.components.impl.SwitchPreference | ||
|
||
@Patch | ||
@DependsOn([ResourceMappingResourcePatch::class, GeneralBytecodeAdsPatch::class]) | ||
@Name("comments") | ||
@Description("Hides comments components below the video player.") | ||
@CommentsCompatibility | ||
@Version("0.0.1") | ||
class CommentsPatch : ResourcePatch { | ||
override fun execute(context: ResourceContext): PatchResult { | ||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences( | ||
PreferenceScreen( | ||
"revanced_comments", | ||
StringResource("revanced_comments_title", "Comments"), | ||
listOf( | ||
SwitchPreference( | ||
"revanced_hide_comments_section", | ||
StringResource("revanced_hide_comments_section_title", "Remove comments section"), | ||
false, | ||
StringResource("revanced_hide_comments_section_summary_on", "Comment section is hidden"), | ||
StringResource("revanced_hide_comments_section_summary_off", "Comment section is shown") | ||
), | ||
SwitchPreference( | ||
"revanced_hide_preview_comment", | ||
StringResource("revanced_hide_preview_comment_title", "Hide preview comment"), | ||
false, | ||
StringResource("revanced_hide_preview_comment_on", "Preview comment is hidden"), | ||
StringResource("revanced_hide_preview_comment_off", "Preview comment is shown") | ||
), | ||
), | ||
StringResource("revanced_comments_summary", "Manage the visibility of comments section components") | ||
) | ||
) | ||
return PatchResultSuccess() | ||
} | ||
} |