Skip to content
This repository was archived by the owner on Oct 26, 2024. It is now read-only.

Commit 4cbe833

Browse files
johnconner122oSumAtrIX
authored andcommitted
feat(youtube): open-links-externally patch
1 parent d65a107 commit 4cbe833

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package app.revanced.integrations.patches;
2+
3+
import app.revanced.integrations.settings.SettingsEnum;
4+
5+
public class OpenLinksExternallyPatch {
6+
/**
7+
* Override 'android.support.customtabs.action.CustomTabsService',
8+
* in order to open links in the default browser. This is done by returning an empty string,
9+
* for the service that handles custom tabs in the Android support library
10+
* which opens links in the default service instead.
11+
*
12+
* @param original The original custom tabs service.
13+
* @return The new, default service to open links with or the original service.
14+
*/
15+
public static String enableExternalBrowser(String original) {
16+
if (SettingsEnum.ENABLE_EXTERNAL_BROWSER.getBoolean()) original = "";
17+
return original;
18+
}
19+
}

app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public enum SettingsEnum {
100100
ENABLE_MINIMIZED_PLAYBACK("revanced_enable_minimized_playback", true, ReturnType.BOOLEAN),
101101
OPEN_LINKS_DIRECTLY("revanced_uri_redirect", true, ReturnType.BOOLEAN, true),
102102
DISABLE_ZOOM_HAPTICS("revanced_disable_zoom_haptics", true, ReturnType.BOOLEAN, false),
103+
ENABLE_EXTERNAL_BROWSER("revanced_enable_external_browser", true, ReturnType.BOOLEAN, true),
103104

104105
// Swipe controls
105106
ENABLE_SWIPE_BRIGHTNESS("revanced_enable_swipe_brightness", true, ReturnType.BOOLEAN),

0 commit comments

Comments
 (0)