Skip to content

Commit

Permalink
feat: bump Firebase iOS SDK 10.5.0 (#10532)
Browse files Browse the repository at this point in the history
* feat: iOS SDK 10.5.0

* chore: add fake APNS token so manually run tests work as intended

* test(firebase_messaging): reinstate APNS token test

* test(firebase_messaging, iOS): wrap APNS token setting in iOS simulator build for dummy token

* test(messaging, macOS): update test app. needs push service enable & e2e test update

* ci: possible fix to provisioning profile for macOS

* ci: format yaml

* ci: permission to execute script

* Update install-custom-flutter.sh

* ci: install melos

* ci: flutter

* ci: get it working before updating to custom git branch

* ci: get it working before updating to custom git branch

* ci: permission

* ci: update to custom branch

* ci: update to custom branch

* ci: update to flutter repo

* ci: update to invertase repo

* ci: update to macos-provisioning branch

* ci: update to stable branch which contains change to build commands

* ci: update to clone at specific tag

* ci: update

* Delete install-custom-flutter.sh

* Delete install-melos.sh

* ci: revert macos workflow

* chore(messaging): allow certain iOS simulators to use actual `deviceToken`

* format

* ci: remove test app aps entitlements for macOS

* ci: remove code signing team

* test(firebase_auth): skip macOS tests failing because of keychain sharing

* fix analyze issues

* test: skip e2e test for android

* test: skip e2e test for macOS. iOS only.
  • Loading branch information
russellwheatley committed Mar 16, 2023
1 parent b48e095 commit c77fc4d
Show file tree
Hide file tree
Showing 8 changed files with 780 additions and 776 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# https://firebase.google.com/support/release-notes/ios
def firebase_sdk_version!()
'10.3.0'
'10.5.0'
end
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ @implementation FLTFirebaseMessagingPlugin {
NSObject<FlutterPluginRegistrar> *_registrar;
NSData *_apnsToken;
NSDictionary *_initialNotification;
bool simulatorToken;

// Used to track if everything as been initialized before answering
// to the initialNotification request
Expand Down Expand Up @@ -52,6 +53,7 @@ - (instancetype)initWithFlutterMethodChannel:(FlutterMethodChannel *)channel
_initialNotificationGathered = NO;
_channel = channel;
_registrar = registrar;
simulatorToken = false;
// Application
// Dart -> `getInitialNotification`
// ObjC -> Initialize other delegates & observers
Expand Down Expand Up @@ -998,6 +1000,22 @@ + (NSDictionary *)remoteMessageUserInfoToDict:(NSDictionary *)userInfo {
- (void)ensureAPNSTokenSetting {
FIRMessaging *messaging = [FIRMessaging messaging];

// With iOS SDK >= 10.4, an APNS token is required for getting/deleting token. We set a dummy
// token for the simulator for test environments. Historically, a simulator will not work for
// messaging. It will work if environment: iOS 16, running on macOS 13+ & silicon chip. We check
// the `_apnsToken` is nil. If it is, then the environment does not support and we set dummy
// token.
#if TARGET_IPHONE_SIMULATOR
if (simulatorToken == false && _apnsToken == nil) {
NSString *str = @"fake-apns-token-for-simulator";
NSData *data = [str dataUsingEncoding:NSUTF8StringEncoding];
[[FIRMessaging messaging] setAPNSToken:data type:FIRMessagingAPNSTokenTypeSandbox];
}
// We set this either way. We set dummy token once as `_apnsToken` could be nil next time
// which could possibly set dummy token unnecessarily
simulatorToken = true;
#endif

if (messaging.APNSToken == nil && _apnsToken != nil) {
#ifdef DEBUG
[[FIRMessaging messaging] setAPNSToken:_apnsToken type:FIRMessagingAPNSTokenTypeSandbox];
Expand Down
Loading

0 comments on commit c77fc4d

Please sign in to comment.