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

Commit

Permalink
Use user configuration to initialize session UA and viewport settings (
Browse files Browse the repository at this point in the history
  • Loading branch information
MortimerGoro authored and bluemarvin committed Oct 28, 2019
1 parent ea83972 commit dac11c4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ private String checkForMobileSite(String aUri) {
}

public void setUaMode(int mode) {
if (mState.mSession == null) {
if (mState.mSession == null || mState.mSettings.getUserAgentMode() == mode) {
return;
}
mState.mSettings.setUserAgentMode(mode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,16 @@ public Builder withUserAgentOverride(String userAgentOverride) {
}

public Builder withDefaultSettings(Context context) {
int ua = SettingsStore.getInstance(context).getUaMode();
int viewport = ua == GeckoSessionSettings.USER_AGENT_MODE_DESKTOP ?
GeckoSessionSettings.VIEWPORT_MODE_DESKTOP : GeckoSessionSettings.VIEWPORT_MODE_MOBILE;

return new SessionSettings.Builder()
.withMultiprocess(SettingsStore.getInstance(context).isMultiprocessEnabled())
.withTrackingProteccion(SettingsStore.getInstance(context).isTrackingProtectionEnabled())
.withSuspendMediaWhenInactive(true)
.withUserAgent(GeckoSessionSettings.USER_AGENT_MODE_VR)
.withViewport(GeckoSessionSettings.VIEWPORT_MODE_MOBILE)
.withUserAgent(ua)
.withViewport(viewport)
.withServo(false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,6 @@ private void setUaMode(int checkId, boolean doApply) {
mBinding.uaRadio.setOnCheckedChangeListener(mUaModeListener);

SettingsStore.getInstance(getContext()).setUaMode(checkId);

if (doApply) {
SessionStore.get().setUaMode((Integer)mBinding.uaRadio.getValueForId(checkId));
}
}

private void setMSAAMode(int checkedId, boolean doApply) {
Expand Down

0 comments on commit dac11c4

Please sign in to comment.