mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-11-06 18:23:01 +00:00
rename setting to "YouTube restricted mode"
This commit is contained in:
@@ -137,7 +137,7 @@ public class App extends Application {
|
||||
getApplicationContext());
|
||||
final String key = getApplicationContext().getString(R.string.recaptcha_cookies_key);
|
||||
downloader.setCookie(ReCaptchaActivity.RECAPTCHA_COOKIES_KEY, prefs.getString(key, ""));
|
||||
downloader.updateRestrictedModeCookies(getApplicationContext());
|
||||
downloader.updateYoutubeRestrictedModeCookies(getApplicationContext());
|
||||
}
|
||||
|
||||
private void configureRxJavaErrorHandler() {
|
||||
|
||||
@@ -158,16 +158,16 @@ public final class DownloaderImpl extends Downloader {
|
||||
mCookies.remove(key);
|
||||
}
|
||||
|
||||
public void updateRestrictedModeCookies(final Context context) {
|
||||
public void updateYoutubeRestrictedModeCookies(final Context context) {
|
||||
String restrictedModeEnabledKey =
|
||||
context.getString(R.string.restricted_mode_enabled);
|
||||
context.getString(R.string.youtube_restricted_mode_enabled);
|
||||
boolean restrictedModeEnabled = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
.getBoolean(restrictedModeEnabledKey, false);
|
||||
updateRestrictedModeCookies(restrictedModeEnabled);
|
||||
updateYoutubeRestrictedModeCookies(restrictedModeEnabled);
|
||||
}
|
||||
|
||||
public void updateRestrictedModeCookies(final boolean restrictedModeEnabled) {
|
||||
if (restrictedModeEnabled) {
|
||||
public void updateYoutubeRestrictedModeCookies(final boolean youtubeRestrictedModeEnabled) {
|
||||
if (youtubeRestrictedModeEnabled) {
|
||||
setCookie(YOUTUBE_RESTRICTED_MODE_COOKIE_KEY,
|
||||
YOUTUBE_RESTRICTED_MODE_COOKIE);
|
||||
} else {
|
||||
|
||||
@@ -46,8 +46,8 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
|
||||
|
||||
private boolean hasTabsChanged = false;
|
||||
|
||||
private boolean previousRestrictedModeEnabled;
|
||||
private String restrictedModeEnabledKey;
|
||||
private boolean previousYoutubeRestrictedModeEnabled;
|
||||
private String youtubeRestrictedModeEnabledKey;
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
// Fragment's LifeCycle
|
||||
@@ -70,10 +70,10 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
|
||||
}
|
||||
});
|
||||
|
||||
restrictedModeEnabledKey = getString(R.string.restricted_mode_enabled);
|
||||
previousRestrictedModeEnabled =
|
||||
youtubeRestrictedModeEnabledKey = getString(R.string.youtube_restricted_mode_enabled);
|
||||
previousYoutubeRestrictedModeEnabled =
|
||||
PreferenceManager.getDefaultSharedPreferences(getContext())
|
||||
.getBoolean(restrictedModeEnabledKey, false);
|
||||
.getBoolean(youtubeRestrictedModeEnabledKey, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,11 +100,11 @@ public class MainFragment extends BaseFragment implements TabLayout.OnTabSelecte
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
boolean restrictedModeEnabled =
|
||||
boolean youtubeRestrictedModeEnabled =
|
||||
PreferenceManager.getDefaultSharedPreferences(getContext())
|
||||
.getBoolean(restrictedModeEnabledKey, false);
|
||||
if (previousRestrictedModeEnabled != restrictedModeEnabled) {
|
||||
previousRestrictedModeEnabled = restrictedModeEnabled;
|
||||
.getBoolean(youtubeRestrictedModeEnabledKey, false);
|
||||
if (previousYoutubeRestrictedModeEnabled != youtubeRestrictedModeEnabled) {
|
||||
previousYoutubeRestrictedModeEnabled = youtubeRestrictedModeEnabled;
|
||||
setupTabs();
|
||||
} else if (hasTabsChanged) {
|
||||
setupTabs();
|
||||
|
||||
@@ -58,7 +58,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
||||
private File newpipeSettings;
|
||||
|
||||
private String thumbnailLoadToggleKey;
|
||||
private String restrictedModeEnabledKey;
|
||||
private String youtubeRestrictedModeEnabledKey;
|
||||
|
||||
private Localization initialSelectedLocalization;
|
||||
private ContentCountry initialSelectedContentCountry;
|
||||
@@ -68,7 +68,7 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
||||
public void onCreate(@Nullable final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
thumbnailLoadToggleKey = getString(R.string.download_thumbnail_key);
|
||||
restrictedModeEnabledKey = getString(R.string.restricted_mode_enabled);
|
||||
youtubeRestrictedModeEnabledKey = getString(R.string.youtube_restricted_mode_enabled);
|
||||
|
||||
initialSelectedLocalization = org.schabi.newpipe.util.Localization
|
||||
.getPreferredLocalization(requireContext());
|
||||
@@ -90,10 +90,10 @@ public class ContentSettingsFragment extends BasePreferenceFragment {
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
if (preference.getKey().equals(restrictedModeEnabledKey)) {
|
||||
if (preference.getKey().equals(youtubeRestrictedModeEnabledKey)) {
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
DownloaderImpl.getInstance().updateRestrictedModeCookies(context);
|
||||
DownloaderImpl.getInstance().updateYoutubeRestrictedModeCookies(context);
|
||||
} else {
|
||||
Log.w(TAG, "onPreferenceTreeClick: null context");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user