From e7ac66ad04d3ba8f96171c58537d73a1433b29d1 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 11 Aug 2016 12:44:49 +0100 Subject: [PATCH 1/2] Don't redirect to mobile app if verifying 3pid Fixes https://github.com/vector-im/vector-web/issues/1933 --- src/vector/index.js | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/vector/index.js b/src/vector/index.js index de436ba1..8eb9cac1 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -184,16 +184,25 @@ function onLoadCompleted() { async function loadApp() { - 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; + const fragparts = parseQsFromFragment(window.location); + const params = parseQs(window.location); + + // 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)) { - 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"; - return; + else if (/Android/.test(navigator.userAgent)) { + 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"; + return; + } } } @@ -219,9 +228,6 @@ async function loadApp() { } else if (validBrowser) { var MatrixChat = sdk.getComponent('structures.MatrixChat'); - var fragparts = parseQsFromFragment(window.location); - var params = parseQs(window.location); - window.matrixChat = ReactDOM.render( Date: Thu, 11 Aug 2016 12:49:57 +0100 Subject: [PATCH 2/2] comment typo --- src/vector/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vector/index.js b/src/vector/index.js index 8eb9cac1..07501094 100644 --- a/src/vector/index.js +++ b/src/vector/index.js @@ -188,7 +188,7 @@ async function loadApp() { const params = parseQs(window.location); // don't try to redirect to the native apps if we're - // verifying an 3pid + // verifying a 3pid const preventRedirect = Boolean(fragparts.params.client_secret); if (!preventRedirect) {