@react-native-firebase/remote-config 13.0.0 → 14.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 CHANGED
@@ -3,6 +3,26 @@
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
+ # [14.0.0](https://github.com/invertase/react-native-firebase/compare/v13.1.1...v14.0.0) (2021-12-14)
7
+
8
+ **Note:** Version bump only for package @react-native-firebase/remote-config
9
+
10
+ ## [13.1.1](https://github.com/invertase/react-native-firebase/compare/v13.1.0...v13.1.1) (2021-12-14)
11
+
12
+ ### Bug Fixes
13
+
14
+ - **deps:** AGP7.0.4, firebase-android-sdk 29.0.2, javascript deps ([55d0a36](https://github.com/invertase/react-native-firebase/commit/55d0a36a0addc54e347f26bb8ee88bb38b0fa4a6))
15
+
16
+ # [13.1.0](https://github.com/invertase/react-native-firebase/compare/v13.0.1...v13.1.0) (2021-12-02)
17
+
18
+ ### Bug Fixes
19
+
20
+ - **remote-config, getAll:** init with empty config ([232d860](https://github.com/invertase/react-native-firebase/commit/232d860831dd39b728e3a01471ec30e0c2701c5c)), closes [/github.com/firebase/firebase-js-sdk/blob/acc58102d4429ce0593ec22192e76018e9d16ed7/packages/remote-config/test/remote_config.test.ts#L333-L335](https://github.com//github.com/firebase/firebase-js-sdk/blob/acc58102d4429ce0593ec22192e76018e9d16ed7/packages/remote-config/test/remote_config.test.ts/issues/L333-L335) [#5854](https://github.com/invertase/react-native-firebase/issues/5854)
21
+
22
+ ## [13.0.1](https://github.com/invertase/react-native-firebase/compare/v13.0.0...v13.0.1) (2021-11-05)
23
+
24
+ **Note:** Version bump only for package @react-native-firebase/remote-config
25
+
6
26
  # [13.0.0](https://github.com/invertase/react-native-firebase/compare/v12.9.3...v13.0.0) (2021-10-31)
7
27
 
8
28
  ### Bug Fixes
@@ -0,0 +1,109 @@
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
+ import { firebase } from '../lib';
18
+
19
+ describe('remoteConfig()', function () {
20
+ describe('namespace', function () {
21
+ it('accessible from firebase.app()', function () {
22
+ const app = firebase.app();
23
+ expect(app.remoteConfig()).toBeDefined();
24
+ expect(app.remoteConfig().app).toEqual(app);
25
+ });
26
+
27
+ it('supports multiple apps', async function () {
28
+ expect(firebase.remoteConfig().app.name).toEqual('[DEFAULT]');
29
+ expect(firebase.app('secondaryFromNative').remoteConfig().app.name).toEqual(
30
+ 'secondaryFromNative',
31
+ );
32
+ });
33
+ });
34
+
35
+ describe('statics', function () {
36
+ it('LastFetchStatus', function () {
37
+ expect(firebase.remoteConfig.LastFetchStatus).toBeDefined();
38
+ expect(firebase.remoteConfig.LastFetchStatus.FAILURE).toEqual('failure');
39
+ expect(firebase.remoteConfig.LastFetchStatus.SUCCESS).toEqual('success');
40
+ expect(firebase.remoteConfig.LastFetchStatus.NO_FETCH_YET).toEqual('no_fetch_yet');
41
+ expect(firebase.remoteConfig.LastFetchStatus.THROTTLED).toEqual('throttled');
42
+ });
43
+
44
+ it('ValueSource', function () {
45
+ expect(firebase.remoteConfig.ValueSource).toBeDefined();
46
+ expect(firebase.remoteConfig.ValueSource.REMOTE).toEqual('remote');
47
+ expect(firebase.remoteConfig.ValueSource.STATIC).toEqual('static');
48
+ expect(firebase.remoteConfig.ValueSource.DEFAULT).toEqual('default');
49
+ });
50
+ });
51
+
52
+ describe('fetch()', function () {
53
+ it('it throws if expiration is not a number', function () {
54
+ expect(() => {
55
+ // @ts-ignore - incorrect argument on purpose to check validation
56
+ firebase.remoteConfig().fetch('foo');
57
+ }).toThrow('must be a number value');
58
+ });
59
+ });
60
+
61
+ describe('setConfigSettings()', function () {
62
+ it('it throws if arg is not an object', async function () {
63
+ expect(() => {
64
+ // @ts-ignore - incorrect argument on purpose to check validation
65
+ firebase.remoteConfig().setConfigSettings('not an object');
66
+ }).toThrow('must set an object');
67
+ });
68
+
69
+ it('throws if minimumFetchIntervalMillis is not a number', async function () {
70
+ expect(() => {
71
+ // @ts-ignore - incorrect argument on purpose to check validation
72
+ firebase.remoteConfig().setConfigSettings({ minimumFetchIntervalMillis: 'potato' });
73
+ }).toThrow('must be a number type in milliseconds.');
74
+ });
75
+
76
+ it('throws if fetchTimeMillis is not a number', function () {
77
+ expect(() => {
78
+ // @ts-ignore - incorrect argument on purpose to check validation
79
+ firebase.remoteConfig().setConfigSettings({ fetchTimeMillis: 'potato' });
80
+ }).toThrow('must be a number type in milliseconds.');
81
+ });
82
+ });
83
+
84
+ describe('setDefaults()', function () {
85
+ it('it throws if defaults object not provided', function () {
86
+ expect(() => {
87
+ // @ts-ignore - incorrect argument on purpose to check validation
88
+ firebase.remoteConfig().setDefaults('not an object');
89
+ }).toThrow('must be an object.');
90
+ });
91
+ });
92
+
93
+ describe('setDefaultsFromResource()', function () {
94
+ it('throws if resourceName is not a string', function () {
95
+ expect(() => {
96
+ // @ts-ignore - incorrect argument on purpose to check validation
97
+ firebase.remoteConfig().setDefaultsFromResource(1337);
98
+ }).toThrow('must be a string value');
99
+ });
100
+ });
101
+
102
+ describe('getAll() should not crash', function () {
103
+ it('should return an empty object pre-fetch, pre-defaults', function () {
104
+ const config = firebase.remoteConfig().getAll();
105
+ expect(config).toBeDefined();
106
+ expect(config).toEqual({});
107
+ });
108
+ });
109
+ });
@@ -11,7 +11,7 @@ buildscript {
11
11
  }
12
12
 
13
13
  dependencies {
14
- classpath("com.android.tools.build:gradle:7.0.3")
14
+ classpath("com.android.tools.build:gradle:7.0.4")
15
15
  }
16
16
  }
17
17
  }
package/lib/index.js CHANGED
@@ -58,6 +58,7 @@ class FirebaseConfigModule extends FirebaseModule {
58
58
  minimumFetchIntervalMillis: 43200000,
59
59
  };
60
60
  this._lastFetchTime = -1;
61
+ this._values = {};
61
62
  }
62
63
 
63
64
  getValue(key) {
@@ -89,9 +90,7 @@ class FirebaseConfigModule extends FirebaseModule {
89
90
 
90
91
  getAll() {
91
92
  const values = {};
92
-
93
93
  Object.keys(this._values).forEach(key => (values[key] = this.getValue(key)));
94
-
95
94
  return values;
96
95
  }
97
96
 
package/lib/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- module.exports = '13.0.0';
2
+ module.exports = '14.0.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-firebase/remote-config",
3
- "version": "13.0.0",
3
+ "version": "14.0.0",
4
4
  "author": "Invertase <oss@invertase.io> (http://invertase.io)",
5
5
  "description": "React Native Firebase - React Native Firebase provides native integration with Remote Config, allowing you to change the appearance and/or functionality of your app without requiring an app update.",
6
6
  "main": "lib/index.js",
@@ -24,11 +24,11 @@
24
24
  "remote-config"
25
25
  ],
26
26
  "peerDependencies": {
27
- "@react-native-firebase/analytics": "13.0.0",
28
- "@react-native-firebase/app": "13.0.0"
27
+ "@react-native-firebase/analytics": "14.0.0",
28
+ "@react-native-firebase/app": "14.0.0"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public"
32
32
  },
33
- "gitHead": "4e8e81cca023023332dceeb590f886430ae59016"
33
+ "gitHead": "fcf375a763004967f94da70940d9f1aad591ef7a"
34
34
  }