Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/cloud_functions/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.1.2

* Specifying a version for Cloud Functions CocoaPod dependency to prevent build errors on iOS.
* Fix on iOS when using a null region.
* Upgrade the firebase_core dependency of the example app.

## 0.1.1+1

* Log messages about automatic configuration of the default app are now less confusing.
Expand Down
2 changes: 1 addition & 1 deletion packages/cloud_functions/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:
cupertino_icons: ^0.1.2
cloud_functions:
path: ..
firebase_core: 0.3.0
firebase_core: ^0.3.1

dev_dependencies:
flutter_test:
Expand Down
62 changes: 31 additions & 31 deletions packages/cloud_functions/ios/Classes/CloudFunctionsPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,42 +41,42 @@ - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result
NSString *region = call.arguments[@"region"];
FIRApp *app = [FIRApp appNamed:appName];
FIRFunctions *functions;
if (region != nil) {
if (region != nil && region != (id)[NSNull null]) {
functions = [FIRFunctions functionsForApp:app region:region];
} else {
functions = [FIRFunctions functionsForApp:app];
}
[functions callFunction:functionName
withObject:parameters
completion:^(FIRHTTPSCallableResult *callableResult, NSError *error) {
if (error) {
FlutterError *flutterError;
if (error.domain == FIRFunctionsErrorDomain) {
NSDictionary *details = [NSMutableDictionary dictionary];
[details setValue:[self mapFunctionsErrorCodes:error.code] forKey:@"code"];
if (error.localizedDescription != nil) {
[details setValue:error.localizedDescription forKey:@"message"];
}
if (error.userInfo[FIRFunctionsErrorDetailsKey] != nil) {
[details setValue:error.userInfo[FIRFunctionsErrorDetailsKey]
forKey:@"details"];
}
FIRHTTPSCallable *function = [functions HTTPSCallableWithName:functionName];
[function callWithObject:parameters
completion:^(FIRHTTPSCallableResult *callableResult, NSError *error) {
if (error) {
FlutterError *flutterError;
if (error.domain == FIRFunctionsErrorDomain) {
NSDictionary *details = [NSMutableDictionary dictionary];
[details setValue:[self mapFunctionsErrorCodes:error.code] forKey:@"code"];
if (error.localizedDescription != nil) {
[details setValue:error.localizedDescription forKey:@"message"];
}
if (error.userInfo[FIRFunctionsErrorDetailsKey] != nil) {
[details setValue:error.userInfo[FIRFunctionsErrorDetailsKey]
forKey:@"details"];
}

flutterError =
[FlutterError errorWithCode:@"functionsError"
message:@"Firebase function failed with exception."
details:details];
} else {
flutterError = [FlutterError
errorWithCode:[NSString stringWithFormat:@"%ld", error.code]
message:error.localizedDescription
details:nil];
}
result(flutterError);
} else {
result(callableResult.data);
}
}];
flutterError =
[FlutterError errorWithCode:@"functionsError"
message:@"Firebase function failed with exception."
details:details];
} else {
flutterError = [FlutterError
errorWithCode:[NSString stringWithFormat:@"%ld", error.code]
message:error.localizedDescription
details:nil];
}
result(flutterError);
} else {
result(callableResult.data);
}
}];
} else {
result(FlutterMethodNotImplemented);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cloud_functions/ios/cloud_functions.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ A new flutter plugin project.
s.ios.deployment_target = '8.0'
s.dependency 'Flutter'
s.dependency 'Firebase/Core'
s.dependency 'Firebase/Functions'
s.dependency 'Firebase/Functions', '~> 5.18'
s.static_framework = true
end

2 changes: 1 addition & 1 deletion packages/cloud_functions/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: cloud_functions
description: Flutter plugin for Cloud Functions.
version: 0.1.1+1
version: 0.1.2
author: Flutter Team <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/cloud_functions

Expand Down