Skip to content

Functions Interop #2113

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

Merged
merged 24 commits into from
Dec 6, 2018
Merged
Show file tree
Hide file tree
Changes from 11 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
3 changes: 2 additions & 1 deletion FirebaseFunctions.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ iOS SDK for Cloud Functions for Firebase.
s.source_files = 'Functions/FirebaseFunctions/**/*'
s.public_header_files = 'Functions/FirebaseFunctions/Public/*.h'

s.dependency 'FirebaseCore', '~> 5.0'
s.dependency 'FirebaseAuthInterop', '~> 1.0'
s.dependency 'FirebaseCore', '~> 5.1'
s.dependency 'GTMSessionFetcher/Core', '~> 1.1'

s.pod_target_xcconfig = {
Expand Down
80 changes: 44 additions & 36 deletions Functions/Example/FirebaseFunctions.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,21 @@
6003F5A7195388D20070C39A /* FIRViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5A6195388D20070C39A /* FIRViewController.m */; };
6003F5A9195388D20070C39A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5A8195388D20070C39A /* Images.xcassets */; };
6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F5AF195388D20070C39A /* XCTest.framework */; };
6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; };
6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; };
6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; };
6003F5BC195388D20070C39A /* FIRFunctionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* FIRFunctionsTests.m */; };
71719F9F1E33DC2100824A3D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */; };
7C58B03A1F1441F0005ED954 /* FUNSerializerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7C58B0391F1441F0005ED954 /* FUNSerializerTests.m */; };
7CBFAA82205702AB00A65866 /* FIRIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7C9BFD3F1F10A12F001A19ED /* FIRIntegrationTests.m */; };
7CBFAA86205702AB00A65866 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F5AF195388D20070C39A /* XCTest.framework */; };
7CBFAA87205702AB00A65866 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; };
7CBFAA88205702AB00A65866 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; };
7CBFAA8B205702AB00A65866 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5B8195388D20070C39A /* InfoPlist.strings */; };
7CF3BEC21F97EE2F00B16B6E /* FUNFakeInstanceID.m in Sources */ = {isa = PBXBuildFile; fileRef = 7CF3BEC01F97EE2F00B16B6E /* FUNFakeInstanceID.m */; };
7CF563091F1FE70600FEE1F4 /* FUNFakeApp.m in Sources */ = {isa = PBXBuildFile; fileRef = 7CF563081F1FE70600FEE1F4 /* FUNFakeApp.m */; };
873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; };
C81A8BF721AC4F73008E79A5 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; };
C81A8BF821AC4F73008E79A5 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; };
C81A8BF921AC4F78008E79A5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; };
C81A8BFA21AC4F78008E79A5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; };
C88B727621A73B98005A178E /* FIRAuthInteropFake.m in Sources */ = {isa = PBXBuildFile; fileRef = C88B727221A73B52005A178E /* FIRAuthInteropFake.m */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -77,6 +78,8 @@
7CF563081F1FE70600FEE1F4 /* FUNFakeApp.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUNFakeApp.m; sourceTree = "<group>"; };
7CF5630A1F1FE76700FEE1F4 /* FUNFakeApp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUNFakeApp.h; sourceTree = "<group>"; };
873B8AEA1B1F5CCA007FD442 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
C88B727121A73B51005A178E /* FIRAuthInteropFake.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FIRAuthInteropFake.h; path = ../../../Example/Shared/FIRAuthInteropFake.h; sourceTree = "<group>"; };
C88B727221A73B52005A178E /* FIRAuthInteropFake.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FIRAuthInteropFake.m; path = ../../../Example/Shared/FIRAuthInteropFake.m; sourceTree = "<group>"; };
E0A8D570636E99E7C3396DF8 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
F1F2A7C03C10A3A03F9502B8 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
/* End PBXFileReference section */
Expand All @@ -97,8 +100,8 @@
buildActionMask = 2147483647;
files = (
6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */,
6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */,
6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */,
C81A8BF821AC4F73008E79A5 /* UIKit.framework in Frameworks */,
C81A8BFA21AC4F78008E79A5 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -107,8 +110,8 @@
buildActionMask = 2147483647;
files = (
7CBFAA86205702AB00A65866 /* XCTest.framework in Frameworks */,
7CBFAA87205702AB00A65866 /* UIKit.framework in Frameworks */,
7CBFAA88205702AB00A65866 /* Foundation.framework in Frameworks */,
C81A8BF721AC4F73008E79A5 /* UIKit.framework in Frameworks */,
C81A8BF921AC4F78008E79A5 /* Foundation.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -207,6 +210,8 @@
7C70065B20572C1B007A5573 /* TestUtils */ = {
isa = PBXGroup;
children = (
C88B727121A73B51005A178E /* FIRAuthInteropFake.h */,
C88B727221A73B52005A178E /* FIRAuthInteropFake.m */,
7CF5630A1F1FE76700FEE1F4 /* FUNFakeApp.h */,
7CF563081F1FE70600FEE1F4 /* FUNFakeApp.m */,
7CF3BEC11F97EE2F00B16B6E /* FUNFakeInstanceID.h */,
Expand Down Expand Up @@ -351,6 +356,7 @@
files = (
7CF563091F1FE70600FEE1F4 /* FUNFakeApp.m in Sources */,
6003F59E195388D20070C39A /* FIRAppDelegate.m in Sources */,
C88B727621A73B98005A178E /* FIRAuthInteropFake.m in Sources */,
6003F5A7195388D20070C39A /* FIRViewController.m in Sources */,
7CF3BEC21F97EE2F00B16B6E /* FUNFakeInstanceID.m in Sources */,
6003F59A195388D20070C39A /* main.m in Sources */,
Expand Down Expand Up @@ -420,7 +426,6 @@
6003F5BD195388D20070C39A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand Down Expand Up @@ -450,6 +455,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../FirebaseFunctions",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand All @@ -460,7 +469,6 @@
6003F5BE195388D20070C39A /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
Expand All @@ -483,6 +491,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../FirebaseFunctions",
);
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down Expand Up @@ -528,17 +540,16 @@
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
"$(DEVELOPER_FRAMEWORKS_DIR)",
);
GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
HEADER_SEARCH_PATHS = "$(SRCROOT)/../FirebaseFunctions";
HEADER_SEARCH_PATHS = (
"$(inherited)",
"\"${PODS_ROOT}/Headers/Public\"/**",
"\"$(SRCROOT)/../FirebaseFunctions\"/**",
);
INFOPLIST_FILE = "Tests/Tests-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -551,13 +562,12 @@
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
GCC_PRECOMPILE_PREFIX_HEADER = NO;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(DEVELOPER_FRAMEWORKS_DIR)",
"\"${PODS_ROOT}/Headers/Public\"/**",
"\"$(SRCROOT)/../FirebaseFunctions\"/**",
);
GCC_PRECOMPILE_PREFIX_HEADER = NO;
HEADER_SEARCH_PATHS = "$(SRCROOT)/../FirebaseFunctions";
INFOPLIST_FILE = "Tests/Tests-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -570,17 +580,16 @@
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
"$(DEVELOPER_FRAMEWORKS_DIR)",
);
GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
HEADER_SEARCH_PATHS = "$(SRCROOT)/../FirebaseFunctions";
HEADER_SEARCH_PATHS = (
"$(inherited)",
"\"${PODS_ROOT}/Headers/Public\"/**",
"\"$(SRCROOT)/../FirebaseFunctions\"/**",
);
INFOPLIST_FILE = "IntegrationTests/IntegrationTests-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -593,13 +602,12 @@
isa = XCBuildConfiguration;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
GCC_PRECOMPILE_PREFIX_HEADER = NO;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(DEVELOPER_FRAMEWORKS_DIR)",
"\"${PODS_ROOT}/Headers/Public\"/**",
"\"$(SRCROOT)/../FirebaseFunctions\"/**",
);
GCC_PRECOMPILE_PREFIX_HEADER = NO;
HEADER_SEARCH_PATHS = "$(SRCROOT)/../FirebaseFunctions";
INFOPLIST_FILE = "IntegrationTests/IntegrationTests-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -618,7 +626,7 @@
6003F5BE195388D20070C39A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
defaultConfigurationName = Debug;
};
6003F5BF195388D20070C39A /* Build configuration list for PBXNativeTarget "FirebaseFunctions_Example" */ = {
isa = XCConfigurationList;
Expand All @@ -627,7 +635,7 @@
6003F5C1195388D20070C39A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
defaultConfigurationName = Debug;
};
6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "FirebaseFunctions_Tests" */ = {
isa = XCConfigurationList;
Expand All @@ -636,7 +644,7 @@
6003F5C4195388D20070C39A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
defaultConfigurationName = Debug;
};
7CBFAA8E205702AB00A65866 /* Build configuration list for PBXNativeTarget "FirebaseFunctions_IntegrationTests" */ = {
isa = XCConfigurationList;
Expand All @@ -645,7 +653,7 @@
7CBFAA90205702AB00A65866 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
defaultConfigurationName = Debug;
};
/* End XCConfigurationList section */
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -66,7 +65,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
11 changes: 9 additions & 2 deletions Functions/Example/IntegrationTests/FIRIntegrationTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#import <XCTest/XCTest.h>

