@react-native-firebase/installations 24.1.1 → 25.0.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 +23 -0
- package/dist/module/index.js +29 -0
- package/dist/module/index.js.map +1 -0
- package/{lib/modular/index.js → dist/module/modular.js} +20 -15
- package/dist/module/modular.js.map +1 -0
- package/{lib/index.js → dist/module/namespaced.js} +10 -19
- package/dist/module/namespaced.js.map +1 -0
- package/dist/module/package.json +1 -0
- package/dist/module/types/installations.js +4 -0
- package/dist/module/types/installations.js.map +1 -0
- package/dist/module/types/internal.js +4 -0
- package/dist/module/types/internal.js.map +1 -0
- package/dist/module/types/namespaced.js +33 -0
- package/dist/module/types/namespaced.js.map +1 -0
- package/dist/module/version.js +5 -0
- package/dist/module/version.js.map +1 -0
- package/dist/typescript/lib/index.d.ts +6 -0
- package/dist/typescript/lib/index.d.ts.map +1 -0
- package/dist/typescript/lib/modular.d.ts +25 -0
- package/dist/typescript/lib/modular.d.ts.map +1 -0
- package/dist/typescript/lib/namespaced.d.ts +12 -0
- package/dist/typescript/lib/namespaced.d.ts.map +1 -0
- package/dist/typescript/lib/types/installations.d.ts +19 -0
- package/dist/typescript/lib/types/installations.d.ts.map +1 -0
- package/dist/typescript/lib/types/internal.d.ts +19 -0
- package/dist/typescript/lib/types/internal.d.ts.map +1 -0
- package/dist/typescript/lib/types/namespaced.d.ts +77 -0
- package/dist/typescript/lib/types/namespaced.d.ts.map +1 -0
- package/dist/typescript/lib/version.d.ts +2 -0
- package/dist/typescript/lib/version.d.ts.map +1 -0
- package/dist/typescript/package.json +1 -0
- package/lib/index.ts +27 -0
- package/lib/modular.ts +80 -0
- package/lib/namespaced.ts +100 -0
- package/lib/types/installations.ts +38 -0
- package/lib/types/internal.ts +42 -0
- package/lib/types/namespaced.ts +112 -0
- package/lib/version.ts +2 -0
- package/package.json +37 -7
- package/tsconfig.json +20 -0
- package/typedoc.json +2 -3
- package/lib/index.d.ts +0 -173
- package/lib/modular/index.d.ts +0 -41
- package/lib/version.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,29 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [25.0.0](https://github.com/invertase/react-native-firebase/compare/v24.0.0...v25.0.0) (2026-06-23)
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
- **installations:** installations modular types now match firebase-js-sdk
|
|
11
|
+
|
|
12
|
+
Please see https://rnfirebase.io/migrating-to-v25 for help migrating if needed.
|
|
13
|
+
|
|
14
|
+
react-native-firebase has a goal to be a drop-in replacement for firebase-js-sdk, with native extensions and performance. It has always worked that way at the javascript level but the typescript types have been divergent.
|
|
15
|
+
|
|
16
|
+
We are fixing that as we refactor to typescript. Please bear with us as we get closer to our goal of react-native-firebase matching firebase-js-sdk both in functionality where possible, but also in exact typescript typing.
|
|
17
|
+
|
|
18
|
+
Specifics for Installations:
|
|
19
|
+
|
|
20
|
+
changed modular getInstallations() to return the firebase-js-sdk-style Installations type, which only exposes app; TypeScript consumers should use the modular helpers getId(installations), getToken(installations), and deleteInstallations(installations) instead of calling .getId(), .getToken(), or .delete() on the returned instance.
|
|
21
|
+
changed modular deleteInstallations(installations) so the installations argument is required in the TypeScript surface, matching firebase-js-sdk. Code that previously relied on the old optional typing should pass getInstallations() explicitly.
|
|
22
|
+
preserved the namespaced API surface: installations(), firebase.installations(), firebase.app().installations(), and FirebaseInstallationsTypes.Module remain available for compatibility, with deprecation annotations added.
|
|
23
|
+
added explicit modular public types including Installations, IdChangeCallbackFn, and IdChangeUnsubscribeFn.
|
|
24
|
+
|
|
25
|
+
### Code Refactoring
|
|
26
|
+
|
|
27
|
+
- **installations:** migrate to TypeScript ([739a4ca](https://github.com/invertase/react-native-firebase/commit/739a4ca36169a7e0d8cf20c9330747d1d154e0c9))
|
|
28
|
+
|
|
6
29
|
## [24.1.1](https://github.com/invertase/react-native-firebase/compare/v24.1.0...v24.1.1) (2026-06-10)
|
|
7
30
|
|
|
8
31
|
**Note:** Version bump only for package @react-native-firebase/installations
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this library except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
// Export modular/public types.
|
|
21
|
+
|
|
22
|
+
// Export modular API functions.
|
|
23
|
+
export * from "./modular.js";
|
|
24
|
+
|
|
25
|
+
// Export namespaced API.
|
|
26
|
+
|
|
27
|
+
export * from "./namespaced.js";
|
|
28
|
+
export { default } from "./namespaced.js";
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["default"],"sourceRoot":"../../lib","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAGA;AACA,cAAc,cAAW;;AAEzB;;AAEA,cAAc,iBAAc;AAC5B,SAASA,OAAO,QAAQ,iBAAc","ignoreList":[]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
/*
|
|
2
4
|
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
5
|
*
|
|
@@ -17,10 +19,13 @@
|
|
|
17
19
|
|
|
18
20
|
import { getApp } from '@react-native-firebase/app';
|
|
19
21
|
import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/dist/module/common';
|
|
22
|
+
function withModularDeprecationArg(installations) {
|
|
23
|
+
return installations;
|
|
24
|
+
}
|
|
25
|
+
|
|
20
26
|
/**
|
|
21
|
-
*
|
|
27
|
+
* Returns an instance of Installations associated with the given FirebaseApp instance.
|
|
22
28
|
*/
|
|
23
|
-
|
|
24
29
|
export function getInstallations(app) {
|
|
25
30
|
if (app) {
|
|
26
31
|
return getApp(app.name).installations();
|
|
@@ -29,35 +34,35 @@ export function getInstallations(app) {
|
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
/**
|
|
32
|
-
*
|
|
33
|
-
* @returns {Promise<void>}
|
|
37
|
+
* Deletes the Firebase Installation and all associated data.
|
|
34
38
|
*/
|
|
35
39
|
export function deleteInstallations(installations) {
|
|
36
|
-
|
|
40
|
+
const internalInstallations = withModularDeprecationArg(installations);
|
|
41
|
+
return internalInstallations.delete.call(internalInstallations, MODULAR_DEPRECATION_ARG);
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
/**
|
|
40
|
-
*
|
|
41
|
-
* @returns {Promise<string>}
|
|
45
|
+
* Creates a Firebase Installation if there isn't one for the app and returns the Installation ID.
|
|
42
46
|
*/
|
|
43
47
|
export function getId(installations) {
|
|
44
|
-
|
|
48
|
+
const internalInstallations = withModularDeprecationArg(installations);
|
|
49
|
+
return internalInstallations.getId.call(internalInstallations, MODULAR_DEPRECATION_ARG);
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
/**
|
|
48
|
-
*
|
|
49
|
-
* @param {boolean | undefined} forceRefresh
|
|
50
|
-
* @returns {Promise<string>}
|
|
53
|
+
* Returns a Firebase Installations auth token, identifying the current Firebase Installation.
|
|
51
54
|
*/
|
|
52
55
|
export function getToken(installations, forceRefresh) {
|
|
53
|
-
|
|
56
|
+
const internalInstallations = withModularDeprecationArg(installations);
|
|
57
|
+
return internalInstallations.getToken.call(internalInstallations, forceRefresh, MODULAR_DEPRECATION_ARG);
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
61
|
+
* Throw an error since react-native-firebase does not support this method.
|
|
62
|
+
*
|
|
63
|
+
* Sets a new callback that will get called when Installation ID changes. Returns an unsubscribe function that will remove the callback when called.
|
|
60
64
|
*/
|
|
61
65
|
export function onIdChange(_installations, _callback) {
|
|
62
66
|
throw new Error('onIdChange() is unsupported by the React Native Firebase SDK.');
|
|
63
67
|
}
|
|
68
|
+
//# sourceMappingURL=modular.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getApp","MODULAR_DEPRECATION_ARG","withModularDeprecationArg","installations","getInstallations","app","name","deleteInstallations","internalInstallations","delete","call","getId","getToken","forceRefresh","onIdChange","_installations","_callback","Error"],"sourceRoot":"../../lib","sources":["modular.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,MAAM,QAAQ,4BAA4B;AAEnD,SAASC,uBAAuB,QAAQ,+CAA+C;AAQvF,SAASC,yBAAyBA,CAACC,aAA4B,EAAyB;EACtF,OAAOA,aAAa;AACtB;;AAEA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAACC,GAAiB,EAAiB;EACjE,IAAIA,GAAG,EAAE;IACP,OAAOL,MAAM,CAACK,GAAG,CAACC,IAAI,CAAC,CAACH,aAAa,CAAC,CAAC;EACzC;EACA,OAAOH,MAAM,CAAC,CAAC,CAACG,aAAa,CAAC,CAAC;AACjC;;AAEA;AACA;AACA;AACA,OAAO,SAASI,mBAAmBA,CAACJ,aAA4B,EAAiB;EAC/E,MAAMK,qBAAqB,GAAGN,yBAAyB,CAACC,aAAa,CAAC;EACtE,OAAOK,qBAAqB,CAACC,MAAM,CAACC,IAAI,CAACF,qBAAqB,EAAEP,uBAAuB,CAAC;AAC1F;;AAEA;AACA;AACA;AACA,OAAO,SAASU,KAAKA,CAACR,aAA4B,EAAmB;EACnE,MAAMK,qBAAqB,GAAGN,yBAAyB,CAACC,aAAa,CAAC;EACtE,OAAOK,qBAAqB,CAACG,KAAK,CAACD,IAAI,CAACF,qBAAqB,EAAEP,uBAAuB,CAAC;AACzF;;AAEA;AACA;AACA;AACA,OAAO,SAASW,QAAQA,CAACT,aAA4B,EAAEU,YAAsB,EAAmB;EAC9F,MAAML,qBAAqB,GAAGN,yBAAyB,CAACC,aAAa,CAAC;EACtE,OAAOK,qBAAqB,CAACI,QAAQ,CAACF,IAAI,CACxCF,qBAAqB,EACrBK,YAAY,EACZZ,uBACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASa,UAAUA,CACxBC,cAA6B,EAC7BC,SAA6B,EACN;EACvB,MAAM,IAAIC,KAAK,CAAC,+DAA+D,CAAC;AAClF","ignoreList":[]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
/*
|
|
2
4
|
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
5
|
*
|
|
@@ -16,25 +18,15 @@
|
|
|
16
18
|
*/
|
|
17
19
|
|
|
18
20
|
import { isIOS } from '@react-native-firebase/app/dist/module/common';
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
FirebaseModule,
|
|
22
|
-
getFirebaseRoot,
|
|
23
|
-
} from '@react-native-firebase/app/dist/module/internal';
|
|
24
|
-
|
|
25
|
-
import version from './version';
|
|
26
|
-
|
|
21
|
+
import { createModuleNamespace, FirebaseModule, getFirebaseRoot } from '@react-native-firebase/app/dist/module/internal';
|
|
22
|
+
import { version } from "./version.js";
|
|
27
23
|
const statics = {};
|
|
28
|
-
|
|
29
24
|
const namespace = 'installations';
|
|
30
|
-
|
|
31
25
|
const nativeModuleName = 'RNFBInstallationsModule';
|
|
32
|
-
|
|
33
26
|
class FirebaseInstallationsModule extends FirebaseModule {
|
|
34
27
|
getId() {
|
|
35
28
|
return this.native.getId();
|
|
36
29
|
}
|
|
37
|
-
|
|
38
30
|
getToken(forceRefresh) {
|
|
39
31
|
if (!forceRefresh) {
|
|
40
32
|
return this.native.getToken(false);
|
|
@@ -42,11 +34,9 @@ class FirebaseInstallationsModule extends FirebaseModule {
|
|
|
42
34
|
return this.native.getToken(true);
|
|
43
35
|
}
|
|
44
36
|
}
|
|
45
|
-
|
|
46
37
|
delete() {
|
|
47
38
|
return this.native.delete();
|
|
48
39
|
}
|
|
49
|
-
|
|
50
40
|
onIdChange() {
|
|
51
41
|
if (isIOS) {
|
|
52
42
|
return () => {};
|
|
@@ -62,20 +52,21 @@ export const SDK_VERSION = version;
|
|
|
62
52
|
|
|
63
53
|
// import installations from '@react-native-firebase/installations';
|
|
64
54
|
// installations().X(...);
|
|
65
|
-
|
|
55
|
+
const installationsNamespace = createModuleNamespace({
|
|
66
56
|
statics,
|
|
67
57
|
version,
|
|
68
58
|
namespace,
|
|
69
59
|
nativeModuleName,
|
|
70
|
-
nativeEvents: false,
|
|
60
|
+
nativeEvents: false,
|
|
61
|
+
// TODO implement android id change listener: ['installations_id_changed'],
|
|
71
62
|
hasMultiAppSupport: true,
|
|
72
63
|
hasCustomUrlOrRegionSupport: false,
|
|
73
|
-
ModuleClass: FirebaseInstallationsModule
|
|
64
|
+
ModuleClass: FirebaseInstallationsModule
|
|
74
65
|
});
|
|
66
|
+
export default installationsNamespace;
|
|
75
67
|
|
|
76
68
|
// import installations, { firebase } from '@react-native-firebase/installations';
|
|
77
69
|
// installations().X(...);
|
|
78
70
|
// firebase.installations().X(...);
|
|
79
71
|
export const firebase = getFirebaseRoot();
|
|
80
|
-
|
|
81
|
-
export * from './modular';
|
|
72
|
+
//# sourceMappingURL=namespaced.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isIOS","createModuleNamespace","FirebaseModule","getFirebaseRoot","version","statics","namespace","nativeModuleName","FirebaseInstallationsModule","getId","native","getToken","forceRefresh","delete","onIdChange","SDK_VERSION","installationsNamespace","nativeEvents","hasMultiAppSupport","hasCustomUrlOrRegionSupport","ModuleClass","firebase"],"sourceRoot":"../../lib","sources":["namespaced.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,KAAK,QAAQ,+CAA+C;AACrE,SACEC,qBAAqB,EACrBC,cAAc,EACdC,eAAe,QACV,iDAAiD;AAGxD,SAASC,OAAO,QAAQ,cAAW;AAGnC,MAAMC,OAAO,GAAG,CAAC,CAAC;AAElB,MAAMC,SAAS,GAAG,eAAe;AACjC,MAAMC,gBAAgB,GAAG,yBAAyB;AAElD,MAAMC,2BAA2B,SAASN,cAAc,CAA0B;EAChFO,KAAKA,CAAA,EAAoB;IACvB,OAAO,IAAI,CAACC,MAAM,CAACD,KAAK,CAAC,CAAC;EAC5B;EAEAE,QAAQA,CAACC,YAAsB,EAAmB;IAChD,IAAI,CAACA,YAAY,EAAE;MACjB,OAAO,IAAI,CAACF,MAAM,CAACC,QAAQ,CAAC,KAAK,CAAC;IACpC,CAAC,MAAM;MACL,OAAO,IAAI,CAACD,MAAM,CAACC,QAAQ,CAAC,IAAI,CAAC;IACnC;EACF;EAEAE,MAAMA,CAAA,EAAkB;IACtB,OAAO,IAAI,CAACH,MAAM,CAACG,MAAM,CAAC,CAAC;EAC7B;EAEAC,UAAUA,CAAA,EAAe;IACvB,IAAId,KAAK,EAAE;MACT,OAAO,MAAM,CAAC,CAAC;IACjB;;IAEA;IACA,OAAO,MAAM,CAAC,CAAC;EACjB;AACF;;AAEA;AACA,OAAO,MAAMe,WAAW,GAAGX,OAAO;;AAElC;AACA;AACA,MAAMY,sBAAsB,GAAGf,qBAAqB,CAAC;EACnDI,OAAO;EACPD,OAAO;EACPE,SAAS;EACTC,gBAAgB;EAChBU,YAAY,EAAE,KAAK;EAAE;EACrBC,kBAAkB,EAAE,IAAI;EACxBC,2BAA2B,EAAE,KAAK;EAClCC,WAAW,EAAEZ;AACf,CAAC,CAAC;AAcF,eAAeQ,sBAAsB;;AAErC;AACA;AACA;AACA,OAAO,MAAMK,QAAQ,GACnBlB,eAAe,CAAC,CAKf","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../lib","sources":["types/installations.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../lib","sources":["types/internal.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this library except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Firebase Installations package for React Native.
|
|
21
|
+
*
|
|
22
|
+
* @firebase installations
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated Use the exported types directly instead.
|
|
26
|
+
* FirebaseInstallationsTypes namespace is kept for backwards compatibility.
|
|
27
|
+
*/
|
|
28
|
+
/* eslint-disable @typescript-eslint/no-namespace */
|
|
29
|
+
export let FirebaseInstallationsTypes;
|
|
30
|
+
/**
|
|
31
|
+
* Attach namespace to `firebase.` and `FirebaseApp.`.
|
|
32
|
+
*/
|
|
33
|
+
//# sourceMappingURL=namespaced.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["FirebaseInstallationsTypes"],"sourceRoot":"../../../lib","sources":["types/namespaced.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA,WACiBA,0BAA0B;AAgE3C;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["version"],"sourceRoot":"../../lib","sources":["version.ts"],"mappings":";;AAAA;AACA,OAAO,MAAMA,OAAO,GAAG,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/index.ts"],"names":[],"mappings":"AAkBA,mBAAmB,uBAAuB,CAAC;AAG3C,cAAc,WAAW,CAAC;AAG1B,YAAY,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AACrE,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { FirebaseApp } from '@react-native-firebase/app';
|
|
2
|
+
import type { IdChangeCallbackFn, IdChangeUnsubscribeFn, Installations } from './types/installations';
|
|
3
|
+
/**
|
|
4
|
+
* Returns an instance of Installations associated with the given FirebaseApp instance.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getInstallations(app?: FirebaseApp): Installations;
|
|
7
|
+
/**
|
|
8
|
+
* Deletes the Firebase Installation and all associated data.
|
|
9
|
+
*/
|
|
10
|
+
export declare function deleteInstallations(installations: Installations): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a Firebase Installation if there isn't one for the app and returns the Installation ID.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getId(installations: Installations): Promise<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Returns a Firebase Installations auth token, identifying the current Firebase Installation.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getToken(installations: Installations, forceRefresh?: boolean): Promise<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Throw an error since react-native-firebase does not support this method.
|
|
21
|
+
*
|
|
22
|
+
* Sets a new callback that will get called when Installation ID changes. Returns an unsubscribe function that will remove the callback when called.
|
|
23
|
+
*/
|
|
24
|
+
export declare function onIdChange(_installations: Installations, _callback: IdChangeCallbackFn): IdChangeUnsubscribeFn;
|
|
25
|
+
//# sourceMappingURL=modular.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modular.d.ts","sourceRoot":"","sources":["../../../lib/modular.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACrB,aAAa,EACd,MAAM,uBAAuB,CAAC;AAO/B;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,CAAC,EAAE,WAAW,GAAG,aAAa,CAKjE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAG/E;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAGnE;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,aAAa,EAAE,aAAa,EAAE,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAO9F;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,cAAc,EAAE,aAAa,EAC7B,SAAS,EAAE,kBAAkB,GAC5B,qBAAqB,CAEvB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactNativeFirebase } from '@react-native-firebase/app';
|
|
2
|
+
import type { FirebaseInstallationsTypes } from './types/namespaced';
|
|
3
|
+
export declare const SDK_VERSION = "25.0.0";
|
|
4
|
+
type InstallationsNamespace = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<FirebaseInstallationsTypes.Module, FirebaseInstallationsTypes.Statics> & {
|
|
5
|
+
installations: ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<FirebaseInstallationsTypes.Module, FirebaseInstallationsTypes.Statics>;
|
|
6
|
+
firebase: ReactNativeFirebase.Module;
|
|
7
|
+
app(name?: string): ReactNativeFirebase.FirebaseApp;
|
|
8
|
+
};
|
|
9
|
+
declare const _default: InstallationsNamespace;
|
|
10
|
+
export default _default;
|
|
11
|
+
export declare const firebase: ReactNativeFirebase.FirebaseNamespacedExport<"installations", FirebaseInstallationsTypes.Module, FirebaseInstallationsTypes.Statics, false>;
|
|
12
|
+
//# sourceMappingURL=namespaced.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespaced.d.ts","sourceRoot":"","sources":["../../../lib/namespaced.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGtE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAmCrE,eAAO,MAAM,WAAW,WAAU,CAAC;AAenC,KAAK,sBAAsB,GAAG,mBAAmB,CAAC,+BAA+B,CAC/E,0BAA0B,CAAC,MAAM,EACjC,0BAA0B,CAAC,OAAO,CACnC,GAAG;IACF,aAAa,EAAE,mBAAmB,CAAC,+BAA+B,CAChE,0BAA0B,CAAC,MAAM,EACjC,0BAA0B,CAAC,OAAO,CACnC,CAAC;IACF,QAAQ,EAAE,mBAAmB,CAAC,MAAM,CAAC;IACrC,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAAC,WAAW,CAAC;CACrD,CAAC;wBAEkD,sBAAsB;AAA1E,wBAA2E;AAK3E,eAAO,MAAM,QAAQ,EACa,mBAAmB,CAAC,wBAAwB,CAC1E,eAAe,EACf,0BAA0B,CAAC,MAAM,EACjC,0BAA0B,CAAC,OAAO,EAClC,KAAK,CACN,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FirebaseApp } from '@react-native-firebase/app';
|
|
2
|
+
/**
|
|
3
|
+
* An user defined callback function that gets called when Installations ID changes.
|
|
4
|
+
*/
|
|
5
|
+
export type IdChangeCallbackFn = (installationId: string) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Unsubscribe a callback function previously added via {@link IdChangeCallbackFn}.
|
|
8
|
+
*/
|
|
9
|
+
export type IdChangeUnsubscribeFn = () => void;
|
|
10
|
+
/**
|
|
11
|
+
* Firebase Installations service instance.
|
|
12
|
+
*/
|
|
13
|
+
export interface Installations {
|
|
14
|
+
/**
|
|
15
|
+
* The current `FirebaseApp` instance for this Firebase service.
|
|
16
|
+
*/
|
|
17
|
+
app: FirebaseApp;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=installations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installations.d.ts","sourceRoot":"","sources":["../../../../lib/types/installations.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,IAAI,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,GAAG,EAAE,WAAW,CAAC;CAClB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Installations } from './installations';
|
|
2
|
+
/** Optional final argument passed by modular API wrappers (MODULAR_DEPRECATION_ARG). */
|
|
3
|
+
export type InstallationsModularDeprecationArg = string;
|
|
4
|
+
export interface InstallationsInternal extends Installations {
|
|
5
|
+
delete(deprecationArg?: InstallationsModularDeprecationArg): Promise<void>;
|
|
6
|
+
getId(deprecationArg?: InstallationsModularDeprecationArg): Promise<string>;
|
|
7
|
+
getToken(forceRefresh?: boolean, deprecationArg?: InstallationsModularDeprecationArg): Promise<string>;
|
|
8
|
+
}
|
|
9
|
+
export interface RNFBInstallationsModule {
|
|
10
|
+
getId(): Promise<string>;
|
|
11
|
+
getToken(forceRefresh: boolean): Promise<string>;
|
|
12
|
+
delete(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
declare module '@react-native-firebase/app/dist/module/internal/NativeModules' {
|
|
15
|
+
interface ReactNativeFirebaseNativeModules {
|
|
16
|
+
RNFBInstallationsModule: RNFBInstallationsModule;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../../lib/types/internal.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,wFAAwF;AACxF,MAAM,MAAM,kCAAkC,GAAG,MAAM,CAAC;AAExD,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IAC1D,MAAM,CAAC,cAAc,CAAC,EAAE,kCAAkC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3E,KAAK,CAAC,cAAc,CAAC,EAAE,kCAAkC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5E,QAAQ,CACN,YAAY,CAAC,EAAE,OAAO,EACtB,cAAc,CAAC,EAAE,kCAAkC,GAClD,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACjD,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB;AAED,OAAO,QAAQ,+DAA+D,CAAC;IAC7E,UAAU,gCAAgC;QACxC,uBAAuB,EAAE,uBAAuB,CAAC;KAClD;CACF"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { ReactNativeFirebase } from '@react-native-firebase/app';
|
|
2
|
+
/**
|
|
3
|
+
* Firebase Installations package for React Native.
|
|
4
|
+
*
|
|
5
|
+
* @firebase installations
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Use the exported types directly instead.
|
|
9
|
+
* FirebaseInstallationsTypes namespace is kept for backwards compatibility.
|
|
10
|
+
*/
|
|
11
|
+
export declare namespace FirebaseInstallationsTypes {
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated Use the exported types directly instead.
|
|
14
|
+
*/
|
|
15
|
+
interface Statics {
|
|
16
|
+
SDK_VERSION: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The Firebase Installations service is available for the default app or a given app.
|
|
20
|
+
*
|
|
21
|
+
* @deprecated Use the exported types directly instead. FirebaseInstallationsTypes namespace is kept for backwards compatibility.
|
|
22
|
+
*/
|
|
23
|
+
interface Module extends ReactNativeFirebase.FirebaseModule {
|
|
24
|
+
/**
|
|
25
|
+
* The current `FirebaseApp` instance for this Firebase service.
|
|
26
|
+
*
|
|
27
|
+
* @deprecated Use the exported types directly instead.
|
|
28
|
+
*/
|
|
29
|
+
app: ReactNativeFirebase.FirebaseApp;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a Firebase Installation if there isn't one for the app and returns the Installation ID.
|
|
32
|
+
*
|
|
33
|
+
* @deprecated Use `getId()` from the modular API instead.
|
|
34
|
+
*/
|
|
35
|
+
getId(): Promise<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Retrieves a valid installation auth token.
|
|
38
|
+
*
|
|
39
|
+
* @deprecated Use `getToken()` from the modular API instead.
|
|
40
|
+
*/
|
|
41
|
+
getToken(forceRefresh?: boolean): Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* Deletes the Firebase Installation and all associated data from the Firebase backend.
|
|
44
|
+
*
|
|
45
|
+
* @deprecated Use `deleteInstallations()` from the modular API instead.
|
|
46
|
+
*/
|
|
47
|
+
delete(): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
type InstallationsNamespace = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<Module, Statics> & {
|
|
50
|
+
installations: ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<Module, Statics>;
|
|
51
|
+
firebase: ReactNativeFirebase.Module;
|
|
52
|
+
app(name?: string): ReactNativeFirebase.FirebaseApp;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
declare const defaultExport: FirebaseInstallationsTypes.InstallationsNamespace;
|
|
56
|
+
export declare const firebase: ReactNativeFirebase.Module & {
|
|
57
|
+
installations: typeof defaultExport;
|
|
58
|
+
app(name?: string): ReactNativeFirebase.FirebaseApp & {
|
|
59
|
+
installations(): FirebaseInstallationsTypes.Module;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
export default defaultExport;
|
|
63
|
+
/**
|
|
64
|
+
* Attach namespace to `firebase.` and `FirebaseApp.`.
|
|
65
|
+
*/
|
|
66
|
+
declare module '@react-native-firebase/app' {
|
|
67
|
+
namespace ReactNativeFirebase {
|
|
68
|
+
import FirebaseModuleWithStaticsAndApp = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp;
|
|
69
|
+
interface Module {
|
|
70
|
+
installations: FirebaseModuleWithStaticsAndApp<FirebaseInstallationsTypes.Module, FirebaseInstallationsTypes.Statics>;
|
|
71
|
+
}
|
|
72
|
+
interface FirebaseApp {
|
|
73
|
+
installations(): FirebaseInstallationsTypes.Module;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=namespaced.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespaced.d.ts","sourceRoot":"","sources":["../../../../lib/types/namespaced.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE;;;;GAIG;AACH;;;GAGG;AAEH,yBAAiB,0BAA0B,CAAC;IAC1C;;OAEG;IACH,UAAiB,OAAO;QACtB,WAAW,EAAE,MAAM,CAAC;KACrB;IAED;;;;OAIG;IACH,UAAiB,MAAO,SAAQ,mBAAmB,CAAC,cAAc;QAChE;;;;WAIG;QACH,GAAG,EAAE,mBAAmB,CAAC,WAAW,CAAC;QAErC;;;;WAIG;QACH,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;QAEzB;;;;WAIG;QACH,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAElD;;;;WAIG;QACH,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;KACzB;IAED,KAAY,sBAAsB,GAAG,mBAAmB,CAAC,+BAA+B,CACtF,MAAM,EACN,OAAO,CACR,GAAG;QACF,aAAa,EAAE,mBAAmB,CAAC,+BAA+B,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACpF,QAAQ,EAAE,mBAAmB,CAAC,MAAM,CAAC;QACrC,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAAC,WAAW,CAAC;KACrD,CAAC;CACH;AAED,OAAO,CAAC,MAAM,aAAa,EAAE,0BAA0B,CAAC,sBAAsB,CAAC;AAE/E,MAAM,CAAC,OAAO,CAAC,MAAM,QAAQ,EAAE,mBAAmB,CAAC,MAAM,GAAG;IAC1D,aAAa,EAAE,OAAO,aAAa,CAAC;IACpC,GAAG,CACD,IAAI,CAAC,EAAE,MAAM,GACZ,mBAAmB,CAAC,WAAW,GAAG;QAAE,aAAa,IAAI,0BAA0B,CAAC,MAAM,CAAA;KAAE,CAAC;CAC7F,CAAC;AAEF,eAAe,aAAa,CAAC;AAE7B;;GAEG;AACH,OAAO,QAAQ,4BAA4B,CAAC;IAC1C,UAAU,mBAAmB,CAAC;QAC5B,OAAO,+BAA+B,GAAG,mBAAmB,CAAC,+BAA+B,CAAC;QAE7F,UAAU,MAAM;YACd,aAAa,EAAE,+BAA+B,CAC5C,0BAA0B,CAAC,MAAM,EACjC,0BAA0B,CAAC,OAAO,CACnC,CAAC;SACH;QAED,UAAU,WAAW;YACnB,aAAa,IAAI,0BAA0B,CAAC,MAAM,CAAC;SACpD;KACF;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../lib/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
package/lib/index.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
// Export modular/public types.
|
|
19
|
+
export type * from './types/installations';
|
|
20
|
+
|
|
21
|
+
// Export modular API functions.
|
|
22
|
+
export * from './modular';
|
|
23
|
+
|
|
24
|
+
// Export namespaced API.
|
|
25
|
+
export type { FirebaseInstallationsTypes } from './types/namespaced';
|
|
26
|
+
export * from './namespaced';
|
|
27
|
+
export { default } from './namespaced';
|
package/lib/modular.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
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 { getApp } from '@react-native-firebase/app';
|
|
19
|
+
import type { FirebaseApp } from '@react-native-firebase/app';
|
|
20
|
+
import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/dist/module/common';
|
|
21
|
+
import type {
|
|
22
|
+
IdChangeCallbackFn,
|
|
23
|
+
IdChangeUnsubscribeFn,
|
|
24
|
+
Installations,
|
|
25
|
+
} from './types/installations';
|
|
26
|
+
import type { InstallationsInternal } from './types/internal';
|
|
27
|
+
|
|
28
|
+
function withModularDeprecationArg(installations: Installations): InstallationsInternal {
|
|
29
|
+
return installations as InstallationsInternal;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Returns an instance of Installations associated with the given FirebaseApp instance.
|
|
34
|
+
*/
|
|
35
|
+
export function getInstallations(app?: FirebaseApp): Installations {
|
|
36
|
+
if (app) {
|
|
37
|
+
return getApp(app.name).installations();
|
|
38
|
+
}
|
|
39
|
+
return getApp().installations();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Deletes the Firebase Installation and all associated data.
|
|
44
|
+
*/
|
|
45
|
+
export function deleteInstallations(installations: Installations): Promise<void> {
|
|
46
|
+
const internalInstallations = withModularDeprecationArg(installations);
|
|
47
|
+
return internalInstallations.delete.call(internalInstallations, MODULAR_DEPRECATION_ARG);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Creates a Firebase Installation if there isn't one for the app and returns the Installation ID.
|
|
52
|
+
*/
|
|
53
|
+
export function getId(installations: Installations): Promise<string> {
|
|
54
|
+
const internalInstallations = withModularDeprecationArg(installations);
|
|
55
|
+
return internalInstallations.getId.call(internalInstallations, MODULAR_DEPRECATION_ARG);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Returns a Firebase Installations auth token, identifying the current Firebase Installation.
|
|
60
|
+
*/
|
|
61
|
+
export function getToken(installations: Installations, forceRefresh?: boolean): Promise<string> {
|
|
62
|
+
const internalInstallations = withModularDeprecationArg(installations);
|
|
63
|
+
return internalInstallations.getToken.call(
|
|
64
|
+
internalInstallations,
|
|
65
|
+
forceRefresh,
|
|
66
|
+
MODULAR_DEPRECATION_ARG,
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Throw an error since react-native-firebase does not support this method.
|
|
72
|
+
*
|
|
73
|
+
* Sets a new callback that will get called when Installation ID changes. Returns an unsubscribe function that will remove the callback when called.
|
|
74
|
+
*/
|
|
75
|
+
export function onIdChange(
|
|
76
|
+
_installations: Installations,
|
|
77
|
+
_callback: IdChangeCallbackFn,
|
|
78
|
+
): IdChangeUnsubscribeFn {
|
|
79
|
+
throw new Error('onIdChange() is unsupported by the React Native Firebase SDK.');
|
|
80
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
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 { isIOS } from '@react-native-firebase/app/dist/module/common';
|
|
19
|
+
import {
|
|
20
|
+
createModuleNamespace,
|
|
21
|
+
FirebaseModule,
|
|
22
|
+
getFirebaseRoot,
|
|
23
|
+
} from '@react-native-firebase/app/dist/module/internal';
|
|
24
|
+
import type { ReactNativeFirebase } from '@react-native-firebase/app';
|
|
25
|
+
|
|
26
|
+
import { version } from './version';
|
|
27
|
+
import type { FirebaseInstallationsTypes } from './types/namespaced';
|
|
28
|
+
|
|
29
|
+
const statics = {};
|
|
30
|
+
|
|
31
|
+
const namespace = 'installations';
|
|
32
|
+
const nativeModuleName = 'RNFBInstallationsModule';
|
|
33
|
+
|
|
34
|
+
class FirebaseInstallationsModule extends FirebaseModule<typeof nativeModuleName> {
|
|
35
|
+
getId(): Promise<string> {
|
|
36
|
+
return this.native.getId();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
getToken(forceRefresh?: boolean): Promise<string> {
|
|
40
|
+
if (!forceRefresh) {
|
|
41
|
+
return this.native.getToken(false);
|
|
42
|
+
} else {
|
|
43
|
+
return this.native.getToken(true);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
delete(): Promise<void> {
|
|
48
|
+
return this.native.delete();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
onIdChange(): () => void {
|
|
52
|
+
if (isIOS) {
|
|
53
|
+
return () => {};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// TODO implement change listener on Android
|
|
57
|
+
return () => {};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// import { SDK_VERSION } from '@react-native-firebase/installations';
|
|
62
|
+
export const SDK_VERSION = version;
|
|
63
|
+
|
|
64
|
+
// import installations from '@react-native-firebase/installations';
|
|
65
|
+
// installations().X(...);
|
|
66
|
+
const installationsNamespace = createModuleNamespace({
|
|
67
|
+
statics,
|
|
68
|
+
version,
|
|
69
|
+
namespace,
|
|
70
|
+
nativeModuleName,
|
|
71
|
+
nativeEvents: false, // TODO implement android id change listener: ['installations_id_changed'],
|
|
72
|
+
hasMultiAppSupport: true,
|
|
73
|
+
hasCustomUrlOrRegionSupport: false,
|
|
74
|
+
ModuleClass: FirebaseInstallationsModule,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
type InstallationsNamespace = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<
|
|
78
|
+
FirebaseInstallationsTypes.Module,
|
|
79
|
+
FirebaseInstallationsTypes.Statics
|
|
80
|
+
> & {
|
|
81
|
+
installations: ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<
|
|
82
|
+
FirebaseInstallationsTypes.Module,
|
|
83
|
+
FirebaseInstallationsTypes.Statics
|
|
84
|
+
>;
|
|
85
|
+
firebase: ReactNativeFirebase.Module;
|
|
86
|
+
app(name?: string): ReactNativeFirebase.FirebaseApp;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export default installationsNamespace as unknown as InstallationsNamespace;
|
|
90
|
+
|
|
91
|
+
// import installations, { firebase } from '@react-native-firebase/installations';
|
|
92
|
+
// installations().X(...);
|
|
93
|
+
// firebase.installations().X(...);
|
|
94
|
+
export const firebase =
|
|
95
|
+
getFirebaseRoot() as unknown as ReactNativeFirebase.FirebaseNamespacedExport<
|
|
96
|
+
'installations',
|
|
97
|
+
FirebaseInstallationsTypes.Module,
|
|
98
|
+
FirebaseInstallationsTypes.Statics,
|
|
99
|
+
false
|
|
100
|
+
>;
|
|
@@ -0,0 +1,38 @@
|
|
|
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 type { FirebaseApp } from '@react-native-firebase/app';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* An user defined callback function that gets called when Installations ID changes.
|
|
22
|
+
*/
|
|
23
|
+
export type IdChangeCallbackFn = (installationId: string) => void;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Unsubscribe a callback function previously added via {@link IdChangeCallbackFn}.
|
|
27
|
+
*/
|
|
28
|
+
export type IdChangeUnsubscribeFn = () => void;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Firebase Installations service instance.
|
|
32
|
+
*/
|
|
33
|
+
export interface Installations {
|
|
34
|
+
/**
|
|
35
|
+
* The current `FirebaseApp` instance for this Firebase service.
|
|
36
|
+
*/
|
|
37
|
+
app: FirebaseApp;
|
|
38
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
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 file 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 type { Installations } from './installations';
|
|
19
|
+
|
|
20
|
+
/** Optional final argument passed by modular API wrappers (MODULAR_DEPRECATION_ARG). */
|
|
21
|
+
export type InstallationsModularDeprecationArg = string;
|
|
22
|
+
|
|
23
|
+
export interface InstallationsInternal extends Installations {
|
|
24
|
+
delete(deprecationArg?: InstallationsModularDeprecationArg): Promise<void>;
|
|
25
|
+
getId(deprecationArg?: InstallationsModularDeprecationArg): Promise<string>;
|
|
26
|
+
getToken(
|
|
27
|
+
forceRefresh?: boolean,
|
|
28
|
+
deprecationArg?: InstallationsModularDeprecationArg,
|
|
29
|
+
): Promise<string>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface RNFBInstallationsModule {
|
|
33
|
+
getId(): Promise<string>;
|
|
34
|
+
getToken(forceRefresh: boolean): Promise<string>;
|
|
35
|
+
delete(): Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare module '@react-native-firebase/app/dist/module/internal/NativeModules' {
|
|
39
|
+
interface ReactNativeFirebaseNativeModules {
|
|
40
|
+
RNFBInstallationsModule: RNFBInstallationsModule;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
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 type { ReactNativeFirebase } from '@react-native-firebase/app';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Firebase Installations package for React Native.
|
|
22
|
+
*
|
|
23
|
+
* @firebase installations
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated Use the exported types directly instead.
|
|
27
|
+
* FirebaseInstallationsTypes namespace is kept for backwards compatibility.
|
|
28
|
+
*/
|
|
29
|
+
/* eslint-disable @typescript-eslint/no-namespace */
|
|
30
|
+
export namespace FirebaseInstallationsTypes {
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated Use the exported types directly instead.
|
|
33
|
+
*/
|
|
34
|
+
export interface Statics {
|
|
35
|
+
SDK_VERSION: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The Firebase Installations service is available for the default app or a given app.
|
|
40
|
+
*
|
|
41
|
+
* @deprecated Use the exported types directly instead. FirebaseInstallationsTypes namespace is kept for backwards compatibility.
|
|
42
|
+
*/
|
|
43
|
+
export interface Module extends ReactNativeFirebase.FirebaseModule {
|
|
44
|
+
/**
|
|
45
|
+
* The current `FirebaseApp` instance for this Firebase service.
|
|
46
|
+
*
|
|
47
|
+
* @deprecated Use the exported types directly instead.
|
|
48
|
+
*/
|
|
49
|
+
app: ReactNativeFirebase.FirebaseApp;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Creates a Firebase Installation if there isn't one for the app and returns the Installation ID.
|
|
53
|
+
*
|
|
54
|
+
* @deprecated Use `getId()` from the modular API instead.
|
|
55
|
+
*/
|
|
56
|
+
getId(): Promise<string>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Retrieves a valid installation auth token.
|
|
60
|
+
*
|
|
61
|
+
* @deprecated Use `getToken()` from the modular API instead.
|
|
62
|
+
*/
|
|
63
|
+
getToken(forceRefresh?: boolean): Promise<string>;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Deletes the Firebase Installation and all associated data from the Firebase backend.
|
|
67
|
+
*
|
|
68
|
+
* @deprecated Use `deleteInstallations()` from the modular API instead.
|
|
69
|
+
*/
|
|
70
|
+
delete(): Promise<void>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export type InstallationsNamespace = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<
|
|
74
|
+
Module,
|
|
75
|
+
Statics
|
|
76
|
+
> & {
|
|
77
|
+
installations: ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<Module, Statics>;
|
|
78
|
+
firebase: ReactNativeFirebase.Module;
|
|
79
|
+
app(name?: string): ReactNativeFirebase.FirebaseApp;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
declare const defaultExport: FirebaseInstallationsTypes.InstallationsNamespace;
|
|
84
|
+
|
|
85
|
+
export declare const firebase: ReactNativeFirebase.Module & {
|
|
86
|
+
installations: typeof defaultExport;
|
|
87
|
+
app(
|
|
88
|
+
name?: string,
|
|
89
|
+
): ReactNativeFirebase.FirebaseApp & { installations(): FirebaseInstallationsTypes.Module };
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export default defaultExport;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Attach namespace to `firebase.` and `FirebaseApp.`.
|
|
96
|
+
*/
|
|
97
|
+
declare module '@react-native-firebase/app' {
|
|
98
|
+
namespace ReactNativeFirebase {
|
|
99
|
+
import FirebaseModuleWithStaticsAndApp = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp;
|
|
100
|
+
|
|
101
|
+
interface Module {
|
|
102
|
+
installations: FirebaseModuleWithStaticsAndApp<
|
|
103
|
+
FirebaseInstallationsTypes.Module,
|
|
104
|
+
FirebaseInstallationsTypes.Statics
|
|
105
|
+
>;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
interface FirebaseApp {
|
|
109
|
+
installations(): FirebaseInstallationsTypes.Module;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
package/lib/version.ts
ADDED
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-firebase/installations",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.0",
|
|
4
4
|
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
|
5
5
|
"description": "React Native Firebase - Installations",
|
|
6
|
-
"main": "
|
|
7
|
-
"types": "lib/index.d.ts",
|
|
6
|
+
"main": "./dist/module/index.js",
|
|
7
|
+
"types": "./dist/typescript/lib/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"build": "genversion --semi lib/version.
|
|
9
|
+
"build": "genversion --esm --semi lib/version.ts",
|
|
10
10
|
"build:clean": "rimraf android/build && rimraf ios/build",
|
|
11
|
-
"
|
|
11
|
+
"compile": "bob build",
|
|
12
|
+
"prepare": "yarn run build && yarn compile"
|
|
12
13
|
},
|
|
13
14
|
"repository": {
|
|
14
15
|
"type": "git",
|
|
@@ -22,11 +23,40 @@
|
|
|
22
23
|
"installations"
|
|
23
24
|
],
|
|
24
25
|
"peerDependencies": {
|
|
25
|
-
"@react-native-firebase/app": "
|
|
26
|
+
"@react-native-firebase/app": "25.0.0"
|
|
26
27
|
},
|
|
27
28
|
"publishConfig": {
|
|
28
29
|
"access": "public",
|
|
29
30
|
"provenance": true
|
|
30
31
|
},
|
|
31
|
-
"
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"react-native-builder-bob": "^0.40.13"
|
|
34
|
+
},
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"source": "./lib/index.ts",
|
|
38
|
+
"types": "./dist/typescript/lib/index.d.ts",
|
|
39
|
+
"default": "./dist/module/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./package.json": "./package.json"
|
|
42
|
+
},
|
|
43
|
+
"react-native-builder-bob": {
|
|
44
|
+
"source": "lib",
|
|
45
|
+
"output": "dist",
|
|
46
|
+
"targets": [
|
|
47
|
+
[
|
|
48
|
+
"module",
|
|
49
|
+
{
|
|
50
|
+
"esm": true
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
[
|
|
54
|
+
"typescript",
|
|
55
|
+
{
|
|
56
|
+
"tsc": "../../node_modules/.bin/tsc"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
"gitHead": "eac5bf5f3c80b158bf85b33789e4b64bfd16bbe1"
|
|
32
62
|
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.packages.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"rootDir": ".",
|
|
5
|
+
"paths": {
|
|
6
|
+
"@react-native-firebase/app/dist/module/common/*": ["../app/dist/typescript/lib/common/*"],
|
|
7
|
+
"@react-native-firebase/app/dist/module/common": ["../app/dist/typescript/lib/common"],
|
|
8
|
+
"@react-native-firebase/app/dist/module/internal/*": [
|
|
9
|
+
"../app/dist/typescript/lib/internal/*"
|
|
10
|
+
],
|
|
11
|
+
"@react-native-firebase/app/dist/module/internal": ["../app/dist/typescript/lib/internal"],
|
|
12
|
+
"@react-native-firebase/app/dist/module/internal/NativeModules": [
|
|
13
|
+
"../app/dist/typescript/lib/internal/NativeModules"
|
|
14
|
+
],
|
|
15
|
+
"@react-native-firebase/app": ["../app/dist/typescript/lib"]
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"include": ["lib/**/*.ts"],
|
|
19
|
+
"exclude": ["node_modules", "dist", "__tests__", "**/*.test.ts", "lib/**/*.d.ts"]
|
|
20
|
+
}
|
package/typedoc.json
CHANGED
package/lib/index.d.ts
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
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 Installations package for React Native.
|
|
22
|
-
*
|
|
23
|
-
* #### Example 1
|
|
24
|
-
*
|
|
25
|
-
* Access the firebase export from the `installations` package:
|
|
26
|
-
*
|
|
27
|
-
* ```js
|
|
28
|
-
* import { firebase } from '@react-native-firebase/installations';
|
|
29
|
-
*
|
|
30
|
-
* // firebase.installations().X
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* #### Example 2
|
|
34
|
-
*
|
|
35
|
-
* Using the default export from the `installations` package:
|
|
36
|
-
*
|
|
37
|
-
* ```js
|
|
38
|
-
* import installations from '@react-native-firebase/installations';
|
|
39
|
-
*
|
|
40
|
-
* // installations().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/installations';
|
|
50
|
-
*
|
|
51
|
-
* // firebase.installations().X
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* @firebase installations
|
|
55
|
-
*/
|
|
56
|
-
export namespace FirebaseInstallationsTypes {
|
|
57
|
-
import FirebaseModule = ReactNativeFirebase.FirebaseModule;
|
|
58
|
-
|
|
59
|
-
export interface Statics {
|
|
60
|
-
SDK_VERSION: string;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* The Firebase Installations service is available for the default app or a given app.
|
|
65
|
-
*
|
|
66
|
-
* #### Example 1
|
|
67
|
-
*
|
|
68
|
-
* Get the installations instance for the **default app**:
|
|
69
|
-
*
|
|
70
|
-
* ```js
|
|
71
|
-
* const installationsForDefaultApp = firebase.installations();
|
|
72
|
-
* ```
|
|
73
|
-
*
|
|
74
|
-
* #### Example 2
|
|
75
|
-
*
|
|
76
|
-
* Get the installations instance for a **secondary app**:
|
|
77
|
-
*˚
|
|
78
|
-
* ```js
|
|
79
|
-
* const otherApp = firebase.app('otherApp');
|
|
80
|
-
* const installationsForOtherApp = firebase.installations(otherApp);
|
|
81
|
-
* ```
|
|
82
|
-
*
|
|
83
|
-
*/
|
|
84
|
-
export class Module extends FirebaseModule {
|
|
85
|
-
/**
|
|
86
|
-
* The current `FirebaseApp` instance for this Firebase service.
|
|
87
|
-
*/
|
|
88
|
-
app: ReactNativeFirebase.FirebaseApp;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Creates a Firebase Installation if there isn't one for the app and
|
|
92
|
-
* returns the Installation ID. The installation ID is a globally unique,
|
|
93
|
-
* stable, URL-safe base64 string identifier that uniquely identifies the app instance.
|
|
94
|
-
* NOTE: If the application already has an existing FirebaseInstanceID then the InstanceID identifier will be used.
|
|
95
|
-
*
|
|
96
|
-
* @return Firebase Installation ID, this is an url-safe base64 string of a 128-bit integer.
|
|
97
|
-
*/
|
|
98
|
-
getId(): Promise<string>;
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Retrieves (locally or from the server depending on forceRefresh value) a valid installation auth token.
|
|
102
|
-
* An existing token may be invalidated or expire, so it is recommended to fetch the installation auth token
|
|
103
|
-
* before any request to external servers (it will be refreshed automatically for firebase API calls).
|
|
104
|
-
* This method should be used with forceRefresh == YES when e.g. a request with the previously fetched
|
|
105
|
-
* installation auth token failed with “Not Authorized” error.
|
|
106
|
-
*
|
|
107
|
-
* @param forceRefresh Options to get an auth token either by force refreshing or not.
|
|
108
|
-
* @return Firebase Installation Authentication Token
|
|
109
|
-
*/
|
|
110
|
-
getToken(forceRefresh?: boolean): Promise<string>;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Deletes the Firebase Installation and all associated data from the Firebase backend.
|
|
114
|
-
* This call may cause Firebase Cloud Messaging, Firebase Remote Config, Firebase Predictions,
|
|
115
|
-
* or Firebase In-App Messaging to not function properly. Fetching a new installations ID should
|
|
116
|
-
* reset all the dependent services to a stable state again. A network connection is required
|
|
117
|
-
* for the method to succeed. If it fails, the existing installation data remains untouched.
|
|
118
|
-
*/
|
|
119
|
-
delete(): Promise<void>;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* TODO implement id change listener for android.
|
|
123
|
-
*
|
|
124
|
-
* Sets a new callback that will get called when Installation ID changes.
|
|
125
|
-
* Returns an unsubscribe function that will remove the callback when called.
|
|
126
|
-
* Only the Android SDK supports sending ID change events.
|
|
127
|
-
*
|
|
128
|
-
* @android
|
|
129
|
-
*/
|
|
130
|
-
// onIdChange(callback: (installationId: string) => void): () => void;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
type InstallationsNamespace = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp<
|
|
135
|
-
FirebaseInstallationsTypes.Module,
|
|
136
|
-
FirebaseInstallationsTypes.Statics
|
|
137
|
-
> & {
|
|
138
|
-
firebase: ReactNativeFirebase.Module;
|
|
139
|
-
app(name?: string): ReactNativeFirebase.FirebaseApp;
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
declare const defaultExport: InstallationsNamespace;
|
|
143
|
-
|
|
144
|
-
export const firebase: ReactNativeFirebase.Module & {
|
|
145
|
-
installations: typeof defaultExport;
|
|
146
|
-
app(
|
|
147
|
-
name?: string,
|
|
148
|
-
): ReactNativeFirebase.FirebaseApp & { installations(): FirebaseInstallationsTypes.Module };
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
export * from './modular';
|
|
152
|
-
|
|
153
|
-
export default defaultExport;
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Attach namespace to `firebase.` and `FirebaseApp.`.
|
|
157
|
-
*/
|
|
158
|
-
declare module '@react-native-firebase/app' {
|
|
159
|
-
namespace ReactNativeFirebase {
|
|
160
|
-
import FirebaseModuleWithStaticsAndApp = ReactNativeFirebase.FirebaseModuleWithStaticsAndApp;
|
|
161
|
-
|
|
162
|
-
interface Module {
|
|
163
|
-
installations: FirebaseModuleWithStaticsAndApp<
|
|
164
|
-
FirebaseInstallationsTypes.Module,
|
|
165
|
-
FirebaseInstallationsTypes.Statics
|
|
166
|
-
>;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
interface FirebaseApp {
|
|
170
|
-
installations(): FirebaseInstallationsTypes.Module;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
package/lib/modular/index.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { ReactNativeFirebase } from '@react-native-firebase/app';
|
|
2
|
-
import { FirebaseInstallationsTypes } from '../index';
|
|
3
|
-
|
|
4
|
-
import FirebaseInstallations = FirebaseInstallationsTypes.Module;
|
|
5
|
-
/**
|
|
6
|
-
* Returns an instance of Installations associated with the given FirebaseApp instance.
|
|
7
|
-
*/
|
|
8
|
-
export declare function getInstallations(
|
|
9
|
-
app?: ReactNativeFirebase.FirebaseApp,
|
|
10
|
-
): FirebaseInstallations;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Deletes the Firebase Installation and all associated data.
|
|
14
|
-
*/
|
|
15
|
-
export declare function deleteInstallations(installations?: FirebaseInstallations): Promise<void>;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Creates a Firebase Installation if there isn't one for the app and returns the Installation ID.
|
|
19
|
-
*/
|
|
20
|
-
export declare function getId(installations: FirebaseInstallations): Promise<string>;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Returns a Firebase Installations auth token, identifying the current Firebase Installation.
|
|
24
|
-
*/
|
|
25
|
-
export declare function getToken(
|
|
26
|
-
installations: FirebaseInstallations,
|
|
27
|
-
forceRefresh?: boolean,
|
|
28
|
-
): Promise<string>;
|
|
29
|
-
|
|
30
|
-
declare type IdChangeCallbackFn = (installationId: string) => void;
|
|
31
|
-
declare type IdChangeUnsubscribeFn = () => void;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Throw an error since react-native-firebase does not support this method.
|
|
35
|
-
*
|
|
36
|
-
* Sets a new callback that will get called when Installation ID changes. Returns an unsubscribe function that will remove the callback when called.
|
|
37
|
-
*/
|
|
38
|
-
export declare function onIdChange(
|
|
39
|
-
installations: FirebaseInstallations,
|
|
40
|
-
callback: IdChangeCallbackFn,
|
|
41
|
-
): IdChangeUnsubscribeFn;
|
package/lib/version.js
DELETED