generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(YouTube): Add
Open videos fullscreen
patch (#4069)
Co-authored-by: oSumAtrIX <[email protected]>
- Loading branch information
1 parent
0b2af47
commit 296d63b
Showing
12 changed files
with
136 additions
and
72 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
...ns/youtube/src/main/java/app/revanced/extension/youtube/patches/OpenVideosFullscreen.java
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,14 @@ | ||
package app.revanced.extension.youtube.patches; | ||
|
||
import app.revanced.extension.youtube.settings.Settings; | ||
|
||
@SuppressWarnings("unused") | ||
public class OpenVideosFullscreen { | ||
|
||
/** | ||
* Injection point. | ||
*/ | ||
public static boolean openVideoFullscreenPortrait(boolean original) { | ||
return Settings.OPEN_VIDEOS_FULLSCREEN_PORTRAIT.get(); | ||
} | ||
} |
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
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
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
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
16 changes: 16 additions & 0 deletions
16
...hes/src/main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/Fingerprints.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,16 @@ | ||
package app.revanced.patches.youtube.layout.player.fullscreen | ||
|
||
import app.revanced.patcher.fingerprint | ||
import app.revanced.util.literal | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
internal const val OPEN_VIDEOS_FULLSCREEN_PORTRAIT_FEATURE_FLAG = 45666112L | ||
|
||
internal val openVideosFullscreenPortraitFingerprint = fingerprint { | ||
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL) | ||
returns("V") | ||
parameters("L", "Lj\$/util/Optional;") | ||
literal { | ||
OPEN_VIDEOS_FULLSCREEN_PORTRAIT_FEATURE_FLAG | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...main/kotlin/app/revanced/patches/youtube/layout/player/fullscreen/OpenVideosFullscreen.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,46 @@ | ||
package app.revanced.patches.youtube.layout.player.fullscreen | ||
|
||
import app.revanced.patcher.patch.bytecodePatch | ||
import app.revanced.patches.all.misc.resources.addResources | ||
import app.revanced.patches.all.misc.resources.addResourcesPatch | ||
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference | ||
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch | ||
import app.revanced.patches.youtube.misc.settings.PreferenceScreen | ||
import app.revanced.patches.youtube.misc.settings.settingsPatch | ||
import app.revanced.util.insertFeatureFlagBooleanOverride | ||
|
||
private const val EXTENSION_CLASS_DESCRIPTOR = | ||
"Lapp/revanced/extension/youtube/patches/OpenVideosFullscreen;" | ||
|
||
@Suppress("unused") | ||
val openVideosFullscreenPatch = bytecodePatch( | ||
name = "Open videos fullscreen", | ||
description = "Adds an option to open videos in full screen portrait mode.", | ||
) { | ||
dependsOn( | ||
sharedExtensionPatch, | ||
settingsPatch, | ||
addResourcesPatch, | ||
) | ||
|
||
compatibleWith( | ||
"com.google.android.youtube"( | ||
"19.46.42", | ||
) | ||
) | ||
|
||
execute { | ||
openVideosFullscreenPortraitFingerprint.method.insertFeatureFlagBooleanOverride( | ||
OPEN_VIDEOS_FULLSCREEN_PORTRAIT_FEATURE_FLAG, | ||
"$EXTENSION_CLASS_DESCRIPTOR->openVideoFullscreenPortrait(Z)Z" | ||
) | ||
|
||
// Add resources and setting last, in case the user force patches an old incompatible version. | ||
|
||
addResources("youtube", "layout.player.fullscreen.openVideosFullscreen") | ||
|
||
PreferenceScreen.PLAYER.addPreferences( | ||
SwitchPreference("revanced_open_videos_fullscreen_portrait") | ||
) | ||
} | ||
} |
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
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
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
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
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