Skip to content

Commit

Permalink
fix(app, ios): incorporate firebase-ios-sdk 10.12.0 (#7231)
Browse files Browse the repository at this point in the history
* fix(app, ios): incorporate firebase-ios-sdk 10.12.0

* fix(remote-config, ios): remove workarounds for realtime updates on iOS

with the new firebase-ios-sdk 10.12.0 all the upstream fixes required have
been incorporated + released
  • Loading branch information
mikehardy authored and exaby73 committed Aug 8, 2023
1 parent 6b84e67 commit 2b135c9
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 170 deletions.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ Open your projects `/ios/Podfile` and add any of the globals shown below to the

```ruby
# Override Firebase SDK Version
$FirebaseSDKVersion = '10.11.0'
$FirebaseSDKVersion = '10.12.0'
```

Once changed, reinstall your projects pods via pod install and rebuild your project with `npx react-native run-ios`.
Expand Down
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
},
"sdkVersions": {
"ios": {
"firebase": "10.11.0",
"firebase": "10.12.0",
"iosTarget": "11.0",
"macosTarget": "10.13"
},
Expand Down
33 changes: 0 additions & 33 deletions packages/remote-config/e2e/config.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -804,8 +804,6 @@ describe('remoteConfig() modular', function () {
const callback = sinon.spy();
const unsubscribe = onConfigUpdated(config, (event, error) => callback(event, error));
unsubscribers.push(unsubscribe);
// give the SDK<->server time to settle, otherwise iOS catches error code 8003
await Utils.sleep(10000);
// Update the template using our cloud function, so our listeners are called
let response = await updateTemplate({
operations: {
Expand All @@ -818,26 +816,8 @@ describe('remoteConfig() modular', function () {
await Utils.spyToBeCalledTimesAsync(callback, 1, 60000);
should(callback.callCount).equal(1);
let callbackError = callback.getCall(0).args[1];

if (
device.getPlatform() === 'ios' &&
callbackError !== undefined &&
callbackError.code === 'config_update_not_fetched'
) {
// FIXME indicates known issue firebase-ios-sdk#11462 - should be fixed in release 10.12.0
// not much we can do, skip the test, but remove this with adoption of 10.12.0
// eslint-disable-next-line no-console
console.error('firebas-ios-sdk#11462 encountered, skipping test');
// eslint-disable-next-line no-console
console.error('error contents: ' + JSON.stringify(callback.getCall(0).args[1]));
this.skip();
}
should(callbackError).equal(undefined, 'error ' + JSON.stringify(callbackError));
let callbackEvent = callback.getCall(0).args[0];
// This may sometimes flake if the device does not have the correct template fetched yet,
// which may happen if fetch is throttled and a realtime listener hasn't triggered. A re-try
// does reliably clear it though and react-native-firebase re-tries 4 times so it is self-healing
// should(callbackEvent.updatedKeys.length).equal(1);
should(callbackEvent.updatedKeys.includes('rttest_param1')).equal(
true,
'updated param not in callback updated keys set',
Expand Down Expand Up @@ -877,19 +857,6 @@ describe('remoteConfig() modular', function () {
await Utils.spyToBeCalledTimesAsync(callback3, 1, 60000);
[callback1, callback2, callback3].forEach(callback => {
should(callback.callCount).equal(1);
if (
device.getPlatform() === 'ios' &&
callback.getCall(0).args[1] !== undefined &&
callback.getCall(0).args[1].code === 'config_update_not_fetched'
) {
// FIXME indicates known issue firebase-ios-sdk#11462 - should be fixed in release 10.12.0
// not much we can do, skip the test, but remove this with adoption of 10.12.0
// eslint-disable-next-line no-console
console.error('firebas-ios-sdk#11462 encountered, skipping test');
// eslint-disable-next-line no-console
console.error('error contents: ' + JSON.stringify(callback.getCall(0).args[1]));
this.skip();
}
should(callback.getCall(0).args[1]).equal(
undefined,
'error ' + JSON.stringify(callback.getCall(0).args[1]),
Expand Down
8 changes: 1 addition & 7 deletions packages/remote-config/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,7 @@ class FirebaseConfigModule extends FirebaseModule {
}
subscription.remove();
this._configUpdateListenerCount--;
// In firebase-ios-sdk, it appears listener removal fails, so our native listeners accumulate
// if we try to remove them. Temporarily allow iOS native listener to stay active forever after
// first subscription for an app, until issue #11458 in firebase-ios-sdk repo is resolved.
// react-native-firebase native subscribe code won't add multiple native listeners for same app,
// so this prevents listener accumulation but means the web socket on iOS will never close.
// TODO: Remove when firebase-ios-sdk 10.12.0 is adopted, the PR to fix it should be included
if (this._configUpdateListenerCount === 0 && Platform.OS !== 'ios') {
if (this._configUpdateListenerCount === 0) {
this.native.removeConfigUpdateRegistration();
}
};
Expand Down
Loading

0 comments on commit 2b135c9

Please sign in to comment.