Browse Source

feat(DeepLinkingMobilePage): Add dynamic links support.

j8
hristoterezov 7 years ago
parent
commit
53971d0b50
1 changed files with 37 additions and 5 deletions
  1. 37
    5
      react/features/deep-linking/components/DeepLinkingMobilePage.js

+ 37
- 5
react/features/deep-linking/components/DeepLinkingMobilePage.js View File

@@ -1,4 +1,4 @@
1
-/* @flow */
1
+// @flow
2 2
 
3 3
 import PropTypes from 'prop-types';
4 4
 import React, { Component } from 'react';
@@ -30,10 +30,8 @@ const _SNS = 'deep-linking-mobile';
30 30
  * @type {Array<string>}
31 31
  */
32 32
 const _URLS = {
33
-    android: interfaceConfig.MOBILE_DOWNLOAD_LINK_ANDROID
34
-        || 'https://play.google.com/store/apps/details?id=org.jitsi.meet',
33
+    android: interfaceConfig.MOBILE_DOWNLOAD_LINK_ANDROID,
35 34
     ios: interfaceConfig.MOBILE_DOWNLOAD_LINK_IOS
36
-        || 'https://itunes.apple.com/us/app/jitsi-meet/id1165103905'
37 35
 };
38 36
 
39 37
 /**
@@ -137,7 +135,7 @@ class DeepLinkingMobilePage extends Component<*, *> {
137 135
                         }
138 136
                     </p>
139 137
                     <a
140
-                        href = { _URLS[Platform.OS] }
138
+                        href = { this._generateDownloadURL() }
141 139
                         onClick = { this._onDownloadApp } >
142 140
                         <button className = { downloadButtonClassName }>
143 141
                             { t(`${_TNS}.downloadApp`) }
@@ -161,11 +159,44 @@ class DeepLinkingMobilePage extends Component<*, *> {
161 159
         );
162 160
     }
163 161
 
162
+    /**
163
+     * Generates the URL for downloading the app.
164
+     *
165
+     * @private
166
+     * @returns {string} - The URL for downloading the app.
167
+     */
168
+    _generateDownloadURL() {
169
+        const url = _URLS[Platform.OS];
170
+
171
+        if (url) {
172
+            return url;
173
+        }
174
+
175
+        // For information about the properties of
176
+        // interfaceConfig.MOBILE_DYNAMIC_LINK check:
177
+        // https://firebase.google.com/docs/dynamic-links/create-manually
178
+        const {
179
+            APN = 'org.jitsi.meet',
180
+            APP_CODE = 'w2atb',
181
+            IBI = 'com.atlassian.JitsiMeet.ios',
182
+            ISI = '1165103905'
183
+        } = interfaceConfig.MOBILE_DYNAMIC_LINK || {};
184
+        const IUS = interfaceConfig.APP_SCHEME || 'org.jitsi.meet';
185
+
186
+        return `https://${APP_CODE}.app.goo.gl/?link=${
187
+            encodeURIComponent(window.location.href)}&apn=${
188
+            APN}&ibi=${
189
+            IBI}&isi=${
190
+            ISI}&ius=${
191
+            IUS}&efr=1`;
192
+    }
193
+
164 194
     _onDownloadApp: () => {};
165 195
 
166 196
     /**
167 197
      * Handles download app button clicks.
168 198
      *
199
+     * @private
169 200
      * @returns {void}
170 201
      */
171 202
     _onDownloadApp() {
@@ -179,6 +210,7 @@ class DeepLinkingMobilePage extends Component<*, *> {
179 210
     /**
180 211
      * Handles open app button clicks.
181 212
      *
213
+     * @private
182 214
      * @returns {void}
183 215
      */
184 216
     _onOpenApp() {

Loading…
Cancel
Save