@ohos-ports/react-native-firebase-dynamic-links 0.0.0-stage → 22.4.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +971 -0
- package/LICENSE +32 -0
- package/README.md +53 -2
- package/RNFBDynamicLinks.podspec +49 -0
- package/android/.editorconfig +10 -0
- package/android/build.gradle +98 -0
- package/android/lint.xml +5 -0
- package/android/settings.gradle +1 -0
- package/android/src/main/AndroidManifest.xml +8 -0
- package/android/src/main/java/io/invertase/firebase/dynamiclinks/ReactNativeFirebaseDynamicLinksModule.java +507 -0
- package/android/src/main/java/io/invertase/firebase/dynamiclinks/ReactNativeFirebaseDynamicLinksPackage.java +44 -0
- package/app.plugin.js +1 -0
- package/ios/RNFBDynamicLinks/RNFBDynamicLinksAppDelegateInterceptor.h +37 -0
- package/ios/RNFBDynamicLinks/RNFBDynamicLinksAppDelegateInterceptor.m +132 -0
- package/ios/RNFBDynamicLinks/RNFBDynamicLinksModule.h +28 -0
- package/ios/RNFBDynamicLinks/RNFBDynamicLinksModule.m +443 -0
- package/ios/RNFBDynamicLinks.xcodeproj/project.pbxproj +354 -0
- package/ios/RNFBDynamicLinks.xcodeproj/xcshareddata/IDETemplateMacros.plist +24 -0
- package/lib/builder.js +93 -0
- package/lib/builders/analytics.js +61 -0
- package/lib/builders/android.js +52 -0
- package/lib/builders/ios.js +76 -0
- package/lib/builders/itunes.js +49 -0
- package/lib/builders/navigation.js +37 -0
- package/lib/builders/otherPlatform.js +20 -0
- package/lib/builders/social.js +49 -0
- package/lib/index.d.ts +650 -0
- package/lib/index.js +119 -0
- package/lib/modular/index.d.ts +148 -0
- package/lib/modular/index.js +110 -0
- package/lib/version.js +2 -0
- package/package.json +42 -4
- package/plugin/build/index.d.ts +3 -0
- package/plugin/build/index.js +17 -0
- package/plugin/build/ios/appDelegate.d.ts +5 -0
- package/plugin/build/ios/appDelegate.js +86 -0
- package/plugin/build/ios/index.d.ts +2 -0
- package/plugin/build/ios/index.js +13 -0
- package/plugin/src/index.ts +15 -0
- package/plugin/src/ios/appDelegate.ts +92 -0
- package/plugin/src/ios/index.ts +3 -0
- package/plugin/tsconfig.json +9 -0
- package/plugin/tsconfig.tsbuildinfo +1 -0
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,650 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { ReactNativeFirebase } from '@react-native-firebase/app';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Firebase Dynamic Links package for React Native.
|
|
22
|
+
*
|
|
23
|
+
* #### Example 1
|
|
24
|
+
*
|
|
25
|
+
* Access the firebase export from the `dynamicLinks` package:
|
|
26
|
+
*
|
|
27
|
+
* ```js
|
|
28
|
+
* import { firebase } from '@react-native-firebase/dynamic-links';
|
|
29
|
+
*
|
|
30
|
+
* // firebase.dynamicLinks().X
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* #### Example 2
|
|
34
|
+
*
|
|
35
|
+
* Using the default export from the `dynamic-links` package:
|
|
36
|
+
*
|
|
37
|
+
* ```js
|
|
38
|
+
* import dynamicLinks from '@react-native-firebase/dynamic-links';
|
|
39
|
+
*
|
|
40
|
+
* // dynamicLinks().X
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* #### Example 3
|
|
44
|
+
*
|
|
45
|
+
* Using the default export from the `app` package:
|
|
46
|
+
*
|
|
47
|
+
* ```js
|
|
48
|
+
* import firebase from '@react-native-firebase/app';
|
|
49
|
+
* import '@react-native-firebase/dynamic-links';
|
|
50
|
+
*
|
|
51
|
+
* // firebase.dynamicLinks().X
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @firebase dynamic-links
|
|
55
|
+
*/
|
|
56
|
+
export namespace FirebaseDynamicLinksTypes {
|
|
57
|
+
import FirebaseModule = ReactNativeFirebase.FirebaseModule;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The DynamicLinkAnalyticsParameters interface provides functionality to add Google Analytic
|
|
61
|
+
* based parameters to a dynamic link.
|
|
62
|
+
*
|
|
63
|
+
* #### Example
|
|
64
|
+
*
|
|
65
|
+
* ```js
|
|
66
|
+
* const link = await firebase.dynamicLinks().buildLink({
|
|
67
|
+
* link: 'https://invertase.io',
|
|
68
|
+
* domainUriPrefix: 'https://xyz.page.link',
|
|
69
|
+
* analytics: {
|
|
70
|
+
* campaign: 'banner',
|
|
71
|
+
* content: 'Click Me',
|
|
72
|
+
* }
|
|
73
|
+
* });
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export interface DynamicLinkAnalyticsParameters {
|
|
77
|
+
/**
|
|
78
|
+
* The individual campaign name, slogan, promo code, etc. for a product.
|
|
79
|
+
*/
|
|
80
|
+
campaign?: string;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The campaign content; used for A/B testing and content-targeted ads to differentiate ads or links that point to the same URL.
|
|
84
|
+
*/
|
|
85
|
+
content?: string;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The campaign medium; used to identify a medium such as email or cost-per-click (cpc).
|
|
89
|
+
*/
|
|
90
|
+
medium?: string;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The campaign source; used to identify a search engine, newsletter, or other source.
|
|
94
|
+
*/
|
|
95
|
+
source?: string;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The campaign term; used with paid search to supply the keywords for ads.
|
|
99
|
+
*/
|
|
100
|
+
term?: string;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The DynamicLinkAndroidParameters interface provides functionality to configure the behaviour
|
|
105
|
+
* of dynamic links for Android devices.
|
|
106
|
+
*
|
|
107
|
+
* If any parameter is declared then the Android package name must also be set via `setPackageName`
|
|
108
|
+
*
|
|
109
|
+
* #### Example
|
|
110
|
+
*
|
|
111
|
+
* ```js
|
|
112
|
+
* const link = await firebase.dynamicLinks().buildLink({
|
|
113
|
+
* link: 'https://invertase.io',
|
|
114
|
+
* domainUriPrefix: 'https://xyz.page.link',
|
|
115
|
+
* android: {
|
|
116
|
+
* packageName: 'io.invertase.testing',
|
|
117
|
+
* minimumVersion: '18',
|
|
118
|
+
* }
|
|
119
|
+
* });
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export interface DynamicLinkAndroidParameters {
|
|
123
|
+
/**
|
|
124
|
+
* Sets the link to open when the app isn't installed. Specify this to do something other than install your app from
|
|
125
|
+
* the Play Store when the app isn't installed, such as open the mobile web version of the content, or display a
|
|
126
|
+
* promotional page for your app.
|
|
127
|
+
*/
|
|
128
|
+
fallbackUrl?: string;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Sets the version code of the minimum version of your app that can open the link.
|
|
132
|
+
*/
|
|
133
|
+
minimumVersion?: string;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* The package name of the Android app to use to open the link. The app must be connected to your project from the Overview page of the Firebase console.
|
|
137
|
+
*
|
|
138
|
+
* This option is required if passing android options to your dynamic link.
|
|
139
|
+
*/
|
|
140
|
+
packageName: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The DynamicLinkIOSParameters interface provides functionality to configure the behaviour
|
|
145
|
+
* of dynamic links for iOS devices.
|
|
146
|
+
*
|
|
147
|
+
* If any parameter is declared then the iOS BundleId must also be set via `setBundleId`
|
|
148
|
+
*
|
|
149
|
+
* #### Example
|
|
150
|
+
*
|
|
151
|
+
* ```js
|
|
152
|
+
* const linkParams = firebase.dynamicLinks().newDynamicLinkParameters('https://invertase.io', 'https://xyz.page.link');
|
|
153
|
+
* linkParams
|
|
154
|
+
* .ios.setBundleId('io.invertase.testing')
|
|
155
|
+
* .ios.setAppStoreId('123456789')
|
|
156
|
+
* .ios.setMinimumVersion('18');
|
|
157
|
+
*
|
|
158
|
+
* const link = await firebase.dynamicLinks().buildLink({
|
|
159
|
+
* link: 'https://invertase.io',
|
|
160
|
+
* domainUriPrefix: 'https://xyz.page.link',
|
|
161
|
+
* ios: {
|
|
162
|
+
* bundleId: 'io.invertase.testing',
|
|
163
|
+
* appStoreId: '123456789',
|
|
164
|
+
* minimumVersion: '18',
|
|
165
|
+
* }
|
|
166
|
+
* });
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
export interface DynamicLinkIOSParameters {
|
|
170
|
+
/**
|
|
171
|
+
* Sets the App Store ID, used to send users to the App Store when the app isn't installed.
|
|
172
|
+
*/
|
|
173
|
+
appStoreId?: string;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* The bundle ID of the iOS app to use to open the link. The app must be connected to your project from the Overview page of the Firebase console.
|
|
177
|
+
*
|
|
178
|
+
* This option is required if passing ios options to your dynamic link.
|
|
179
|
+
*/
|
|
180
|
+
bundleId: string;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Sets the app's custom URL scheme, if defined to be something other than your app's parameters ID.
|
|
184
|
+
*/
|
|
185
|
+
customScheme?: string;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Sets the link to open when the app isn't installed. Specify this to do something other than install your app from
|
|
189
|
+
* the App Store when the app isn't installed, such as open the mobile web version of the content, or display a
|
|
190
|
+
* promotional page for your app.
|
|
191
|
+
*/
|
|
192
|
+
fallbackUrl?: string;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Sets the bundle ID of the iOS app to use on iPads to open the link. The app must be connected to your project
|
|
196
|
+
* from the Overview page of the Firebase console.
|
|
197
|
+
*/
|
|
198
|
+
iPadBundleId?: string;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Sets the link to open on iPads when the app isn't installed. Specify this to do something other than install your
|
|
202
|
+
* app from the App Store when the app isn't installed, such as open the web version of the content, or display a
|
|
203
|
+
* promotional page for your app. Overrides the fallback link set by `setFallbackUrl` on iPad.
|
|
204
|
+
*/
|
|
205
|
+
iPadFallbackUrl?: string;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Sets the minimum version of your app that can open the link.
|
|
209
|
+
*/
|
|
210
|
+
minimumVersion?: string;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* The DynamicLinkITunesParameters interface provides functionality to add iTunes Connect Analytics
|
|
215
|
+
* based parameters to the created dynamic link.
|
|
216
|
+
*
|
|
217
|
+
* #### Example
|
|
218
|
+
*
|
|
219
|
+
* ```js
|
|
220
|
+
* const link = await firebase.dynamicLinks().buildLink({
|
|
221
|
+
* link: 'https://invertase.io',
|
|
222
|
+
* domainUriPrefix: 'https://xyz.page.link',
|
|
223
|
+
* itunes: {
|
|
224
|
+
* affiliateToken: 'ABCDEFG',
|
|
225
|
+
* }
|
|
226
|
+
* });
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
export interface DynamicLinkITunesParameters {
|
|
230
|
+
/**
|
|
231
|
+
* The affiliate token used to create affiliate-coded links.
|
|
232
|
+
*/
|
|
233
|
+
affiliateToken?: string;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* The campaign token that developers can add to any link in order to track sales from a specific marketing campaign.
|
|
237
|
+
*/
|
|
238
|
+
campaignToken?: string;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* The provider token that enables analytics for Dynamic DynamicLinks from within iTunes Connect.
|
|
242
|
+
*/
|
|
243
|
+
providerToken?: string;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* The DynamicLinkNavigationParameters interface provides functionality to specify how the navigation
|
|
248
|
+
* of the created link is handled.
|
|
249
|
+
*
|
|
250
|
+
* #### Example
|
|
251
|
+
*
|
|
252
|
+
* ```js
|
|
253
|
+
* const link = await firebase.dynamicLinks().buildLink({
|
|
254
|
+
* link: 'https://invertase.io',
|
|
255
|
+
* domainUriPrefix: 'https://xyz.page.link',
|
|
256
|
+
* navigation: {
|
|
257
|
+
* forcedRedirectEnabled: true,
|
|
258
|
+
* }
|
|
259
|
+
* });
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
262
|
+
export interface DynamicLinkNavigationParameters {
|
|
263
|
+
/**
|
|
264
|
+
* Sets whether to enable force redirecting or going to the app preview page. Defaults to false.
|
|
265
|
+
*
|
|
266
|
+
* If true, app preview page will be disabled and there will be a redirect to the FDL. If false, go to the app preview page.
|
|
267
|
+
*/
|
|
268
|
+
forcedRedirectEnabled?: boolean;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* The DynamicLinkSocialParameters interface provides functionality to add additional social
|
|
273
|
+
* meta-data to the URL.
|
|
274
|
+
*
|
|
275
|
+
* #### Example
|
|
276
|
+
*
|
|
277
|
+
* ```js
|
|
278
|
+
* const link = await firebase.dynamicLinks().buildLink({
|
|
279
|
+
* link: 'https://invertase.io',
|
|
280
|
+
* domainUriPrefix: 'https://xyz.page.link',
|
|
281
|
+
* social: {
|
|
282
|
+
* title: 'Social Application',
|
|
283
|
+
* descriptionText: 'A Social Application',
|
|
284
|
+
* }
|
|
285
|
+
* });
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
288
|
+
export interface DynamicLinkSocialParameters {
|
|
289
|
+
/**
|
|
290
|
+
* The description to use when the Dynamic Link is shared in a social post.
|
|
291
|
+
*/
|
|
292
|
+
descriptionText?: string;
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* The URL to an image related to this link.
|
|
296
|
+
*/
|
|
297
|
+
imageUrl?: string;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* The title to use when the Dynamic Link is shared in a social post.
|
|
301
|
+
*/
|
|
302
|
+
title?: string;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* The DynamicLinkOtherPlatformParameters interface provides functionality to
|
|
307
|
+
* open a custom URL on platforms beside Android and iOS. This is useful to
|
|
308
|
+
* specify a different behavior on desktop, like displaying a full web page
|
|
309
|
+
* of the app content/payload (as specified by param link) with another dynamic
|
|
310
|
+
* link to install the app.
|
|
311
|
+
*
|
|
312
|
+
* #### Example
|
|
313
|
+
*
|
|
314
|
+
* ```js
|
|
315
|
+
* const link = await firebase.dynamicLinks().buildLink({
|
|
316
|
+
* link: 'https://invertase.io',
|
|
317
|
+
* domainUriPrefix: 'https://xyz.page.link',
|
|
318
|
+
* otherPlatform: {
|
|
319
|
+
* fallbackUrl: 'https://www.google.com/',
|
|
320
|
+
* }
|
|
321
|
+
* });
|
|
322
|
+
* ```
|
|
323
|
+
*/
|
|
324
|
+
export interface DynamicLinkOtherPlatformParameters {
|
|
325
|
+
/**
|
|
326
|
+
* The URL to open on desktop.
|
|
327
|
+
*/
|
|
328
|
+
fallbackUrl?: string;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* The DynamicLinkParameters interface provides access to the Dynamic Link builder classes
|
|
333
|
+
* used to configure a created link.
|
|
334
|
+
*
|
|
335
|
+
* #### Example
|
|
336
|
+
*
|
|
337
|
+
* ```js
|
|
338
|
+
* const link = await firebase.dynamicLinks().buildLink({
|
|
339
|
+
* link: 'https://invertase.io',
|
|
340
|
+
* domainUriPrefix: 'https://xyz.page.link',
|
|
341
|
+
* });
|
|
342
|
+
* ```
|
|
343
|
+
*/
|
|
344
|
+
export interface DynamicLinkParameters {
|
|
345
|
+
/**
|
|
346
|
+
* The link the target app will open. You can specify any URL the app can handle, such as a link to the app’s content,
|
|
347
|
+
* or a URL that initiates some app-specific logic such as crediting the user with a coupon, or displaying a
|
|
348
|
+
* specific welcome screen. This link must be a well-formatted URL, be properly URL-encoded, and use the HTTP or
|
|
349
|
+
* HTTPS scheme.
|
|
350
|
+
*/
|
|
351
|
+
link: string;
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Domain URI Prefix of your App. This value must be your assigned domain from the Firebase console,
|
|
355
|
+
* (e.g. https://xyz.page.link). The domain URI prefix must start with a valid HTTPS scheme (https://).
|
|
356
|
+
*/
|
|
357
|
+
domainUriPrefix: string;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Access Google Analytics specific link parameters.
|
|
361
|
+
*/
|
|
362
|
+
analytics?: DynamicLinkAnalyticsParameters;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Access Android specific link parameters.
|
|
366
|
+
*/
|
|
367
|
+
android?: DynamicLinkAndroidParameters;
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Access iOS specific link parameters.
|
|
371
|
+
*/
|
|
372
|
+
ios?: DynamicLinkIOSParameters;
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Access iTunes Connect specific link parameters.
|
|
376
|
+
*/
|
|
377
|
+
itunes?: DynamicLinkITunesParameters;
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Access navigation specific link parameters.
|
|
381
|
+
*/
|
|
382
|
+
navigation?: DynamicLinkNavigationParameters;
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Access social specific link parameters.
|
|
386
|
+
*/
|
|
387
|
+
social?: DynamicLinkSocialParameters;
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Access other platform specific link parameters.
|
|
391
|
+
*/
|
|
392
|
+
otherPlatform?: DynamicLinkOtherPlatformParameters;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* ShortLinkType determines the type of dynamic short link which Firebase creates. Used when building
|
|
397
|
+
* a new short link via `buildShortLink()`. These are exported through statics connected to the module.
|
|
398
|
+
*
|
|
399
|
+
* #### Example
|
|
400
|
+
*
|
|
401
|
+
* ```js
|
|
402
|
+
* const link = await firebase.dynamicLinks().buildShortLink({
|
|
403
|
+
* link: 'https://invertase.io',
|
|
404
|
+
* domainUriPrefix: 'https://xyz.page.link',
|
|
405
|
+
* }, firebase.dynamicLinks.ShortLinkType.UNGUESSABLE);
|
|
406
|
+
* ```
|
|
407
|
+
*/
|
|
408
|
+
export enum ShortLinkType {
|
|
409
|
+
/**
|
|
410
|
+
* Shorten the path to a string that is only as long as needed to be unique, with a minimum length
|
|
411
|
+
* of 4 characters. Use this if sensitive information would not be exposed if a short
|
|
412
|
+
* Dynamic Link URL were guessed.
|
|
413
|
+
*/
|
|
414
|
+
SHORT = 'SHORT',
|
|
415
|
+
/**
|
|
416
|
+
* Shorten the path to an unguessable string. Such strings are created by base62-encoding randomly
|
|
417
|
+
* generated 96-bit numbers, and consist of 17 alphanumeric characters. Use unguessable strings
|
|
418
|
+
* to prevent your Dynamic DynamicLinks from being crawled, which can potentially expose sensitive information.
|
|
419
|
+
*/
|
|
420
|
+
UNGUESSABLE = 'UNGUESSABLE',
|
|
421
|
+
/**
|
|
422
|
+
* By default, Firebase returns a standard formatted link.
|
|
423
|
+
*/
|
|
424
|
+
DEFAULT = 'DEFAULT',
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* A received Dynamic Link from either `onLink` or `getInitialLink`.
|
|
429
|
+
*/
|
|
430
|
+
export interface DynamicLink {
|
|
431
|
+
/**
|
|
432
|
+
* The url of the dynamic link.
|
|
433
|
+
*/
|
|
434
|
+
url: string;
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* The minimum app version (not system version) requested to process the dynamic link.
|
|
438
|
+
* This is retrieved from the imv= parameter of the Dynamic Link URL.
|
|
439
|
+
*
|
|
440
|
+
* If the app version of the opening app is less than the value of this property,
|
|
441
|
+
* then the app is expected to open AppStore to allow user to download most recent version.
|
|
442
|
+
* App can notify or ask the user before opening AppStore.
|
|
443
|
+
*
|
|
444
|
+
* Returns `null` if not specified
|
|
445
|
+
*
|
|
446
|
+
* #### Android
|
|
447
|
+
*
|
|
448
|
+
* On Android this returns a number value representing the apps [versionCode](https://developer.android.com/reference/android/content/pm/PackageInfo.html#versionCode).
|
|
449
|
+
*
|
|
450
|
+
* #### iOS
|
|
451
|
+
*
|
|
452
|
+
* On iOS this returns a string value representing the minimum app version (not the iOS system version).
|
|
453
|
+
*/
|
|
454
|
+
minimumAppVersion: number | string | null;
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* The potential UTM parameters linked to this dynamic link
|
|
458
|
+
*
|
|
459
|
+
* It will only work for short links, not long links
|
|
460
|
+
*/
|
|
461
|
+
utmParameters: Record<string, string>;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Firebase Dynamic DynamicLinks Statics
|
|
466
|
+
*
|
|
467
|
+
* ```js
|
|
468
|
+
* firebase.dynamicLinks.X
|
|
469
|
+
* ```
|
|
470
|
+
*/
|
|
471
|
+
export interface Statics {
|
|
472
|
+
/**
|
|
473
|
+
* Returns the {@link links.ShortLinkType} enum.
|
|
474
|
+
*/
|
|
475
|
+
ShortLinkType: typeof ShortLinkType;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
*
|
|
480
|
+
* The Firebase Dynamic DynamicLinks service is available for the default app only.
|
|
481
|
+
*
|
|
482
|
+
* #### Example 1
|
|
483
|
+
*
|
|
484
|
+
* Get the links instance for the **default app**:
|
|
485
|
+
*
|
|
486
|
+
* ```js
|
|
487
|
+
* const links = firebase.dynamicLinks();
|
|
488
|
+
* ```
|
|
489
|
+
*/
|
|
490
|
+
export class Module extends FirebaseModule {
|
|
491
|
+
/**
|
|
492
|
+
* Builds a Dynamic Link from the provided DynamicLinkParameters instances.
|
|
493
|
+
*
|
|
494
|
+
* #### Example
|
|
495
|
+
*
|
|
496
|
+
* ```js
|
|
497
|
+
* const link = await firebase.dynamicLinks().buildLink({
|
|
498
|
+
* link: 'https://invertase.io',
|
|
499
|
+
* domainUriPrefix: 'https://xyz.page.link',
|
|
500
|
+
* analytics: {
|
|
501
|
+
* campaign: 'banner',
|
|
502
|
+
* }
|
|
503
|
+
* });
|
|
504
|
+
* ```
|
|
505
|
+
*
|
|
506
|
+
* @param dynamicLinkParams An object interface of DynamicLinkParameters.
|
|
507
|
+
*/
|
|
508
|
+
buildLink(dynamicLinkParams: DynamicLinkParameters): Promise<string>;
|
|
509
|
+
/**
|
|
510
|
+
* Builds a short Dynamic Link from the provided DynamicLinkParameters interface.
|
|
511
|
+
*
|
|
512
|
+
* ```js
|
|
513
|
+
* const link = await firebase.dynamicLinks().buildShortLink(
|
|
514
|
+
* {
|
|
515
|
+
* link: 'https://invertase.io',
|
|
516
|
+
* domainUriPrefix: 'https://xyz.page.link',
|
|
517
|
+
* analytics: {
|
|
518
|
+
* campaign: 'banner',
|
|
519
|
+
* }
|
|
520
|
+
* },
|
|
521
|
+
* firebase.dynamicLinks.ShortLinkType.UNGUESSABLE,
|
|
522
|
+
* );
|
|
523
|
+
* ```
|
|
524
|
+
*
|
|
525
|
+
* @param dynamicLinkParams An object interface of DynamicLinkParameters.
|
|
526
|
+
* @param shortLinkType The short link type, one of `ShortLinkType` from `firebase.dynamicLinks.ShortLinkType`
|
|
527
|
+
*/
|
|
528
|
+
buildShortLink(
|
|
529
|
+
dynamicLinkParams: DynamicLinkParameters,
|
|
530
|
+
shortLinkType?: ShortLinkType,
|
|
531
|
+
): Promise<string>;
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Returns the Dynamic Link that the app has been launched from. If the app was not launched from a Dynamic Link the value will be null.
|
|
535
|
+
*
|
|
536
|
+
* > Use {@link auth#isSignInWithEmailLink} to check if an inbound dynamic link is an email sign-in link.
|
|
537
|
+
*
|
|
538
|
+
* #### Example
|
|
539
|
+
*
|
|
540
|
+
* ```js
|
|
541
|
+
* async function bootstrapApp() {
|
|
542
|
+
* const initialLink = await firebase.dynamicLinks().getInitialLink();
|
|
543
|
+
*
|
|
544
|
+
* if (initialLink) {
|
|
545
|
+
* // Handle dynamic link inside your own application
|
|
546
|
+
* if (initialLink.url === 'https://invertase.io/offer') return navigateTo('/offers')
|
|
547
|
+
* }
|
|
548
|
+
* }
|
|
549
|
+
* ```
|
|
550
|
+
*/
|
|
551
|
+
getInitialLink(): Promise<DynamicLink | null>;
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Subscribe to Dynamic Link open events while the app is still running.
|
|
555
|
+
*
|
|
556
|
+
* The listener is called from Dynamic Link open events whilst the app is still running, use
|
|
557
|
+
* {@link dynamic-links#getInitialLink} for Dynamic Links which cause the app to open from a previously closed / not running state.
|
|
558
|
+
*
|
|
559
|
+
* #### Example
|
|
560
|
+
*
|
|
561
|
+
* ```jsx
|
|
562
|
+
* function App() {
|
|
563
|
+
* const handleDynamicLink = (link) => {
|
|
564
|
+
* // Handle dynamic link inside your own application
|
|
565
|
+
* if (link.url === 'https://invertase.io/offer') return navigateTo('/offers')
|
|
566
|
+
* };
|
|
567
|
+
*
|
|
568
|
+
* useEffect(() => {
|
|
569
|
+
* const unsubscribe = firebase.dynamicLinks().onLink(handleDynamicLink);
|
|
570
|
+
* // When the component unmounts, remove the listener
|
|
571
|
+
* return unsubscribe;
|
|
572
|
+
* }, []);
|
|
573
|
+
*
|
|
574
|
+
* return <YourApp />;
|
|
575
|
+
* }
|
|
576
|
+
* ```
|
|
577
|
+
*
|
|
578
|
+
* @returns Unsubscribe function, call the returned function to unsubscribe from all future events.
|
|
579
|
+
* @param listener The listener callback, called with Dynamic Link instances.
|
|
580
|
+
*/
|
|
581
|
+
onLink(listener: (link: DynamicLink) => void): () => void;
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Perform built-in diagnostics on iOS. This is best performed on a real device running
|
|
585
|
+
* a build from Xcode so you may see the output easily. Alternatively it should be visible
|
|
586
|
+
* in Console.app with an iPhone plugged into a macOS computer
|
|
587
|
+
*
|
|
588
|
+
* NOTE: iOS only
|
|
589
|
+
*/
|
|
590
|
+
performDiagnostics(): void;
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* Resolve a given dynamic link (short or long) directly.
|
|
594
|
+
*
|
|
595
|
+
* This mimics the result of external link resolution, app open, and the DynamicLink you
|
|
596
|
+
* would get from {@link dynamic-links#getInitialLink}
|
|
597
|
+
*
|
|
598
|
+
* #### Example
|
|
599
|
+
*
|
|
600
|
+
* ```js
|
|
601
|
+
* const link = await firebase.dynamicLinks().resolveLink('https://reactnativefirebase.page.link/76adfasdf');
|
|
602
|
+
* console.log('Received link with URL: ' + link.url);
|
|
603
|
+
* ```
|
|
604
|
+
*
|
|
605
|
+
* Can throw error with message 'Invalid link parameter' if link parameter is null
|
|
606
|
+
* Can throw error with code 'not-found' if the link does not resolve
|
|
607
|
+
* Can throw error with code 'resolve-link-error' if there is a processing error
|
|
608
|
+
|
|
609
|
+
* @returns the resolved Dynamic Link
|
|
610
|
+
* @param link The Dynamic Link URL to resolve, either short or long
|
|
611
|
+
*/
|
|
612
|
+
resolveLink(link: string): Promise<DynamicLink>;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
declare const defaultExport: ReactNativeFirebase.FirebaseModuleWithStatics<
|
|
617
|
+
FirebaseDynamicLinksTypes.Module,
|
|
618
|
+
FirebaseDynamicLinksTypes.Statics
|
|
619
|
+
>;
|
|
620
|
+
|
|
621
|
+
export const firebase: ReactNativeFirebase.Module & {
|
|
622
|
+
dynamicLinks: typeof defaultExport;
|
|
623
|
+
app(
|
|
624
|
+
name?: string,
|
|
625
|
+
): ReactNativeFirebase.FirebaseApp & { dynamicLinks(): FirebaseDynamicLinksTypes.Module };
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
export * from './modular';
|
|
629
|
+
|
|
630
|
+
export default defaultExport;
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Attach namespace to `firebase.` and `FirebaseApp.`.
|
|
634
|
+
*/
|
|
635
|
+
declare module '@react-native-firebase/app' {
|
|
636
|
+
namespace ReactNativeFirebase {
|
|
637
|
+
import FirebaseModuleWithStatics = ReactNativeFirebase.FirebaseModuleWithStatics;
|
|
638
|
+
|
|
639
|
+
interface Module {
|
|
640
|
+
dynamicLinks: FirebaseModuleWithStatics<
|
|
641
|
+
FirebaseDynamicLinksTypes.Module,
|
|
642
|
+
FirebaseDynamicLinksTypes.Statics
|
|
643
|
+
>;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
interface FirebaseApp {
|
|
647
|
+
dynamicLinks(): FirebaseDynamicLinksTypes.Module;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|