Skip to content

Commit

Permalink
fix(app-check, activate): return Promise(void) on ios not void
Browse files Browse the repository at this point in the history
previously iOS was not returning a promise, but Android was, documentation
was for a Promise to be returned

Fixes #6052 - Thanks to @birdofpreyru
  • Loading branch information
mikehardy committed Feb 7, 2022
1 parent 65cac09 commit 0f23441
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 6 additions & 6 deletions packages/app-check/e2e/appcheck.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ describe('appCheck()', function () {
});
});
describe('activate())', function () {
it('should activate with default provider and default token refresh', async function () {
try {
await firebase.appCheck().activate('ignored', false);
} catch (e) {
return Promise.reject(e);
}
it('should activate with default provider and default token refresh', function () {
firebase
.appCheck()
.activate('ignored', false)
.then(value => expect(value).toBe(undefined))
.catch(e => new Error('app-check activate failed? ' + e));
});
});
});
5 changes: 4 additions & 1 deletion packages/app-check/ios/RNFBAppCheck/RNFBAppCheckModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ - (dispatch_queue_t)methodQueue {
RCT_EXPORT_METHOD(activate
: (FIRApp *)firebaseApp
: (nonnull NSString *)siteKeyOrProvider
: (BOOL)isTokenAutoRefreshEnabled) {
: (BOOL)isTokenAutoRefreshEnabled
: (RCTPromiseResolveBlock)resolve rejecter
: (RCTPromiseRejectBlock)reject) {
// From SDK docs:
// NOTE: Make sure to call this method before FirebaseApp.configure().
// If this method is called after configuring Firebase, the changes will not take effect.
Expand All @@ -49,6 +51,7 @@ - (dispatch_queue_t)methodQueue {

FIRAppCheck *appCheck = [FIRAppCheck appCheckWithApp:firebaseApp];
appCheck.isTokenAutoRefreshEnabled = isTokenAutoRefreshEnabled;
resolve([NSNull null]);
}

RCT_EXPORT_METHOD(setTokenAutoRefreshEnabled
Expand Down

0 comments on commit 0f23441

Please sign in to comment.