diff --git a/app/src/common/shared/org/mozilla/vrbrowser/browser/SettingsStore.java b/app/src/common/shared/org/mozilla/vrbrowser/browser/SettingsStore.java
index d67fa944b..f7d5bc137 100644
--- a/app/src/common/shared/org/mozilla/vrbrowser/browser/SettingsStore.java
+++ b/app/src/common/shared/org/mozilla/vrbrowser/browser/SettingsStore.java
@@ -82,6 +82,7 @@ SettingsStore getInstance(final @NonNull Context aContext) {
public final static boolean WHATS_NEW_DISPLAYED = false;
public final static long FXA_LAST_SYNC_NEVER = 0;
public final static boolean RESTORE_TABS_ENABLED = true;
+ public final static boolean BYPASS_CACHE_ON_RELOAD = false;
// Enable telemetry by default (opt-out).
public final static boolean CRASH_REPORTING_DEFAULT = false;
@@ -652,5 +653,14 @@ public boolean isRestoreTabsEnabled() {
return mPrefs.getBoolean(mContext.getString(R.string.settings_key_restore_tabs), RESTORE_TABS_ENABLED);
}
+ public void setBypassCacheOnReload(boolean isEnabled) {
+ SharedPreferences.Editor editor = mPrefs.edit();
+ editor.putBoolean(mContext.getString(R.string.settings_key_bypass_cache_on_reload),isEnabled);
+ editor.commit();
+ }
+
+ public boolean isBypassCacheOnReloadEnabled() {
+ return mPrefs.getBoolean(mContext.getString(R.string.settings_key_bypass_cache_on_reload), BYPASS_CACHE_ON_RELOAD);
+ }
}
diff --git a/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/Session.java b/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/Session.java
index d7a71c331..f11709da8 100644
--- a/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/Session.java
+++ b/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/Session.java
@@ -669,9 +669,9 @@ public void setActive(boolean aActive) {
}
}
- public void reload() {
+ public void reload(final int flags) {
if (mState.mSession != null) {
- mState.mSession.reload();
+ mState.mSession.reload(flags);
}
}
diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/views/UIButton.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/views/UIButton.java
index f55e583eb..f3ff7a6e5 100644
--- a/app/src/common/shared/org/mozilla/vrbrowser/ui/views/UIButton.java
+++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/views/UIButton.java
@@ -90,7 +90,7 @@ public UIButton(Context context, AttributeSet attrs, int defStyleAttr) {
setOnTouchListener((v, event) -> {
if (event.getAction() == MotionEvent.ACTION_UP) {
long time = event.getEventTime() - event.getDownTime();
- if (time > ViewConfiguration.getLongPressTimeout()) {
+ if (!v.isLongClickable() && time > ViewConfiguration.getLongPressTimeout()) {
performClick();
}
}
diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java
index 15974848f..a0d43c474 100644
--- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java
+++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/NavigationBarWidget.java
@@ -187,7 +187,8 @@ private void updateUI() {
if (mViewModel.getIsLoading().getValue().get()) {
getSession().stop();
} else {
- getSession().reload();
+ int flags = SettingsStore.getInstance(mAppContext).isBypassCacheOnReloadEnabled() ? GeckoSession.LOAD_FLAGS_BYPASS_CACHE : GeckoSession.LOAD_FLAGS_NONE;
+ getSession().reload(flags);
}
if (mAudio != null) {
mAudio.playSound(AudioEngine.Sound.CLICK);
@@ -195,6 +196,20 @@ private void updateUI() {
mNavigationListeners.forEach(NavigationListener::onReload);
});
+ mBinding.navigationBarNavigation.reloadButton.setOnLongClickListener(v -> {
+ v.requestFocusFromTouch();
+ if (mViewModel.getIsLoading().getValue().get()) {
+ getSession().stop();
+ } else {
+ getSession().reload(GeckoSession.LOAD_FLAGS_BYPASS_CACHE);
+ }
+ if (mAudio != null) {
+ mAudio.playSound(AudioEngine.Sound.CLICK);
+ }
+ mNavigationListeners.forEach(NavigationListener::onReload);
+ return true;
+ });
+
mBinding.navigationBarNavigation.homeButton.setOnClickListener(v -> {
v.requestFocusFromTouch();
getSession().loadUri(getSession().getHomeUri());
diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/settings/DeveloperOptionsView.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/settings/DeveloperOptionsView.java
index 5a6dc5bed..4875299c1 100644
--- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/settings/DeveloperOptionsView.java
+++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/settings/DeveloperOptionsView.java
@@ -66,6 +66,9 @@ protected void updateUI() {
mBinding.hardwareAccelerationSwitch.setOnCheckedChangeListener(mUIHardwareAccelerationListener);
setUIHardwareAcceleration(SettingsStore.getInstance(getContext()).isUIHardwareAccelerationEnabled(), false);
+ mBinding.bypassCacheOnReloadSwitch.setOnCheckedChangeListener(mBypassCacheOnReloadListener);
+ setBypassCacheOnReload(SettingsStore.getInstance(getContext()).isBypassCacheOnReloadEnabled(), false);
+
if (BuildConfig.DEBUG) {
mBinding.debugLoggingSwitch.setVisibility(View.GONE);
} else {
@@ -101,6 +104,10 @@ protected void updateUI() {
setUIHardwareAcceleration(value, doApply);
};
+ private SwitchSetting.OnCheckedChangeListener mBypassCacheOnReloadListener = (compundButton, value, doApply) -> {
+ setBypassCacheOnReload(value, doApply);
+ };
+
private SwitchSetting.OnCheckedChangeListener mServoListener = (compoundButton, b, doApply) -> {
setServo(b, true);
};
@@ -133,6 +140,10 @@ protected void updateUI() {
restart = true;
}
+ if (mBinding.bypassCacheOnReloadSwitch.isChecked() != SettingsStore.BYPASS_CACHE_ON_RELOAD) {
+ setBypassCacheOnReload(SettingsStore.BYPASS_CACHE_ON_RELOAD, true);
+ }
+
if (restart) {
showRestartDialog();
}
@@ -194,6 +205,16 @@ private void setDebugLogging(boolean value, boolean doApply) {
}
}
+ private void setBypassCacheOnReload(boolean value, boolean doApply) {
+ mBinding.bypassCacheOnReloadSwitch.setOnCheckedChangeListener(null);
+ mBinding.bypassCacheOnReloadSwitch.setValue(value, false);
+ mBinding.bypassCacheOnReloadSwitch.setOnCheckedChangeListener(mBypassCacheOnReloadListener);
+
+ if (doApply) {
+ SettingsStore.getInstance(getContext()).setBypassCacheOnReload(value);
+ }
+ }
+
private void setServo(boolean value, boolean doApply) {
mBinding.servoSwitch.setOnCheckedChangeListener(null);
mBinding.servoSwitch.setValue(value, false);
diff --git a/app/src/main/res/layout/options_developer.xml b/app/src/main/res/layout/options_developer.xml
index 110573725..fd1b4fc58 100644
--- a/app/src/main/res/layout/options_developer.xml
+++ b/app/src/main/res/layout/options_developer.xml
@@ -67,6 +67,12 @@
android:layout_height="wrap_content"
app:description="@string/hardware_acceleration_switch" />
+
+
settings_key_ui_hardware_acceleration_v3
settings_key_fxa_last_sync
settings_key_restore_tabs
+ settings_key_bypass_cache_on_reload
https://github.com/MozillaReality/FirefoxReality/wiki/Environments
https://www.mozilla.org/privacy/firefox/
https://mixedreality.mozilla.org/fxr/report?src=browser-fxr&label=browser-firefox-reality&url=%1$s
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 0c5986818..ce2e74a5d 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -344,9 +344,16 @@
+ -->
Enable UI Hardware Acceleration
+
+ Enable Cache Bypass On Reload
+
Enable Servo