Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Save autoplay state. Fixes #1781
Browse files Browse the repository at this point in the history
  • Loading branch information
bluemarvin committed Sep 6, 2019
1 parent d339e23 commit 329383c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -567,5 +567,15 @@ public void setDebugLoggingEnabled(boolean isEnabled) {
editor.putBoolean(mContext.getString(R.string.settings_key_debug_logging), isEnabled);
editor.commit();
}

public boolean isAutoplayEnabled() {
return mPrefs.getBoolean(mContext.getString(R.string.settings_key_autoplay), AUTOPLAY_ENABLED);
}

public void setAutoplayEnabled(boolean isEnabled) {
SharedPreferences.Editor editor = mPrefs.edit();
editor.putBoolean(mContext.getString(R.string.settings_key_autoplay), isEnabled);
editor.commit();
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public void setContext(Context context, Bundle aExtras) {
runtimeSettingsBuilder.displayDpiOverride(SettingsStore.getInstance(context).getDisplayDpi());
runtimeSettingsBuilder.screenSizeOverride(SettingsStore.getInstance(context).getMaxWindowWidth(),
SettingsStore.getInstance(context).getMaxWindowHeight());
runtimeSettingsBuilder.autoplayDefault(SettingsStore.getInstance(mContext).isAutoplayEnabled() ? GeckoRuntimeSettings.AUTOPLAY_DEFAULT_ALLOWED : GeckoRuntimeSettings.AUTOPLAY_DEFAULT_BLOCKED);

if (SettingsStore.getInstance(context).getTransparentBorderWidth() > 0) {
runtimeSettingsBuilder.useMaxScreenDepth(true);
Expand Down Expand Up @@ -218,6 +219,7 @@ public void setAutoplayEnabled(final boolean enabled) {
mRuntime.getSettings().setAutoplayDefault(enabled ?
GeckoRuntimeSettings.AUTOPLAY_DEFAULT_ALLOWED :
GeckoRuntimeSettings.AUTOPLAY_DEFAULT_BLOCKED);
SettingsStore.getInstance(mContext).setAutoplayEnabled(enabled);
}
}

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/non_L10n.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<string name="settings_key_browser_world_height" translatable="false">settings_browser_world_height</string>
<string name="settings_key_notifications" translatable="false">settings_key_notifications</string>
<string name="settings_key_debug_logging" translatable="false">settings_key_debug_logging</string>
<string name="settings_key_autoplay" translatable="false">settings_key_autoplay</string>
<string name="environment_override_help_url" translatable="false">https://github.com/MozillaReality/FirefoxReality/wiki/Environments</string>
<string name="private_policy_url" translatable="false">https://www.mozilla.org/privacy/firefox/</string>
<string name="private_report_url" translatable="false">https://mixedreality.mozilla.org/fxr/report?src=browser-fxr&amp;label=browser-firefox-reality&amp;url=%1$s</string>
Expand Down

0 comments on commit 329383c

Please sign in to comment.