11
11
import org .apache .commons .lang3 .BooleanUtils ;
12
12
import org .apache .commons .lang3 .StringUtils ;
13
13
14
+ import app .revanced .integrations .shared .settings .Setting ;
14
15
import app .revanced .integrations .shared .utils .Logger ;
15
16
import app .revanced .integrations .youtube .settings .Settings ;
16
17
@@ -86,6 +87,7 @@ private boolean isIntentAction() {
86
87
private static final String ACTION_MAIN = "android.intent.action.MAIN" ;
87
88
88
89
private static final StartPage START_PAGE = Settings .CHANGE_START_PAGE .get ();
90
+ private static final boolean ALWAYS_CHANGE_START_PAGE = Settings .CHANGE_START_PAGE_TYPE .get ();
89
91
90
92
/**
91
93
* There is an issue where the back button on the toolbar doesn't work properly.
@@ -97,7 +99,7 @@ public static String overrideBrowseId(@NonNull String original) {
97
99
if (!START_PAGE .isBrowseId ()) {
98
100
return original ;
99
101
}
100
- if (appLaunched ) {
102
+ if (! ALWAYS_CHANGE_START_PAGE && appLaunched ) {
101
103
Logger .printDebug (() -> "Ignore override browseId as the app already launched" );
102
104
return original ;
103
105
}
@@ -117,14 +119,16 @@ public static void overrideIntentAction(@NonNull Intent intent) {
117
119
" as the current activity is not the entry point of the application" );
118
120
return ;
119
121
}
120
- if (appLaunched ) {
121
- Logger .printDebug (() -> "Ignore override intent action as the app already launched" );
122
- return ;
123
- }
124
- appLaunched = true ;
125
122
126
123
final String intentAction = START_PAGE .id ;
127
124
Logger .printDebug (() -> "Changing intent action to " + intentAction );
128
125
intent .setAction (intentAction );
129
126
}
127
+
128
+ public static final class ChangeStartPageTypeAvailability implements Setting .Availability {
129
+ @ Override
130
+ public boolean isAvailable () {
131
+ return Settings .CHANGE_START_PAGE .get () != StartPage .ORIGINAL ;
132
+ }
133
+ }
130
134
}
0 commit comments