Skip to content

Commit

Permalink
Fix for Android webview matching.
Browse files Browse the repository at this point in the history
  • Loading branch information
VashurkinAnton committed Feb 5, 2021
1 parent 145d49a commit dc07788
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
15 changes: 7 additions & 8 deletions lib/express-useragent.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
this.DefaultAgent = {};
/* Fill the this.DefaultAgent with default values. */
this.reset('DefaultAgent');
};
}

/**
* Gets the browser name by user agent. Be careful that function has the side effects related to `this.Agent` state.
Expand Down Expand Up @@ -1072,19 +1072,18 @@
* boolean flag `isiOSStandalone`, `isiOSUiwebview` and `isAndroidWebview` will be set as side effect.
*/
UserAgent.prototype.testWebview = function() {
var ua = this;
if (ua.Agent.os === "iOS" && isBrowser) {
if (window.navigator.standalone && !ua.Agent.isSafari) {
if (this.Agent.os === 'iOS' && isBrowser) {
if (window.navigator.standalone && !this.Agent.isSafari) {
this.Agent.isiOSStandalone = true;
} else if (!window.navigator.standalone && !ua.Agent.isSafari) {
} else if (!window.navigator.standalone && !this.Agent.isSafari) {
this.Agent.isiOSUiwebview = true;
}
} else if (ua.isAndroid) {
if (/; ?wv\)/i.test(ua.Agent.source)) {
} else if (this.Agent.isAndroid) {
if (/; ?wv\)/i.test(this.Agent.source)) {
this.Agent.isAndroidWebview = true;
}
}
}
};

/**
* @deprecated
Expand Down
Loading

0 comments on commit dc07788

Please sign in to comment.