Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Bump Firebase iOS SDK to 9.2.0 #8594

Merged
merged 43 commits into from Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
18127b9
feat: Bump Firebase iOS SDK to 9.0.0.
russellwheatley May 5, 2022
409c1fb
Merge branch 'master' into @russell/firebase-ios-sdk-9.0.0
russellwheatley May 31, 2022
4a8e250
feat: iOS SDK verison 9.1.0
russellwheatley May 31, 2022
4a7761a
fix(core): change header in iOS
russellwheatley Jun 1, 2022
372be2c
ci: macos-12 for iOS sdk >= 9
russellwheatley Jun 7, 2022
f6fd292
fix: iOS SDK v9 update
russellwheatley Jun 7, 2022
5d9ddcb
Merge remote-tracking branch 'origin/@russell/firebase-ios-sdk-9.0.0'…
russellwheatley Jun 7, 2022
4f049ca
feat(functions): update to match iOS SDK v9
russellwheatley Jun 8, 2022
b3644e3
feat: iOS sdk 9.2.0
russellwheatley Jun 23, 2022
ed96826
fix: register library for iOS define macro
russellwheatley Jun 23, 2022
73542fe
fix(functions, ios): silent crash fix
russellwheatley Jun 23, 2022
5b8c76c
fix(dynamic-links, ios): fix uncaught type cast error
russellwheatley Jun 23, 2022
04519bf
tests(dynamic-links, ios): ios 9 changes responses
russellwheatley Jun 23, 2022
3c92f0f
tests(ios): firestore pod breaks using v9 SDK
russellwheatley Jun 23, 2022
4ffaf78
tests(dynamic_links,ios): update associated domain
russellwheatley Jun 23, 2022
e3245f2
tests(dynamic_links,ios): update xproj
russellwheatley Jun 23, 2022
e8a46bc
tests(dynamic_links,ios): Info.plist
russellwheatley Jun 23, 2022
fe14268
chore: rm nslogs
russellwheatley Jun 27, 2022
2a9ccdc
fix(functions, ios): errorDomain string comparison
russellwheatley Jun 27, 2022
601a43c
tests(firestore, ios): fix test runner
russellwheatley Jun 27, 2022
17910da
format
russellwheatley Jun 27, 2022
9c7b2f3
tests(performance,ios): example Podfile needed updating
russellwheatley Jun 27, 2022
3ee4dda
format
russellwheatley Jun 27, 2022
ac5dffc
ci: temp rm pod cache to fix iOS CI
russellwheatley Jun 28, 2022
e64d50f
ci: update timeout
russellwheatley Jun 28, 2022
e112767
ci(ios): reinstate cached pods
russellwheatley Jun 28, 2022
7bf090d
ci(ios): fix
russellwheatley Jun 28, 2022
20dbedc
ci: test without cached pods but with Firestore pod
russellwheatley Jun 28, 2022
858ab9c
ci: fix
russellwheatley Jun 28, 2022
dc43139
fix: FirebaseFirestore precompiled pod needs certain archs excluded
russellwheatley Jun 29, 2022
9fac496
update branch for FirebaseFirestore pod
russellwheatley Jun 29, 2022
ab5ff54
reinstate pod cache
russellwheatley Jun 29, 2022
c1aa13a
ci(remote-config): fetchAndActivate() is hanging on ci
russellwheatley Jun 29, 2022
08d6ef1
ci: rm fetch()
russellwheatley Jun 29, 2022
e6f62e5
ci: rm activate()
russellwheatley Jun 29, 2022
a21127c
fix(ml_downloader): latest dependency used for macOS
russellwheatley Jun 30, 2022
7b5b5e1
tests(remote-config): skip test that works locally
russellwheatley Jun 30, 2022
3db03cc
format
russellwheatley Jun 30, 2022
8cdc86f
tests(dynamic-link): fix test
russellwheatley Jun 30, 2022
c031c5d
ci(ios): revert timeout
russellwheatley Jun 30, 2022
05df722
format
russellwheatley Jun 30, 2022
be4c84f
test(remote-config): use correct target
russellwheatley Jun 30, 2022
ca5c2ca
chore(remote-config): rm unused import
russellwheatley Jun 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/e2e_tests.yaml
Expand Up @@ -73,7 +73,7 @@ jobs:
flutter drive --target=./test_driver/driver_e2e.dart --dart-define=CI=true

ios:
runs-on: macos-latest
runs-on: macos-12
timeout-minutes: 45
steps:
- uses: actions/checkout@v2
Expand Down
3 changes: 2 additions & 1 deletion packages/cloud_firestore/cloud_firestore/example/ios/Podfile
Expand Up @@ -51,7 +51,8 @@ target 'Runner' do
end
end

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