#import "FIRAuthInteropFake.h"
#import "FIRError.h"
#import "FIRFunctions+Internal.h"
#import "FIRFunctions.h"
Expand All @@ -31,7 +32,10 @@ @implementation FIRIntegrationTests
- (void)setUp {
[super setUp];
id app = [[FUNFakeApp alloc] initWithProjectID:@"functions-integration-test"];
_functions = [FIRFunctions functionsForApp:app];
_functions = [[FIRFunctions alloc]
initWithApp:app
region:@"my-region"
auth:[[FIRAuthInteropFake alloc] initWithToken:nil userID:nil error:nil]];
[_functions useLocalhost];
}

Expand Down Expand Up @@ -77,7 +81,10 @@ - (void)testScalar {
- (void)testToken {
// Recreate _functions with a token.
id app = [[FUNFakeApp alloc] initWithProjectID:@"functions-integration-test" token:@"token"];
FIRFunctions *functions = [FIRFunctions functionsForApp:app];
FIRFunctions *functions = [[FIRFunctions alloc]
initWithApp:app
region:@"my-region"
auth:[[FIRAuthInteropFake alloc] initWithToken:nil userID:nil error:nil]];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why this passes. Shouldn't functions be using the FIRAuthInteropFake's token instead of the one passed into the FUNFakeApp?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also unsure how this was passing.

It looks like callFunction would have an empty Authorization header, but maybe the mock server still returns an empty data response with a 200 OK?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I bet it wasn't passing. Travis doesn't run the integration tests on PRs, just the master branch. I'll run them locally to make sure they're passing now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm having difficulty running the integration tests. I get many warnings when running Backend/start.sh instructions. See this gist of the output I get.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed my system to node 8, and ran through the suggestions it printed out, and it seems as though it's connecting to the emulator, but I'm not sure it's behaving as expected.

For example, the testData test case gets the error: Function dataTest in location my-region in project functions-integration-test does not exist in its FIRHTTPSCallableResult callback.

From the emulator's output, it looks like my-region isn't what's expected, but rather us-central1 since it outputs http://localhost:5005/functions-integration-test/us-central1/dataTest as the resource.

Switching the tests to using us-central1 as the region has all the tests but one passing. The testNull attempts to wait on an expectation twice, which is an API violation that throws an error.

Are the integration tests expected to pass? I'm not sure how they would on master without the region change and the duplicate waitForExpectation: call.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears as though the last green run of master compiled the integration tests, but only ran the unit tests.

It seems as though the integration tests aren't being run on Travis.

I'll open an internal bug to fix and enable theses.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the emulator's output, it looks like my-region isn't what's expected, but rather us-central1

Yes, the shell script in Backend/ that installs the functions says to install them in us-central1. Not sure when that broke.

[functions useLocalhost];

XCTestExpectation *expectation = [[XCTestExpectation alloc] init];
Expand Down
11 changes: 7 additions & 4 deletions Functions/Example/Podfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
use_frameworks!

pod 'FirebaseFunctions', :path => '../../'

pod 'FirebaseAnalyticsInterop', :path => '../../'
pod 'FirebaseAuthInterop', :path => '../../'
pod 'FirebaseCore', :path => '../../'
pod 'GoogleUtilities', :path => '../../'

target 'FirebaseFunctions_Example' do
platform :ios, '8.0'

pod 'FirebaseCore', :path => '../../'
pod 'GoogleUtilities', :path => '../../'
pod 'FirebaseFunctions', :path => '../../'

target 'FirebaseFunctions_Tests' do
inherit! :search_paths
end
Expand Down
3 changes: 3 additions & 0 deletions Functions/Example/TestUtils/FUNFakeApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#import <Foundation/Foundation.h>

@class FIRComponentContainer;
@class FUNFakeOptions;

NS_ASSUME_NONNULL_BEGIN
Expand All @@ -34,6 +35,8 @@ NS_ASSUME_NONNULL_BEGIN

@property(nonatomic, strong, readonly) FUNFakeOptions *options;

@property(nonatomic, strong, readonly) FIRComponentContainer *container;

@end

NS_ASSUME_NONNULL_END
13 changes: 7 additions & 6 deletions Functions/Example/TestUtils/FUNFakeApp.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@

#import "FUNFakeApp.h"

#import <FirebaseCore/FIRComponentContainer.h>

NS_ASSUME_NONNULL_BEGIN

@interface FIRComponentContainer (Testing)
- (instancetype)initWithApp:(FIRApp *)app;
@end

@interface FUNFakeOptions : NSObject

@property(nonatomic, readonly, copy) NSString *projectID;
Expand Down Expand Up @@ -58,16 +64,11 @@ - (instancetype)initWithProjectID:(NSString *)projectID token:(NSString *_Nullab
if (self) {
_options = [[FUNFakeOptions alloc] initWithProjectID:projectID];
_token = [token copy];
_container = [[FIRComponentContainer alloc] initWithApp:(FIRApp *)self];
}
return self;
}

- (void)getTokenForcingRefresh:(BOOL)forceRefresh
withCallback:
(void (^)(NSString *_Nullable token, NSError *_Nullable error))callback {
callback(_token, nil);
}

@end

NS_ASSUME_NONNULL_END
2 changes: 1 addition & 1 deletion Functions/Example/Tests/FIRFunctionsTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ - (void)tearDown {

- (void)testURLWithName {
id app = [[FUNFakeApp alloc] initWithProjectID:@"my-project"];
FIRFunctions *functions = [FIRFunctions functionsForApp:app region:@"my-region"];
FIRFunctions *functions = [[FIRFunctions alloc] initWithApp:app region:@"my-region" auth:nil];
NSString *url = [functions URLWithName:@"my-endpoint"];
XCTAssertEqualObjects(@"https://my-region-my-project.cloudfunctions.net/my-endpoint", url);

Expand Down
9 changes: 9 additions & 0 deletions Functions/FirebaseFunctions/FIRFunctions+Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#import "FIRFunctions.h"

@protocol FIRAuthInterop;
@class FIRHTTPSCallableResult;

NS_ASSUME_NONNULL_BEGIN
Expand Down Expand Up @@ -45,6 +46,14 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)useLocalhost;

/**
* Internal initializer for the Cloud Functions client.
* @param app The app for the Firebase project.
* @param region The region for the http trigger, such as "us-central1".
* @param auth The auth provider to use (optional).
*/
- (id)initWithApp:(FIRApp *)app region:(NSString *)region auth:(nullable id<FIRAuthInterop>)auth;

@end

NS_ASSUME_NONNULL_END
Loading