Skip to content

Commit

Permalink
Save autoplay state. Fixes #1781 (#1785)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluemarvin authored and MortimerGoro committed Sep 6, 2019
1 parent d339e23 commit b7ea5d9
Show file tree
Hide file tree
Showing 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ private void setAutoplay(boolean value, boolean doApply) {

if (doApply) {
SessionStore.get().setAutoplayEnabled(value);
SettingsStore.getInstance(getContext()).setAutoplayEnabled(value);
}
}

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 b7ea5d9

Please sign in to comment.