Don't redirect to mobile app if verifying 3pid

Fixes https://github.com/vector-im/vector-web/issues/1933
pull/1951/head
David Baker 2016-08-11 12:44:49 +01:00
parent ab93e96a1f
commit e7ac66ad04
1 changed files with 18 additions and 12 deletions

View File

@ -184,16 +184,25 @@ function onLoadCompleted() {
async function loadApp() { async function loadApp() {
if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) { const fragparts = parseQsFromFragment(window.location);
if (confirm("Vector is not supported on mobile web. Install the app?")) { const params = parseQs(window.location);
window.location = "https://itunes.apple.com/us/app/vector.im/id1083446067";
return; // don't try to redirect to the native apps if we're
// verifying an 3pid
const preventRedirect = Boolean(fragparts.params.client_secret);
if (!preventRedirect) {
if (/iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream) {
if (confirm("Vector is not supported on mobile web. Install the app?")) {
window.location = "https://itunes.apple.com/us/app/vector.im/id1083446067";
return;
}
} }
} else if (/Android/.test(navigator.userAgent)) {
else if (/Android/.test(navigator.userAgent)) { if (confirm("Vector is not supported on mobile web. Install the app?")) {
if (confirm("Vector is not supported on mobile web. Install the app?")) { window.location = "https://play.google.com/store/apps/details?id=im.vector.alpha";
window.location = "https://play.google.com/store/apps/details?id=im.vector.alpha"; return;
return; }
} }
} }
@ -219,9 +228,6 @@ async function loadApp() {
} else if (validBrowser) { } else if (validBrowser) {
var MatrixChat = sdk.getComponent('structures.MatrixChat'); var MatrixChat = sdk.getComponent('structures.MatrixChat');
var fragparts = parseQsFromFragment(window.location);
var params = parseQs(window.location);
window.matrixChat = ReactDOM.render( window.matrixChat = ReactDOM.render(
<MatrixChat <MatrixChat
onNewScreen={onNewScreen} onNewScreen={onNewScreen}