Skip to content

Commit 7961016

Browse files
feat: Bump Firebase iOS SDK to 9.2.0 (#8594)
1 parent 4338b7c commit 7961016

File tree

18 files changed

+206
-74
lines changed

18 files changed

+206
-74
lines changed

.github/workflows/e2e_tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ jobs:
114114

115115

116116
ios:
117-
runs-on: macos-latest
117+
runs-on: macos-12
118118
timeout-minutes: 45
119119
steps:
120120
- uses: actions/checkout@v2

packages/cloud_firestore/cloud_firestore/example/ios/Podfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ target 'Runner' do
5151
end
5252
end
5353

54-
pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => "#{firebase_sdk_version}"
54+
# TODO - replace with #{firebase_sdk_version} once it has been released on: https://github.com/invertase/firestore-ios-sdk-frameworks.git
55+
pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :branch => 'main'
5556
end
5657

5758
post_install do |installer|

packages/cloud_firestore/cloud_firestore/example/macos/Podfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ target 'Runner' do
5050
end
5151
end
5252

53-
pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => "#{firebase_sdk_version}"
53+
# TODO - replace with #{firebase_sdk_version} once it has been released on: https://github.com/invertase/firestore-ios-sdk-frameworks.git
54+
pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :branch => 'main'
5455
end
5556

5657
post_install do |installer|

packages/cloud_functions/cloud_functions/ios/Classes/FLTFirebaseFunctionsPlugin.m

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,17 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)flutter
5050
NSMutableDictionary *httpsErrorDetails = [NSMutableDictionary dictionary];
5151
NSString *httpsErrorCode = [NSString stringWithFormat:@"%ld", error.code];
5252
NSString *httpsErrorMessage = error.localizedDescription;
53-
if (error.domain == FIRFunctionsErrorDomain) {
53+
// FIRFunctionsErrorDomain has been removed and replaced with Swift implementation
54+
// https://github.com/firebase/firebase-ios-sdk/blob/master/FirebaseFunctions/Sources/FunctionsError.swift#L18
55+
NSString *errorDomain = @"com.firebase.functions";
56+
// FIRFunctionsErrorDetailsKey has been deprecated and replaced with Swift implementation
57+
// https://github.com/firebase/firebase-ios-sdk/blob/master/FirebaseFunctions/Sources/FunctionsError.swift#L21
58+
NSString *detailsKey = @"details";
59+
// See also https://github.com/firebase/firebase-ios-sdk/pull/9569
60+
if ([error.domain isEqualToString:errorDomain]) {
5461
httpsErrorCode = [self mapFunctionsErrorCodes:error.code];
55-
if (error.userInfo[FIRFunctionsErrorDetailsKey] != nil) {
56-
httpsErrorDetails[@"additionalData"] = error.userInfo[FIRFunctionsErrorDetailsKey];
62+
if (error.userInfo[detailsKey] != nil) {
63+
httpsErrorDetails[@"additionalData"] = error.userInfo[detailsKey];
5764
}
5865
}
5966
httpsErrorDetails[@"code"] = httpsErrorCode;
@@ -82,7 +89,8 @@ - (void)httpsFunctionCall:(id)arguments withMethodCallResult:(FLTFirebaseMethodC
8289
FIRApp *app = [FLTFirebasePlugin firebaseAppNamed:appName];
8390
FIRFunctions *functions = [FIRFunctions functionsForApp:app region:region];
8491
if (origin != nil && origin != (id)[NSNull null]) {
85-
[functions useFunctionsEmulatorOrigin:origin];
92+
NSURL *url = [NSURL URLWithString:origin];
93+
[functions useEmulatorWithHost:[url host] port:[[url port] intValue]];
8694
}
8795

8896
FIRHTTPSCallable *function = [functions HTTPSCallableWithName:functionName];

packages/firebase_app_installations/firebase_app_installations/ios/Classes/FirebaseInstallationsPlugin.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ public class FirebaseInstallationsPluginSwift: FLTFirebasePlugin, FlutterPlugin
112112
}
113113

114114
internal func mapInstallationsErrorCodes(code: UInt) -> NSString {
115-
let error = InstallationsErrorCode(rawValue: code) ?? InstallationsErrorCode.unknown
115+
let error = InstallationsErrorCode(InstallationsErrorCode
116+
.Code(rawValue: Int(code)) ?? InstallationsErrorCode.unknown)
116117

117118
switch error {
118119
case InstallationsErrorCode.invalidConfiguration:

packages/firebase_core/firebase_core/ios/Classes/FLTFirebasePluginRegistry.m

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33
// found in the LICENSE file.
44

55
#import "FLTFirebasePluginRegistry.h"
6+
7+
#if __has_include(<FirebaseCore/FIRAppInternal.h>)
68
#import <FirebaseCore/FIRAppInternal.h>
9+
#define REGISTER_LIB
10+
#elif __has_include(<FirebaseCoreExtension/FIRAppInternal.h>)
11+
#import <FirebaseCoreExtension/FIRAppInternal.h>
12+
#define REGISTER_LIB
13+
#endif
714

815
@implementation FLTFirebasePluginRegistry {
916
NSMutableDictionary<NSString *, id<FLTFirebasePlugin>> *registeredPlugins;
@@ -30,9 +37,10 @@ + (instancetype)sharedInstance {
3037

3138
- (void)registerFirebasePlugin:(id<FLTFirebasePlugin>)firebasePlugin {
3239
// Register the library with the Firebase backend.
40+
#ifdef REGISTER_LIB
3341
[FIRApp registerLibrary:[firebasePlugin firebaseLibraryName]
3442
withVersion:[firebasePlugin firebaseLibraryVersion]];
35-
43+
#endif
3644
// Store the plugin delegate for later usage.
3745
registeredPlugins[[firebasePlugin flutterChannelName]] = firebasePlugin;
3846
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# https://firebase.google.com/support/release-notes/ios
22
def firebase_sdk_version!()
3-
'8.15.0'
3+
'9.2.0'
44
end

packages/firebase_dynamic_links/firebase_dynamic_links/ios/Classes/FLTFirebaseDynamicLinksPlugin.m

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,17 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
128128
code = errorDetails[kCode];
129129
message = errorDetails[kMessage];
130130
details = errorDetails;
131+
132+
if (errorDetails[@"additionalData"][NSLocalizedFailureReasonErrorKey] != nil) {
133+
// This stops an uncaught type cast exception in dart
134+
NSMutableDictionary *temp = [errorDetails[@"additionalData"] mutableCopy];
135+
[temp removeObjectForKey:NSLocalizedFailureReasonErrorKey];
136+
details = temp;
137+
// provides a useful message to the user. e.g. "Universal link URL could not be parsed".
138+
if ([message containsString:@"unknown error"]) {
139+
message = errorDetails[@"additionalData"][NSLocalizedFailureReasonErrorKey];
140+
}
141+
}
131142
} else {
132143
details = @{
133144
kCode : code,

packages/firebase_ml_model_downloader/firebase_ml_model_downloader/macos/firebase_ml_model_downloader.podspec

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ Pod::Spec.new do |s|
5252

5353
# Firebase dependencies
5454
s.dependency 'Firebase/CoreOnly', "~> #{firebase_sdk_version}"
55-
# TODO(Salakar): Direct pod depency here instead of the Firebase subspec due to:
56-
# https://github.com/firebase/firebase-ios-sdk/pull/9186 (pending acceptance / merge)
57-
s.dependency 'FirebaseMLModelDownloader', '~> 8.10.0-beta'
55+
s.dependency 'Firebase/MLModelDownloader', firebase_sdk_version
5856
s.static_framework = true
5957
s.swift_version = '5.0'
6058
s.pod_target_xcconfig = {
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Uncomment this line to define a global platform for your project
2+
# platform :ios, '9.0'
3+
4+
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5+
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6+
7+
project 'Runner', {
8+
'Debug' => :debug,
9+
'Profile' => :release,
10+
'Release' => :release,
11+
}
12+
13+
def flutter_root
14+
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15+
unless File.exist?(generated_xcode_build_settings_path)
16+
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17+
end
18+
19+
File.foreach(generated_xcode_build_settings_path) do |line|
20+
matches = line.match(/FLUTTER_ROOT\=(.*)/)
21+
return matches[1].strip if matches
22+
end
23+
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24+
end
25+
26+
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27+
28+
flutter_ios_podfile_setup
29+
30+
target 'Runner' do
31+
use_frameworks!
32+
use_modular_headers!
33+
34+
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35+
end
36+
37+
post_install do |installer|
38+
installer.pods_project.targets.each do |target|
39+
flutter_additional_ios_build_settings(target)
40+
end
41+
end

0 commit comments

Comments
 (0)