瀏覽代碼

fix(mobile-landing): do not attempt opening download link in new window

Instead let the mobile OS take care of opening the URL
in the appropriate application. Without target _blank,
iOS 13.2.2 on Chrome will open about:blank and immediately
close the tab instead of opening the store.
j8
virtuacoplenny 5 年之前
父節點
當前提交
17c1f50fc3
共有 1 個文件被更改,包括 21 次插入6 次删除
  1. 21
    6
      react/features/deep-linking/components/DeepLinkingMobilePage.web.js

+ 21
- 6
react/features/deep-linking/components/DeepLinkingMobilePage.web.js 查看文件

94
         const downloadButtonClassName
94
         const downloadButtonClassName
95
             = `${_SNS}__button ${_SNS}__button_primary`;
95
             = `${_SNS}__button ${_SNS}__button_primary`;
96
 
96
 
97
+
98
+        const onOpenLinkProperties = _URLS[Platform.OS]
99
+            ? {
100
+                // When opening a link to the download page, we want to let the
101
+                // OS itself handle intercepting and opening the appropriate
102
+                // app store. This avoids potential issues with browsers, such
103
+                // as iOS Chrome, not opening the store properly.
104
+            }
105
+            : {
106
+                // When falling back to another URL (Firebase) let the page be
107
+                // opened in a new window. This helps prevent the user getting
108
+                // trapped in an app-open-cycle where going back to the mobile
109
+                // browser re-triggers the app-open behavior.
110
+                target: '_blank',
111
+                rel: 'noopener noreferrer'
112
+            };
113
+
97
         return (
114
         return (
98
             <div className = { _SNS }>
115
             <div className = { _SNS }>
99
                 <div className = 'header'>
116
                 <div className = 'header'>
113
                         { t(`${_TNS}.appNotInstalled`, { app: NATIVE_APP_NAME }) }
130
                         { t(`${_TNS}.appNotInstalled`, { app: NATIVE_APP_NAME }) }
114
                     </p>
131
                     </p>
115
                     <a
132
                     <a
133
+                        { ...onOpenLinkProperties }
116
                         href = { this._generateDownloadURL() }
134
                         href = { this._generateDownloadURL() }
117
-                        onClick = { this._onDownloadApp }
118
-                        rel = 'noopener noreferrer'
119
-                        target = '_blank'>
135
+                        onClick = { this._onDownloadApp }>
120
                         <button className = { downloadButtonClassName }>
136
                         <button className = { downloadButtonClassName }>
121
                             { t(`${_TNS}.downloadApp`) }
137
                             { t(`${_TNS}.downloadApp`) }
122
                         </button>
138
                         </button>
123
                     </a>
139
                     </a>
124
                     <a
140
                     <a
141
+                        { ...onOpenLinkProperties }
125
                         className = { `${_SNS}__href` }
142
                         className = { `${_SNS}__href` }
126
                         href = { generateDeepLinkingURL() }
143
                         href = { generateDeepLinkingURL() }
127
-                        onClick = { this._onOpenApp }
128
-                        rel = 'noopener noreferrer'
129
-                        target = '_blank'>
144
+                        onClick = { this._onOpenApp }>
130
                         {/* <button className = { `${_SNS}__button` }> */}
145
                         {/* <button className = { `${_SNS}__button` }> */}
131
                         { t(`${_TNS}.openApp`) }
146
                         { t(`${_TNS}.openApp`) }
132
                         {/* </button> */}
147
                         {/* </button> */}

Loading…
取消
儲存