post_install do |installer|
Expand Down
Expand Up @@ -50,7 +50,8 @@ target 'Runner' do
end
end

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

post_install do |installer|
Expand Down
Expand Up @@ -50,10 +50,17 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)flutter
NSMutableDictionary *httpsErrorDetails = [NSMutableDictionary dictionary];
NSString *httpsErrorCode = [NSString stringWithFormat:@"%ld", error.code];
NSString *httpsErrorMessage = error.localizedDescription;
if (error.domain == FIRFunctionsErrorDomain) {
// FIRFunctionsErrorDomain has been removed and replaced with Swift implementation
// https://github.com/firebase/firebase-ios-sdk/blob/master/FirebaseFunctions/Sources/FunctionsError.swift#L18
NSString *errorDomain = @"com.firebase.functions";
// FIRFunctionsErrorDetailsKey has been deprecated and replaced with Swift implementation
// https://github.com/firebase/firebase-ios-sdk/blob/master/FirebaseFunctions/Sources/FunctionsError.swift#L21
NSString *detailsKey = @"details";
// See also https://github.com/firebase/firebase-ios-sdk/pull/9569
if ([error.domain isEqualToString:errorDomain]) {
httpsErrorCode = [self mapFunctionsErrorCodes:error.code];
if (error.userInfo[FIRFunctionsErrorDetailsKey] != nil) {
httpsErrorDetails[@"additionalData"] = error.userInfo[FIRFunctionsErrorDetailsKey];
if (error.userInfo[detailsKey] != nil) {
httpsErrorDetails[@"additionalData"] = error.userInfo[detailsKey];
}
}
httpsErrorDetails[@"code"] = httpsErrorCode;
Expand Down Expand Up @@ -82,7 +89,8 @@ - (void)httpsFunctionCall:(id)arguments withMethodCallResult:(FLTFirebaseMethodC
FIRApp *app = [FLTFirebasePlugin firebaseAppNamed:appName];
FIRFunctions *functions = [FIRFunctions functionsForApp:app region:region];
if (origin != nil && origin != (id)[NSNull null]) {
[functions useFunctionsEmulatorOrigin:origin];
NSURL *url = [NSURL URLWithString:origin];
[functions useEmulatorWithHost:[url host] port:[[url port] intValue]];
}

FIRHTTPSCallable *function = [functions HTTPSCallableWithName:functionName];
Expand Down
Expand Up @@ -112,7 +112,8 @@ public class FirebaseInstallationsPluginSwift: FLTFirebasePlugin, FlutterPlugin
}

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

switch error {
case InstallationsErrorCode.invalidConfiguration:
Expand Down
Expand Up @@ -3,7 +3,14 @@
// found in the LICENSE file.

#import "FLTFirebasePluginRegistry.h"

#if __has_include(<FirebaseCore/FIRAppInternal.h>)
#import <FirebaseCore/FIRAppInternal.h>
#define REGISTER_LIB
#elif __has_include(<FirebaseCoreExtension/FIRAppInternal.h>)
#import <FirebaseCoreExtension/FIRAppInternal.h>
#define REGISTER_LIB
#endif

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

- (void)registerFirebasePlugin:(id<FLTFirebasePlugin>)firebasePlugin {
// Register the library with the Firebase backend.
#ifdef REGISTER_LIB
[FIRApp registerLibrary:[firebasePlugin firebaseLibraryName]
withVersion:[firebasePlugin firebaseLibraryVersion]];

#endif
// Store the plugin delegate for later usage.
registeredPlugins[[firebasePlugin flutterChannelName]] = firebasePlugin;
}
Expand Down
@@ -1,4 +1,4 @@
# https://firebase.google.com/support/release-notes/ios
def firebase_sdk_version!()
'8.15.0'
'9.2.0'
end
Expand Up @@ -128,6 +128,17 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
code = errorDetails[kCode];
message = errorDetails[kMessage];
details = errorDetails;

if (errorDetails[@"additionalData"][NSLocalizedFailureReasonErrorKey] != nil) {
// This stops an uncaught type cast exception in dart
NSMutableDictionary *temp = [errorDetails[@"additionalData"] mutableCopy];
[temp removeObjectForKey:NSLocalizedFailureReasonErrorKey];
details = temp;
// provides a useful message to the user. e.g. "Universal link URL could not be parsed".
if ([message containsString:@"unknown error"]) {
message = errorDetails[@"additionalData"][NSLocalizedFailureReasonErrorKey];
}
}
} else {
details = @{
kCode : code,
Expand Down
Expand Up @@ -52,9 +52,7 @@ Pod::Spec.new do |s|

# Firebase dependencies
s.dependency 'Firebase/CoreOnly', "~> #{firebase_sdk_version}"
# TODO(Salakar): Direct pod depency here instead of the Firebase subspec due to:
# https://github.com/firebase/firebase-ios-sdk/pull/9186 (pending acceptance / merge)
s.dependency 'FirebaseMLModelDownloader', '~> 8.10.0-beta'
s.dependency 'Firebase/MLModelDownloader', firebase_sdk_version
s.static_framework = true
s.swift_version = '5.0'
s.pod_target_xcconfig = {
Expand Down
@@ -0,0 +1,41 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
Expand Up @@ -4,8 +4,8 @@
#import <TargetConditionals.h>

#import <Firebase/Firebase.h>
#import <FirebaseStorage/FIRStorageTypedefs.h>
#import <firebase_core/FLTFirebasePluginRegistry.h>

#import "FLTFirebaseStoragePlugin.h"

static NSString *const kFLTFirebaseStorageChannelName = @"plugins.flutter.io/firebase_storage";
Expand Down
3 changes: 2 additions & 1 deletion tests/ios/Podfile
Expand Up @@ -47,7 +47,8 @@ target 'Runner' do
end
end

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

post_install do |installer|
Expand Down
44 changes: 26 additions & 18 deletions tests/ios/Runner.xcodeproj/project.pbxproj
Expand Up @@ -34,6 +34,7 @@
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
29DCF5BB48C5B80F2EE02483 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
46682439286310F7005ADD39 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
56B65A6814148F63F80E1BCD /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -112,6 +113,7 @@
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
46682439286310F7005ADD39 /* Runner.entitlements */,
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
Expand Down Expand Up @@ -139,8 +141,8 @@
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
AC660AAB7696B4DD121B84D0 /* [CP] Embed Pods Frameworks */,
AFACAC31EEE064D50881C495 /* [CP] Copy Pods Resources */,
5F39B4E393588B005ADEE74A /* [firebase_crashlytics] Crashlytics Upload Symbols */,
570B63470F19A77487B49310 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -213,6 +215,23 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
570B63470F19A77487B49310 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
5F39B4E393588B005ADEE74A /* [firebase_crashlytics] Crashlytics Upload Symbols */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -286,23 +305,6 @@
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
AFACAC31EEE064D50881C495 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down Expand Up @@ -393,7 +395,9 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = YYX2P3XVJ7;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -521,7 +525,9 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = YYX2P3XVJ7;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -543,7 +549,9 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = YYX2P3XVJ7;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand Down
4 changes: 4 additions & 0 deletions tests/ios/Runner/Info.plist
Expand Up @@ -63,5 +63,9 @@
</array>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>FirebaseDynamicLinksCustomDomains</key>
<array>
<string>https://flutterfiretests.page.link/**</string>
</array>
</dict>
</plist>
10 changes: 10 additions & 0 deletions tests/ios/Runner/Runner.entitlements
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:flutterfiretests.page.link</string>
</array>
</dict>
</plist>
3 changes: 2 additions & 1 deletion tests/macos/Podfile
Expand Up @@ -46,7 +46,8 @@ target 'Runner' do
end
end

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

post_install do |installer|
Expand Down
Expand Up @@ -134,12 +134,40 @@ void setupTests() {
});

group('getDynamicLink', () {
test('dynamic link using uri', () async {
Uri uri = Uri.parse('');
test('dynamic link using uri created on Firebase console', () async {
// Link created in Firebase console
Uri uri = Uri.parse('https://flutterfiretests.page.link/iho8');
PendingDynamicLinkData? pendingLink =
await FirebaseDynamicLinks.instance.getDynamicLink(uri);
expect(pendingLink, isNull);
expect(pendingLink, isA<PendingDynamicLinkData>());
expect(pendingLink?.link.toString(), 'https://example/helloworld');
});

test(
'Universal link error for URL that cannot be parsed',
() async {
Uri uri = Uri.parse('');
if (defaultTargetPlatform == TargetPlatform.iOS) {
await expectLater(
FirebaseDynamicLinks.instance.getDynamicLink(uri),
throwsA(
isA<FirebaseException>().having(
(e) => e.message,
'message',
contains('could not be parsed'),
),
),
);
} else if (defaultTargetPlatform == TargetPlatform.android) {
// TODO - android returns normally. Throw error to keep consistent with iOS or catch on iOS and return `null`.
// Internal ticket created: https://linear.app/invertase/issue/FF-44/dynamic-link-univeral-link-cannot-be-parsed
await expectLater(
FirebaseDynamicLinks.instance.getDynamicLink(uri),
completes,
);
}
},
);
});

group('onLink', () {
Expand Down