From e413e22142ce3223001a69472ef996bb1302f617 Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Thu, 19 Apr 2018 09:20:06 -0700 Subject: Remove workaround for Analytics modular header issue (#1142) --- Example/Analytics_Tests_iOS/Analytics_Tests_iOS.m | 39 ------ Example/Analytics_Tests_iOS/DeprecatedHeaderTest.m | 21 --- Example/Analytics_Tests_iOS/Info.plist | 22 --- Example/Firebase.xcodeproj/project.pbxproj | 148 --------------------- .../xcschemes/Analytics_Tests_iOS.xcscheme | 58 -------- Example/Podfile | 19 +-- 6 files changed, 5 insertions(+), 302 deletions(-) delete mode 100644 Example/Analytics_Tests_iOS/Analytics_Tests_iOS.m delete mode 100644 Example/Analytics_Tests_iOS/DeprecatedHeaderTest.m delete mode 100644 Example/Analytics_Tests_iOS/Info.plist delete mode 100644 Example/Firebase.xcodeproj/xcshareddata/xcschemes/Analytics_Tests_iOS.xcscheme (limited to 'Example') diff --git a/Example/Analytics_Tests_iOS/Analytics_Tests_iOS.m b/Example/Analytics_Tests_iOS/Analytics_Tests_iOS.m deleted file mode 100644 index a020433..0000000 --- a/Example/Analytics_Tests_iOS/Analytics_Tests_iOS.m +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2017 Google -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#import - -@interface Analytics_Tests_iOS : XCTestCase - -@end - -@implementation Analytics_Tests_iOS - -- (void)setUp { - [super setUp]; - // Put setup code here. This method is called before the invocation of each test method in the - // class. -} - -- (void)tearDown { - // Put teardown code here. This method is called after the invocation of each test method in the - // class. - [super tearDown]; -} - -- (void)testExample { - // Replace with a real test if we ever want to do Analytics unit tests here. -} - -@end diff --git a/Example/Analytics_Tests_iOS/DeprecatedHeaderTest.m b/Example/Analytics_Tests_iOS/DeprecatedHeaderTest.m deleted file mode 100644 index 6d13042..0000000 --- a/Example/Analytics_Tests_iOS/DeprecatedHeaderTest.m +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 Google -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Verify deprecated headers still exist. This file should be deleted at -// at the next major release when the headers are removed. - -#import -#import -#import -#import diff --git a/Example/Analytics_Tests_iOS/Info.plist b/Example/Analytics_Tests_iOS/Info.plist deleted file mode 100644 index 6c40a6c..0000000 --- a/Example/Analytics_Tests_iOS/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/Example/Firebase.xcodeproj/project.pbxproj b/Example/Firebase.xcodeproj/project.pbxproj index 9fe9d91..26e0c33 100644 --- a/Example/Firebase.xcodeproj/project.pbxproj +++ b/Example/Firebase.xcodeproj/project.pbxproj @@ -512,8 +512,6 @@ DEB61EC91E7C5DBB00C04B96 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = DEB61EC11E7C5DBB00C04B96 /* GoogleService-Info.plist */; }; DEB61ECB1E7C5DBB00C04B96 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DEB61EC31E7C5DBB00C04B96 /* main.m */; }; DECE039B1E9ED01600164CA4 /* FIRPhoneAuthProviderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DECE03991E9ECFF500164CA4 /* FIRPhoneAuthProviderTests.m */; }; - DEDFEFEF1FD1B8C100F7D466 /* Analytics_Tests_iOS.m in Sources */ = {isa = PBXBuildFile; fileRef = DEDFEFEE1FD1B8C100F7D466 /* Analytics_Tests_iOS.m */; }; - DEDFEFF71FD1B9AA00F7D466 /* DeprecatedHeaderTest.m in Sources */ = {isa = PBXBuildFile; fileRef = DEDFEFF61FD1B9AA00F7D466 /* DeprecatedHeaderTest.m */; }; DEE14D7E1E844677006FA992 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DEE14D681E844677006FA992 /* LaunchScreen.storyboard */; }; DEE14D7F1E844677006FA992 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DEE14D6A1E844677006FA992 /* Main.storyboard */; }; DEE14D811E844677006FA992 /* FIRAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = DEE14D6E1E844677006FA992 /* FIRAppDelegate.m */; }; @@ -809,13 +807,6 @@ remoteGlobalIDString = DE7B8D1C1E8EF078009EB6DF; remoteInfo = Database_Tests; }; - DEDFEFF11FD1B8C100F7D466 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 6003F582195388D10070C39A /* Project object */; - proxyType = 1; - remoteGlobalIDString = DEE14D401E84464D006FA992; - remoteInfo = Core_Example_iOS; - }; DEE14D5A1E84464D006FA992 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 6003F582195388D10070C39A /* Project object */; @@ -1239,10 +1230,6 @@ DEB61EC31E7C5DBB00C04B96 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; DEB61EC41E7C5DBB00C04B96 /* Storage-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Storage-Info.plist"; sourceTree = ""; }; DECE03991E9ECFF500164CA4 /* FIRPhoneAuthProviderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FIRPhoneAuthProviderTests.m; sourceTree = ""; }; - DEDFEFEC1FD1B8C100F7D466 /* Analytics_Tests_iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Analytics_Tests_iOS.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - DEDFEFEE1FD1B8C100F7D466 /* Analytics_Tests_iOS.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Analytics_Tests_iOS.m; sourceTree = ""; }; - DEDFEFF01FD1B8C100F7D466 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - DEDFEFF61FD1B9AA00F7D466 /* DeprecatedHeaderTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DeprecatedHeaderTest.m; sourceTree = ""; }; DEE14D411E84464D006FA992 /* Core_Example_iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Core_Example_iOS.app; sourceTree = BUILT_PRODUCTS_DIR; }; DEE14D591E84464D006FA992 /* Core_Tests_iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Core_Tests_iOS.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; DEE14D691E844677006FA992 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; @@ -1512,13 +1499,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - DEDFEFE91FD1B8C100F7D466 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; DEE14D3E1E84464D006FA992 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -1610,7 +1590,6 @@ DE9315B41E8738B70083EDBF /* Messaging */, AFC8BAA01EC24B1600B8EEAE /* Shared */, DEB139B31E734D9D00AC236D /* Storage */, - DEDFEFED1FD1B8C100F7D466 /* Analytics_Tests_iOS */, 6003F58C195388D20070C39A /* Frameworks */, 6003F58B195388D20070C39A /* Products */, ); @@ -1653,7 +1632,6 @@ DE1EC27F1FBA5E63007D18D8 /* Database_Tests_tvOS.xctest */, DE53893E1FBB62E100199FC2 /* Auth_Tests_tvOS.xctest */, DE1FAE901FBCF5E100897AAA /* Auth_Example_tvOS.app */, - DEDFEFEC1FD1B8C100F7D466 /* Analytics_Tests_iOS.xctest */, DE47C0ED207AC87D00B1AEDF /* Messaging_Sample_iOS.app */, ); name = Products; @@ -2260,16 +2238,6 @@ path = App; sourceTree = ""; }; - DEDFEFED1FD1B8C100F7D466 /* Analytics_Tests_iOS */ = { - isa = PBXGroup; - children = ( - DEDFEFEE1FD1B8C100F7D466 /* Analytics_Tests_iOS.m */, - DEDFEFF01FD1B8C100F7D466 /* Info.plist */, - DEDFEFF61FD1B9AA00F7D466 /* DeprecatedHeaderTest.m */, - ); - path = Analytics_Tests_iOS; - sourceTree = ""; - }; DEE14D661E844677006FA992 /* Core */ = { isa = PBXGroup; children = ( @@ -2904,24 +2872,6 @@ productReference = DEB13A231E73507E00AC236D /* Storage_Tests_iOS.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; - DEDFEFEB1FD1B8C100F7D466 /* Analytics_Tests_iOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = DEDFEFF51FD1B8C100F7D466 /* Build configuration list for PBXNativeTarget "Analytics_Tests_iOS" */; - buildPhases = ( - DEDFEFE81FD1B8C100F7D466 /* Sources */, - DEDFEFE91FD1B8C100F7D466 /* Frameworks */, - DEDFEFEA1FD1B8C100F7D466 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - DEDFEFF21FD1B8C100F7D466 /* PBXTargetDependency */, - ); - name = Analytics_Tests_iOS; - productName = Analytics_Tests_iOS; - productReference = DEDFEFEC1FD1B8C100F7D466 /* Analytics_Tests_iOS.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; DEE14D401E84464D006FA992 /* Core_Example_iOS */ = { isa = PBXNativeTarget; buildConfigurationList = DEE14D641E84464D006FA992 /* Build configuration list for PBXNativeTarget "Core_Example_iOS" */; @@ -3147,10 +3097,6 @@ DEB13A0A1E73507E00AC236D = { TestTargetID = DEB139E01E73506A00AC236D; }; - DEDFEFEB1FD1B8C100F7D466 = { - DevelopmentTeam = EQHXZ8M8AV; - ProvisioningStyle = Automatic; - }; DEE14D401E84464D006FA992 = { CreatedOnToolsVersion = 8.2.1; ProvisioningStyle = Automatic; @@ -3213,7 +3159,6 @@ D0EDB2BC1EDA04F800B6C31B /* Storage_Example_macOS */, D0EDB2DE1EDA06CB00B6C31B /* Storage_Tests_macOS */, D0EDB2F81EDA06D500B6C31B /* Storage_IntegrationTests_macOS */, - DEDFEFEB1FD1B8C100F7D466 /* Analytics_Tests_iOS */, DEAAD3E01FBA46AA0053BF48 /* Storage_Example_tvOS */, DEAAD3F41FBA46AB0053BF48 /* Storage_Tests_tvOS */, DE3373891E73773400881891 /* AllUnitTests_iOS */, @@ -3525,13 +3470,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - DEDFEFEA1FD1B8C100F7D466 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; DEE14D3F1E84464D006FA992 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -4200,15 +4138,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - DEDFEFE81FD1B8C100F7D466 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DEDFEFEF1FD1B8C100F7D466 /* Analytics_Tests_iOS.m in Sources */, - DEDFEFF71FD1B9AA00F7D466 /* DeprecatedHeaderTest.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; DEE14D3D1E84464D006FA992 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -4401,11 +4330,6 @@ target = DE7B8D1C1E8EF078009EB6DF /* Database_Tests_iOS */; targetProxy = DEB518591E9008CB0089C938 /* PBXContainerItemProxy */; }; - DEDFEFF21FD1B8C100F7D466 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DEE14D401E84464D006FA992 /* Core_Example_iOS */; - targetProxy = DEDFEFF11FD1B8C100F7D466 /* PBXContainerItemProxy */; - }; DEE14D5B1E84464D006FA992 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = DEE14D401E84464D006FA992 /* Core_Example_iOS */; @@ -6608,69 +6532,6 @@ }; name = Release; }; - DEDFEFF31FD1B8C100F7D466 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_IDENTITY = "iPhone Developer"; - CODE_SIGN_STYLE = Automatic; - DEBUG_INFORMATION_FORMAT = dwarf; - DEVELOPMENT_TEAM = EQHXZ8M8AV; - GCC_C_LANGUAGE_STANDARD = gnu11; - INFOPLIST_FILE = Analytics_Tests_iOS/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 11.1; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = YES; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.Analytics-Tests-iOS"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Core_Example_iOS.app/Core_Example_iOS"; - }; - name = Debug; - }; - DEDFEFF41FD1B8C100F7D466 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_IDENTITY = "iPhone Developer"; - CODE_SIGN_STYLE = Automatic; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = EQHXZ8M8AV; - GCC_C_LANGUAGE_STANDARD = gnu11; - INFOPLIST_FILE = Analytics_Tests_iOS/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 11.1; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_BUNDLE_IDENTIFIER = "com.google.Analytics-Tests-iOS"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Core_Example_iOS.app/Core_Example_iOS"; - }; - name = Release; - }; DEE14D601E84464D006FA992 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -7104,15 +6965,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - DEDFEFF51FD1B8C100F7D466 /* Build configuration list for PBXNativeTarget "Analytics_Tests_iOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DEDFEFF31FD1B8C100F7D466 /* Debug */, - DEDFEFF41FD1B8C100F7D466 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; DEE14D641E84464D006FA992 /* Build configuration list for PBXNativeTarget "Core_Example_iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Example/Firebase.xcodeproj/xcshareddata/xcschemes/Analytics_Tests_iOS.xcscheme b/Example/Firebase.xcodeproj/xcshareddata/xcschemes/Analytics_Tests_iOS.xcscheme deleted file mode 100644 index e31eb3f..0000000 --- a/Example/Firebase.xcodeproj/xcshareddata/xcschemes/Analytics_Tests_iOS.xcscheme +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Example/Podfile b/Example/Podfile index 0d46941..774635c 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -1,3 +1,7 @@ +#delete source lines before master merge +source 'sso://cpdc-internal/spec' +source 'https://github.com/CocoaPods/Specs.git' + use_frameworks! pod 'FirebaseCore', :path => '../' @@ -8,17 +12,12 @@ target 'Core_Example_iOS' do # The next line is the forcing function for the Firebase pod. The Firebase # version's subspecs should depend on the component versions in their # corresponding podspec's. - pod 'Firebase/Core', '4.13.0' + pod 'Firebase/Core', '5.0.0' target 'Core_Tests_iOS' do inherit! :search_paths pod 'OCMock' end - - target 'Analytics_Tests_iOS' do - inherit! :search_paths - pod 'FirebaseAnalytics' - end end target 'Auth_Example_iOS' do @@ -214,11 +213,3 @@ target 'Storage_Example_tvOS' do # pod 'OCMock' # end end - -# This post_install workaround should be removed when FirebaseAnalytics -# removes its module includes to FirebaseCore. - -post_install do | installer | - print "Fix up FirebaseAnalytics module ... \n" - system 'cp ../patch/FirebaseAnalytics.h Pods/FirebaseAnalytics/Frameworks/FirebaseAnalytics.framework/Headers/' -end -- cgit v1.2.3 From 5bb6e0f091b76ed8a02ce402d766cf4e26d33784 Mon Sep 17 00:00:00 2001 From: Zsika Phillip Date: Wed, 25 Apr 2018 21:50:19 -0700 Subject: Adds new callback to createUse API (breaking change) (#1186) --- Example/Auth/Sample/MainViewController.m | 8 +++++--- Example/Auth/SwiftSample/ViewController.swift | 4 ++-- Example/Auth/Tests/FIRAuthTests.m | 15 +++++++++------ Firebase/Auth/Source/FIRAuth.m | 18 ++++++++++++++---- Firebase/Auth/Source/Public/FIRAuth.h | 13 ++++++++++--- 5 files changed, 40 insertions(+), 18 deletions(-) (limited to 'Example') diff --git a/Example/Auth/Sample/MainViewController.m b/Example/Auth/Sample/MainViewController.m index 4c9ec13..0da28c8 100644 --- a/Example/Auth/Sample/MainViewController.m +++ b/Example/Auth/Sample/MainViewController.m @@ -1884,7 +1884,8 @@ static NSDictionary *parseURL(NSString *urlString) { callback:(nullable FIRAuthResultCallback)callback { [[AppManager auth] createUserWithEmail:email password:password - completion:^(FIRUser *_Nullable user, NSError *_Nullable error) { + completion:^(FIRAuthDataResult *_Nullable result, + NSError *_Nullable error) { if (error) { [self logFailure:@"sign-up with Email/Password failed" error:error]; if (callback) { @@ -1893,7 +1894,7 @@ static NSDictionary *parseURL(NSString *urlString) { } else { [self logSuccess:@"sign-up with Email/Password succeeded."]; if (callback) { - callback(user, nil); + callback(result.user, nil); } } [self showTypicalUIForUserUpdateResultsWithTitle:@"Sign-In" error:error]; @@ -2803,7 +2804,8 @@ static NSDictionary *parseURL(NSString *urlString) { [self showSpinner:^{ [[AppManager auth] createUserWithEmail:email password:password - completion:^(FIRUser *_Nullable user, NSError *_Nullable error) { + completion:^(FIRAuthDataResult *_Nullable result, + NSError *_Nullable error) { if (error) { [self logFailure:@"create user failed" error:error]; } else { diff --git a/Example/Auth/SwiftSample/ViewController.swift b/Example/Auth/SwiftSample/ViewController.swift index d902b38..05b0dd2 100644 --- a/Example/Auth/SwiftSample/ViewController.swift +++ b/Example/Auth/SwiftSample/ViewController.swift @@ -232,9 +232,9 @@ final class ViewController: UIViewController, UITextFieldDelegate, AuthUIDelegat } case .createUser: Auth.auth().createUser(withEmail: emailField.text!, password: passwordField.text!) { - user, error in + result, error in self.ifNoError(error) { - self.showAlert(title: "Signed In With Credential", message: user?.textDescription) + self.showAlert(title: "Signed In With Credential", message: result?.user.textDescription) } } case .signOut: diff --git a/Example/Auth/Tests/FIRAuthTests.m b/Example/Auth/Tests/FIRAuthTests.m index d238057..34c0499 100644 --- a/Example/Auth/Tests/FIRAuthTests.m +++ b/Example/Auth/Tests/FIRAuthTests.m @@ -1592,9 +1592,9 @@ static const NSTimeInterval kWaitInterval = .5; [[FIRAuth auth] signOut:NULL]; [[FIRAuth auth] createUserWithEmail:kEmail password:kFakePassword - completion:^(FIRUser *_Nullable user, NSError *_Nullable error) { + completion:^(FIRAuthDataResult *_Nullable result, NSError *_Nullable error) { XCTAssertTrue([NSThread isMainThread]); - [self assertUser:user]; + [self assertUser:result.user]; XCTAssertNil(error); [expectation fulfill]; }]; @@ -1614,9 +1614,10 @@ static const NSTimeInterval kWaitInterval = .5; [[FIRAuth auth] signOut:NULL]; [[FIRAuth auth] createUserWithEmail:kEmail password:kFakePassword - completion:^(FIRUser *_Nullable user, NSError *_Nullable error) { + completion:^(FIRAuthDataResult *_Nullable result, + NSError *_Nullable error) { XCTAssertTrue([NSThread isMainThread]); - XCTAssertNil(user); + XCTAssertNil(result.user); XCTAssertEqual(error.code, FIRAuthErrorCodeWeakPassword); XCTAssertNotNil(error.userInfo[NSLocalizedDescriptionKey]); XCTAssertEqualObjects(error.userInfo[NSLocalizedFailureReasonErrorKey], reason); @@ -1700,7 +1701,8 @@ static const NSTimeInterval kWaitInterval = .5; [[FIRAuth auth] signOut:NULL]; [[FIRAuth auth] createUserWithEmail:kEmail password:@"" - completion:^(FIRUser *_Nullable user, NSError *_Nullable error) { + completion:^(FIRAuthDataResult *_Nullable result, + NSError *_Nullable error) { XCTAssertTrue([NSThread isMainThread]); XCTAssertEqual(error.code, FIRAuthErrorCodeWeakPassword); [expectation fulfill]; @@ -1719,7 +1721,8 @@ static const NSTimeInterval kWaitInterval = .5; [[FIRAuth auth] signOut:NULL]; [[FIRAuth auth] createUserWithEmail:@"" password:kFakePassword - completion:^(FIRUser *_Nullable user, NSError *_Nullable error) { + completion:^(FIRAuthDataResult *_Nullable result, + NSError *_Nullable error) { XCTAssertTrue([NSThread isMainThread]); XCTAssertEqual(error.code, FIRAuthErrorCodeMissingEmail); [expectation fulfill]; diff --git a/Firebase/Auth/Source/FIRAuth.m b/Firebase/Auth/Source/FIRAuth.m index 5ec9a6f..82a7c02 100644 --- a/Firebase/Auth/Source/FIRAuth.m +++ b/Firebase/Auth/Source/FIRAuth.m @@ -946,10 +946,10 @@ static NSMutableDictionary *gKeychainServiceNameForAppName; - (void)createUserWithEmail:(NSString *)email password:(NSString *)password - completion:(nullable FIRAuthResultCallback)completion { + completion:(nullable FIRAuthDataResultCallback)completion { dispatch_async(FIRAuthGlobalWorkQueue(), ^{ - FIRAuthResultCallback decoratedCallback = - [self signInFlowAuthResultCallbackByDecoratingCallback:completion]; + FIRAuthDataResultCallback decoratedCallback = + [self signInFlowAuthDataResultCallbackByDecoratingCallback:completion]; [self internalCreateUserWithEmail:email password:password completion:^(FIRSignUpNewUserResponse *_Nullable response, @@ -962,7 +962,17 @@ static NSMutableDictionary *gKeychainServiceNameForAppName; accessTokenExpirationDate:response.approximateExpirationDate refreshToken:response.refreshToken anonymous:NO - callback:decoratedCallback]; + callback:^(FIRUser *_Nullable user, NSError *_Nullable error) { + FIRAdditionalUserInfo *additionalUserInfo = + [[FIRAdditionalUserInfo alloc] initWithProviderID:FIREmailAuthProviderID + profile:nil + username:nil + isNewUser:YES]; + FIRAuthDataResult *authDataResult = + [[FIRAuthDataResult alloc] initWithUser:user + additionalUserInfo:additionalUserInfo]; + decoratedCallback(authDataResult, nil); + }]; }]; }); } diff --git a/Firebase/Auth/Source/Public/FIRAuth.h b/Firebase/Auth/Source/Public/FIRAuth.h index c20ecbe..c262c49 100644 --- a/Firebase/Auth/Source/Public/FIRAuth.h +++ b/Firebase/Auth/Source/Public/FIRAuth.h @@ -639,10 +639,11 @@ NS_SWIFT_NAME(Auth) */ - (void)createUserWithEmail:(NSString *)email password:(NSString *)password - completion:(nullable FIRAuthResultCallback)completion; + completion:(nullable FIRAuthDataResultCallback)completion; /** @fn createUserAndRetrieveDataWithEmail:password:completion: - @brief Creates and, on success, signs in a user with the given email address and password. + @brief Please use `createUserAndRetrieveDataWithEmail:password:completion:` or + `createUser(withEmail:password:completion:)` for Swift instead. @param email The user's email address. @param password The user's desired password. @@ -669,7 +670,13 @@ NS_SWIFT_NAME(Auth) */ - (void)createUserAndRetrieveDataWithEmail:(NSString *)email password:(NSString *)password - completion:(nullable FIRAuthDataResultCallback)completion; + completion:(nullable FIRAuthDataResultCallback)completion + DEPRECATED_MSG_ATTRIBUTE( + "createUserAndRetrieveDataWithEmail:password:completion: is" + " deprecated. Please use" + " createUserWithEmail:password:completion: for Objective-C or" + " createUser(withEmail:password:completion:) for Swift" + " instead."); /** @fn confirmPasswordResetWithCode:newPassword:completion: @brief Resets the password given a code sent to the user outside of the app and a new password -- cgit v1.2.3 From b6a84b6b61b8a1a0d8c0b79e4111a15e8bd35c53 Mon Sep 17 00:00:00 2001 From: Zsika Phillip Date: Sun, 29 Apr 2018 19:29:48 -0700 Subject: Adds phone auth testing. (disableAppVerification) (#1192) --- Example/Auth/Sample/SettingsViewController.m | 17 +++++ Example/Auth/Tests/FIRPhoneAuthProviderTests.m | 75 ++++++++++++++++++++++ .../AuthProviders/Phone/FIRPhoneAuthProvider.m | 15 +++++ Firebase/Auth/Source/FIRAuth.m | 2 + Firebase/Auth/Source/FIRAuthSettings.m | 29 +++++++++ Firebase/Auth/Source/Public/FIRAuth.h | 6 ++ Firebase/Auth/Source/Public/FIRAuthSettings.h | 30 +++++++++ Firebase/Auth/Source/Public/FirebaseAuth.h | 1 + Firebase/Auth/Source/RPCs/FIRAuthBackend.m | 14 ++++ 9 files changed, 189 insertions(+) create mode 100644 Firebase/Auth/Source/FIRAuthSettings.m create mode 100644 Firebase/Auth/Source/Public/FIRAuthSettings.h (limited to 'Example') diff --git a/Example/Auth/Sample/SettingsViewController.m b/Example/Auth/Sample/SettingsViewController.m index 24a6513..4815f32 100644 --- a/Example/Auth/Sample/SettingsViewController.m +++ b/Example/Auth/Sample/SettingsViewController.m @@ -214,9 +214,26 @@ static NSString *truncatedString(NSString *string, NSUInteger length) { [weakSelf loadTableView]; }], ]], + [StaticContentTableViewSection sectionWithTitle:@"Auth Settings" cells:@[ + [StaticContentTableViewCell cellWithTitle:@"Disable App Verification (Phone)" + value:[AppManager auth].settings. + appVerificationDisabledForTesting ? @"Yes" : @"No" + action:^{ + [weakSelf toggleDisableAppVerification]; + [weakSelf loadTableView]; + }], + ]], ]]; } +/** @fn toggleDisableAppVerification + @brief Toggles the appVerificationDisabledForTesting flag on the current Auth instance. + */ +- (void)toggleDisableAppVerification { + [AppManager auth].settings.appVerificationDisabledForTesting = + ![AppManager auth].settings.appVerificationDisabledForTesting; +} + /** @fn toggleAPIHostWithRequestClassName: @brief Toggles the host name of the server that handles RPCs. @param requestClassName The name of the RPC request class. diff --git a/Example/Auth/Tests/FIRPhoneAuthProviderTests.m b/Example/Auth/Tests/FIRPhoneAuthProviderTests.m index e00fa1f..96432c7 100644 --- a/Example/Auth/Tests/FIRPhoneAuthProviderTests.m +++ b/Example/Auth/Tests/FIRPhoneAuthProviderTests.m @@ -31,6 +31,7 @@ #import "FIRAuthGlobalWorkQueue.h" #import "FIRAuthNotificationManager.h" #import "FIRAuthRequestConfiguration.h" +#import "FIRAuthSettings.h" #import "FIRAuthUIDelegate.h" #import "FIRAuthURLPresenter.h" #import "FIRAuthWebUtils.h" @@ -362,6 +363,80 @@ static const NSTimeInterval kExpectationTimeout = 2; OCMVerifyAll(_mockAppCredentialManager); } +/** @fn testVerifyPhoneNumberInTestMode + @brief Tests a successful invocation of @c verifyPhoneNumber:completion: when app verification + is disabled. + */ +- (void)testVerifyPhoneNumberInTestMode { + // Disable app verification. + FIRAuthSettings *settings = [[FIRAuthSettings alloc] init]; + settings.appVerificationDisabledForTesting = YES; + OCMStub([_mockAuth settings]).andReturn(settings); + OCMExpect([_mockNotificationManager checkNotificationForwardingWithCallback:OCMOCK_ANY]) + .andCallBlock1(^(FIRAuthNotificationForwardingCallback callback) { callback(YES); }); + OCMExpect([_mockBackend sendVerificationCode:[OCMArg any] callback:[OCMArg any]]) + .andCallBlock2(^(FIRSendVerificationCodeRequest *request, + FIRSendVerificationCodeResponseCallback callback) { + XCTAssertEqualObjects(request.phoneNumber, kTestPhoneNumber); + // Assert that the app credential is nil when in test mode. + XCTAssertNil(request.appCredential); + dispatch_async(FIRAuthGlobalWorkQueue(), ^() { + id mockSendVerificationCodeResponse = OCMClassMock([FIRSendVerificationCodeResponse class]); + OCMStub([mockSendVerificationCodeResponse verificationID]).andReturn(kTestVerificationID); + callback(mockSendVerificationCodeResponse, nil); + }); + }); + + XCTestExpectation *expectation = [self expectationWithDescription:@"callback"]; + [_provider verifyPhoneNumber:kTestPhoneNumber + completion:^(NSString *_Nullable verificationID, NSError *_Nullable error) { + XCTAssertTrue([NSThread isMainThread]); + XCTAssertNil(error); + XCTAssertEqualObjects(verificationID, kTestVerificationID); + [expectation fulfill]; + }]; + [self waitForExpectationsWithTimeout:kExpectationTimeout handler:nil]; + OCMVerifyAll(_mockBackend); + OCMVerifyAll(_mockNotificationManager); + OCMVerifyAll(_mockAppCredentialManager); +} + +/** @fn testVerifyPhoneNumberInTestModeFailure + @brief Tests a failed invocation of @c verifyPhoneNumber:completion: when app verification + is disabled. + */ +- (void)testVerifyPhoneNumberInTestModeFailure { + // Disable app verification. + FIRAuthSettings *settings = [[FIRAuthSettings alloc] init]; + settings.appVerificationDisabledForTesting = YES; + OCMStub([_mockAuth settings]).andReturn(settings); + OCMExpect([_mockNotificationManager checkNotificationForwardingWithCallback:OCMOCK_ANY]) + .andCallBlock1(^(FIRAuthNotificationForwardingCallback callback) { callback(YES); }); + OCMExpect([_mockBackend sendVerificationCode:[OCMArg any] callback:[OCMArg any]]) + .andCallBlock2(^(FIRSendVerificationCodeRequest *request, + FIRSendVerificationCodeResponseCallback callback) { + XCTAssertEqualObjects(request.phoneNumber, kTestPhoneNumber); + // Assert that the app credential is nil when in test mode. + XCTAssertNil(request.appCredential); + dispatch_async(FIRAuthGlobalWorkQueue(), ^() { + callback(nil, [FIRAuthErrorUtils networkErrorWithUnderlyingError:[NSError new]]); + }); + }); + + XCTestExpectation *expectation = [self expectationWithDescription:@"callback"]; + [_provider verifyPhoneNumber:kTestPhoneNumber + completion:^(NSString *_Nullable verificationID, NSError *_Nullable error) { + XCTAssertTrue([NSThread isMainThread]); + XCTAssertNil(verificationID); + XCTAssertEqual(error.code, FIRAuthErrorCodeNetworkError); + [expectation fulfill]; + }]; + [self waitForExpectationsWithTimeout:kExpectationTimeout handler:nil]; + OCMVerifyAll(_mockBackend); + OCMVerifyAll(_mockNotificationManager); + OCMVerifyAll(_mockAppCredentialManager); +} + /** @fn testVerifyPhoneNumberUIDelegate @brief Tests a successful invocation of @c verifyPhoneNumber:UIDelegate:completion:. */ diff --git a/Firebase/Auth/Source/AuthProviders/Phone/FIRPhoneAuthProvider.m b/Firebase/Auth/Source/AuthProviders/Phone/FIRPhoneAuthProvider.m index 948a515..2d06a15 100644 --- a/Firebase/Auth/Source/AuthProviders/Phone/FIRPhoneAuthProvider.m +++ b/Firebase/Auth/Source/AuthProviders/Phone/FIRPhoneAuthProvider.m @@ -29,6 +29,7 @@ #import "FIRAuthNotificationManager.h" #import "FIRAuthErrorUtils.h" #import "FIRAuthBackend.h" +#import "FIRAuthSettings.h" #import "FIRAuthWebUtils.h" #import "FirebaseAuthVersion.h" #import @@ -364,6 +365,20 @@ NSString *const kReCAPTCHAURLStringFormat = @"https://%@/__/auth/handler?"; - (void)verifyClientAndSendVerificationCodeToPhoneNumber:(NSString *)phoneNumber retryOnInvalidAppCredential:(BOOL)retryOnInvalidAppCredential callback:(FIRVerificationResultCallback)callback { + if (_auth.settings.isAppVerificationDisabledForTesting) { + FIRSendVerificationCodeRequest *request = + [[FIRSendVerificationCodeRequest alloc] initWithPhoneNumber:phoneNumber + appCredential:nil + reCAPTCHAToken:nil + requestConfiguration: + _auth.requestConfiguration]; + [FIRAuthBackend sendVerificationCode:request + callback:^(FIRSendVerificationCodeResponse *_Nullable response, + NSError *_Nullable error) { + callback(response.verificationID, error); + }]; + return; + } [self verifyClientWithCompletion:^(FIRAuthAppCredential *_Nullable appCredential, NSError *_Nullable error) { if (error) { diff --git a/Firebase/Auth/Source/FIRAuth.m b/Firebase/Auth/Source/FIRAuth.m index 82a7c02..c83a19a 100644 --- a/Firebase/Auth/Source/FIRAuth.m +++ b/Firebase/Auth/Source/FIRAuth.m @@ -33,6 +33,7 @@ #import "FIRAuthGlobalWorkQueue.h" #import "FIRAuthKeychain.h" #import "FIRAuthOperationType.h" +#import "FIRAuthSettings.h" #import "FIRUser_Internal.h" #import "FirebaseAuth.h" #import "FIRAuthBackend.h" @@ -434,6 +435,7 @@ static NSMutableDictionary *gKeychainServiceNameForAppName; if (self) { _listenerHandles = [NSMutableArray array]; _requestConfiguration = [[FIRAuthRequestConfiguration alloc] initWithAPIKey:APIKey]; + _settings = [[FIRAuthSettings alloc] init]; _firebaseAppName = [appName copy]; #if TARGET_OS_IOS UIApplication *application = [UIApplication sharedApplication]; diff --git a/Firebase/Auth/Source/FIRAuthSettings.m b/Firebase/Auth/Source/FIRAuthSettings.m new file mode 100644 index 0000000..575bb3c --- /dev/null +++ b/Firebase/Auth/Source/FIRAuthSettings.m @@ -0,0 +1,29 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import "FIRAuthSettings.h" + +@implementation FIRAuthSettings + +- (instancetype)init { + self = [super init]; + if (self) { + _appVerificationDisabledForTesting = NO; + } + return self; +} + +@end diff --git a/Firebase/Auth/Source/Public/FIRAuth.h b/Firebase/Auth/Source/Public/FIRAuth.h index c262c49..2901fca 100644 --- a/Firebase/Auth/Source/Public/FIRAuth.h +++ b/Firebase/Auth/Source/Public/FIRAuth.h @@ -28,6 +28,7 @@ @class FIRAuth; @class FIRAuthCredential; @class FIRAuthDataResult; +@class FIRAuthSettings; @class FIRUser; @protocol FIRAuthStateListener; @@ -288,6 +289,11 @@ NS_SWIFT_NAME(Auth) */ @property (nonatomic, copy, nullable) NSString *languageCode; +/** @property settings + @brief Contains settings related to the auth object. + */ +@property (nonatomic, copy, nullable) FIRAuthSettings *settings; + #if TARGET_OS_IOS /** @property APNSToken @brief The APNs token used for phone number authentication. The type of the token (production diff --git a/Firebase/Auth/Source/Public/FIRAuthSettings.h b/Firebase/Auth/Source/Public/FIRAuthSettings.h new file mode 100644 index 0000000..d3fee3e --- /dev/null +++ b/Firebase/Auth/Source/Public/FIRAuthSettings.h @@ -0,0 +1,30 @@ +/* + * Copyright 2018 Google + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +/** @class FIRAuthSettings + @brief Determines settings related to an auth object. + */ +@interface FIRAuthSettings : NSObject + +/** @property appVerificationDisabledForTesting + @brief Flag to determine whether app verification should be disabled for testing or not. + */ +@property (nonatomic, assign, getter=isAppVerificationDisabledForTesting) BOOL + appVerificationDisabledForTesting; + +@end diff --git a/Firebase/Auth/Source/Public/FirebaseAuth.h b/Firebase/Auth/Source/Public/FirebaseAuth.h index cd7e4a4..c8837f8 100644 --- a/Firebase/Auth/Source/Public/FirebaseAuth.h +++ b/Firebase/Auth/Source/Public/FirebaseAuth.h @@ -39,4 +39,5 @@ #import "FIRPhoneAuthCredential.h" #import "FIRPhoneAuthProvider.h" #import "FIRAuthAPNSTokenType.h" +#import "FIRAuthSettings.h" #endif diff --git a/Firebase/Auth/Source/RPCs/FIRAuthBackend.m b/Firebase/Auth/Source/RPCs/FIRAuthBackend.m index e380e34..ff8f2f0 100644 --- a/Firebase/Auth/Source/RPCs/FIRAuthBackend.m +++ b/Firebase/Auth/Source/RPCs/FIRAuthBackend.m @@ -350,6 +350,13 @@ static NSString *const kQuoutaExceededErrorMessage = @"QUOTA_EXCEEDED"; */ static NSString *const kAppNotVerifiedErrorMessage = @"APP_NOT_VERIFIED"; +/** @var kMissingClientIdentifier + @brief This is the error message the server will respond with if Firebase could not verify the + app during a phone authentication flow when a real phone number is used and app verification + is disabled for testing. + */ +static NSString *const kMissingClientIdentifier = @"MISSING_CLIENT_IDENTIFIER"; + /** @var kCaptchaCheckFailedErrorMessage @brief This is the error message the server will respond with if the reCAPTCHA token provided is invalid. @@ -1073,6 +1080,13 @@ static id gBackendImplementation; return [FIRAuthErrorUtils appNotVerifiedErrorWithMessage:serverErrorMessage]; } + if ([shortErrorMessage isEqualToString:kMissingClientIdentifier]) { + return [FIRAuthErrorUtils appNotVerifiedErrorWithMessage:@"Missing app verification via" + " reCAPTCHA or APNS token. Please verify that appVerificationDisabledForTesting is not" + " enabled when testing with a phone number that is not marked as a test Phone number in the" + " app console."]; + } + if ([shortErrorMessage isEqualToString:kCaptchaCheckFailedErrorMessage]) { return [FIRAuthErrorUtils captchaCheckFailedErrorWithMessage:serverErrorMessage]; } -- cgit v1.2.3 From bf545d49e83e7659ecdba73a3124db3521da16eb Mon Sep 17 00:00:00 2001 From: Zsika Phillip Date: Mon, 30 Apr 2018 18:25:06 -0700 Subject: Remove deprecated verify phone number (#1200) * remove_deprecated_verify_phone * Fixes unit tests --- Example/Auth/Sample/MainViewController.m | 40 +------ Example/Auth/Tests/FIRPhoneAuthProviderTests.m | 115 ++++++++++++++++++--- .../AuthProviders/Phone/FIRPhoneAuthProvider.m | 14 --- Firebase/Auth/Source/Public/FIRPhoneAuthProvider.h | 26 ----- 4 files changed, 104 insertions(+), 91 deletions(-) (limited to 'Example') diff --git a/Example/Auth/Sample/MainViewController.m b/Example/Auth/Sample/MainViewController.m index 0da28c8..8667da5 100644 --- a/Example/Auth/Sample/MainViewController.m +++ b/Example/Auth/Sample/MainViewController.m @@ -573,15 +573,10 @@ NSString *const kCreateUserAccessibilityID = @"CreateUserAccessibilityID"; */ static NSString *const kPhoneAuthSectionTitle = @"Phone Auth"; -/** @var kPhoneNumberSignInTitle - @brief The title for button to sign in with phone number. - */ -static NSString *const kPhoneNumberSignInTitle = @"Sign in With Phone Number"; - /** @var kPhoneNumberSignInTitle @brief The title for button to sign in with phone number using reCAPTCHA. */ -static NSString *const kPhoneNumberSignInReCaptchaTitle = @"Sign in With Phone Number (reCAPTCHA)"; +static NSString *const kPhoneNumberSignInReCaptchaTitle = @"Sign in With Phone Number"; /** @var kIsNewUserToggleTitle @brief The title for button to enable new or existing user toggle. @@ -738,8 +733,6 @@ typedef enum { [StaticContentTableViewSection sectionWithTitle:kPhoneAuthSectionTitle cells:@[ [StaticContentTableViewCell cellWithTitle:kPhoneNumberSignInReCaptchaTitle action:^{ [weakSelf signInWithPhoneNumberWithPrompt]; }], - [StaticContentTableViewCell cellWithTitle:kPhoneNumberSignInTitle - action:^{ [weakSelf signInWithPhoneNumber]; }], [StaticContentTableViewCell cellWithTitle:kUpdatePhoneNumber action:^{ [weakSelf updatePhoneNumberWithPrompt]; }], [StaticContentTableViewCell cellWithTitle:kLinkPhoneNumber @@ -2857,37 +2850,6 @@ static NSDictionary *parseURL(NSString *urlString) { }]; } -/** @fn signInWithPhoneNumber - @brief Allows sign in with phone number. - */ -- (void)signInWithPhoneNumber { - [self commonPhoneNumberInputWithTitle:@"Phone #" Completion:^(NSString *_Nullable phone) { - [self showSpinner:^{ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [[AppManager phoneAuthProvider] verifyPhoneNumber:phone - completion:^(NSString *_Nullable verificationID, - NSError *_Nullable error) { -#pragma clang diagnostic pop - [self hideSpinner:^{ - if (error) { - [self logFailure:@"failed to send verification code" error:error]; - [self showMessagePrompt:error.localizedDescription]; - return; - } - [self logSuccess:@"Code sent"]; - - [self commonPhoneNumberInputWithTitle:@"Code" - Completion:^(NSString *_Nullable verificationCode) { - [self commontPhoneVerificationWithVerificationID:verificationID - verificationCode:verificationCode]; - }]; - }]; - }]; - }]; - }]; -} - /** @fn signInWithPhoneNumber @brief Allows sign in with phone number using reCAPTCHA. @param phoneNumber Number pass in string. diff --git a/Example/Auth/Tests/FIRPhoneAuthProviderTests.m b/Example/Auth/Tests/FIRPhoneAuthProviderTests.m index 96432c7..1bb42b1 100644 --- a/Example/Auth/Tests/FIRPhoneAuthProviderTests.m +++ b/Example/Auth/Tests/FIRPhoneAuthProviderTests.m @@ -283,9 +283,16 @@ static const NSTimeInterval kExpectationTimeout = 2; number was provided. */ - (void)testVerifyEmptyPhoneNumber { + id mockBundle = OCMClassMock([NSBundle class]); + OCMStub(ClassMethod([mockBundle mainBundle])).andReturn(mockBundle); + OCMStub([mockBundle objectForInfoDictionaryKey:@"CFBundleURLTypes"]) + .andReturn(@[ @{ @"CFBundleURLSchemes" : @[ kFakeReverseClientID ] } ]); + OCMStub([mockBundle bundleIdentifier]).andReturn(kFakeBundleID); + // Empty phone number is checked on the client side so no backend RPC is mocked. XCTestExpectation *expectation = [self expectationWithDescription:@"callback"]; [_provider verifyPhoneNumber:@"" + UIDelegate:nil completion:^(NSString *_Nullable verificationID, NSError *_Nullable error) { XCTAssertNotNil(error); XCTAssertEqual(error.code, FIRAuthErrorCodeMissingPhoneNumber); @@ -299,6 +306,12 @@ static const NSTimeInterval kExpectationTimeout = 2; number was provided. */ - (void)testVerifyInvalidPhoneNumber { + id mockBundle = OCMClassMock([NSBundle class]); + OCMStub(ClassMethod([mockBundle mainBundle])).andReturn(mockBundle); + OCMStub([mockBundle objectForInfoDictionaryKey:@"CFBundleURLTypes"]) + .andReturn(@[ @{ @"CFBundleURLSchemes" : @[ kFakeReverseClientID ] } ]); + OCMStub([mockBundle bundleIdentifier]).andReturn(kFakeBundleID); + OCMExpect([_mockNotificationManager checkNotificationForwardingWithCallback:OCMOCK_ANY]) .andCallBlock1(^(FIRAuthNotificationForwardingCallback callback) { callback(YES); }); OCMStub([_mockAppCredentialManager credential]) @@ -316,6 +329,7 @@ static const NSTimeInterval kExpectationTimeout = 2; XCTestExpectation *expectation = [self expectationWithDescription:@"callback"]; [_provider verifyPhoneNumber:kTestPhoneNumber + UIDelegate:nil completion:^(NSString *_Nullable verificationID, NSError *_Nullable error) { XCTAssertTrue([NSThread isMainThread]); XCTAssertNil(verificationID); @@ -332,6 +346,12 @@ static const NSTimeInterval kExpectationTimeout = 2; @brief Tests a successful invocation of @c verifyPhoneNumber:completion:. */ - (void)testVerifyPhoneNumber { + id mockBundle = OCMClassMock([NSBundle class]); + OCMStub(ClassMethod([mockBundle mainBundle])).andReturn(mockBundle); + OCMStub([mockBundle objectForInfoDictionaryKey:@"CFBundleURLTypes"]) + .andReturn(@[ @{ @"CFBundleURLSchemes" : @[ kFakeReverseClientID ] } ]); + OCMStub([mockBundle bundleIdentifier]).andReturn(kFakeBundleID); + OCMExpect([_mockNotificationManager checkNotificationForwardingWithCallback:OCMOCK_ANY]) .andCallBlock1(^(FIRAuthNotificationForwardingCallback callback) { callback(YES); }); OCMStub([_mockAppCredentialManager credential]) @@ -351,6 +371,7 @@ static const NSTimeInterval kExpectationTimeout = 2; XCTestExpectation *expectation = [self expectationWithDescription:@"callback"]; [_provider verifyPhoneNumber:kTestPhoneNumber + UIDelegate:nil completion:^(NSString *_Nullable verificationID, NSError *_Nullable error) { XCTAssertTrue([NSThread isMainThread]); XCTAssertNil(error); @@ -368,6 +389,12 @@ static const NSTimeInterval kExpectationTimeout = 2; is disabled. */ - (void)testVerifyPhoneNumberInTestMode { + id mockBundle = OCMClassMock([NSBundle class]); + OCMStub(ClassMethod([mockBundle mainBundle])).andReturn(mockBundle); + OCMStub([mockBundle objectForInfoDictionaryKey:@"CFBundleURLTypes"]) + .andReturn(@[ @{ @"CFBundleURLSchemes" : @[ kFakeReverseClientID ] } ]); + OCMStub([mockBundle bundleIdentifier]).andReturn(kFakeBundleID); + // Disable app verification. FIRAuthSettings *settings = [[FIRAuthSettings alloc] init]; settings.appVerificationDisabledForTesting = YES; @@ -389,6 +416,7 @@ static const NSTimeInterval kExpectationTimeout = 2; XCTestExpectation *expectation = [self expectationWithDescription:@"callback"]; [_provider verifyPhoneNumber:kTestPhoneNumber + UIDelegate:nil completion:^(NSString *_Nullable verificationID, NSError *_Nullable error) { XCTAssertTrue([NSThread isMainThread]); XCTAssertNil(error); @@ -406,6 +434,12 @@ static const NSTimeInterval kExpectationTimeout = 2; is disabled. */ - (void)testVerifyPhoneNumberInTestModeFailure { + id mockBundle = OCMClassMock([NSBundle class]); + OCMStub(ClassMethod([mockBundle mainBundle])).andReturn(mockBundle); + OCMStub([mockBundle objectForInfoDictionaryKey:@"CFBundleURLTypes"]) + .andReturn(@[ @{ @"CFBundleURLSchemes" : @[ kFakeReverseClientID ] } ]); + OCMStub([mockBundle bundleIdentifier]).andReturn(kFakeBundleID); + // Disable app verification. FIRAuthSettings *settings = [[FIRAuthSettings alloc] init]; settings.appVerificationDisabledForTesting = YES; @@ -425,6 +459,7 @@ static const NSTimeInterval kExpectationTimeout = 2; XCTestExpectation *expectation = [self expectationWithDescription:@"callback"]; [_provider verifyPhoneNumber:kTestPhoneNumber + UIDelegate:nil completion:^(NSString *_Nullable verificationID, NSError *_Nullable error) { XCTAssertTrue([NSThread isMainThread]); XCTAssertNil(verificationID); @@ -901,10 +936,17 @@ static const NSTimeInterval kExpectationTimeout = 2; @brief Tests returning an error for the app failing to forward notification. */ - (void)testNotForwardingNotification { + id mockBundle = OCMClassMock([NSBundle class]); + OCMStub(ClassMethod([mockBundle mainBundle])).andReturn(mockBundle); + OCMStub([mockBundle objectForInfoDictionaryKey:@"CFBundleURLTypes"]) + .andReturn(@[ @{ @"CFBundleURLSchemes" : @[ kFakeReverseClientID ] } ]); + OCMStub([mockBundle bundleIdentifier]).andReturn(kFakeBundleID); + OCMExpect([_mockNotificationManager checkNotificationForwardingWithCallback:OCMOCK_ANY]) .andCallBlock1(^(FIRAuthNotificationForwardingCallback callback) { callback(NO); }); XCTestExpectation *expectation = [self expectationWithDescription:@"callback"]; [_provider verifyPhoneNumber:kTestPhoneNumber + UIDelegate:nil completion:^(NSString *_Nullable verificationID, NSError *_Nullable error) { XCTAssertTrue([NSThread isMainThread]); XCTAssertNil(verificationID); @@ -919,19 +961,48 @@ static const NSTimeInterval kExpectationTimeout = 2; @brief Tests returning an error for the app failing to provide an APNS device token. */ - (void)testMissingAPNSToken { + id mockBundle = OCMClassMock([NSBundle class]); + OCMStub(ClassMethod([mockBundle mainBundle])).andReturn(mockBundle); + OCMStub([mockBundle objectForInfoDictionaryKey:@"CFBundleURLTypes"]) + .andReturn(@[ @{ @"CFBundleURLSchemes" : @[ kFakeReverseClientID ] } ]); + OCMStub([mockBundle bundleIdentifier]).andReturn(kFakeBundleID); + + // Simulate missing app token error. OCMExpect([_mockNotificationManager checkNotificationForwardingWithCallback:OCMOCK_ANY]) .andCallBlock1(^(FIRAuthNotificationForwardingCallback callback) { callback(YES); }); OCMExpect([_mockAppCredentialManager credential]).andReturn(nil); OCMExpect([_mockAPNSTokenManager getTokenWithCallback:OCMOCK_ANY]) - .andCallBlock1(^(FIRAuthAPNSTokenCallback callback) { callback(nil, nil); }); - // Expect verify client request to the backend wth empty token. - OCMExpect([_mockBackend verifyClient:[OCMArg any] callback:[OCMArg any]]) - .andCallBlock2(^(FIRVerifyClientRequest *request, - FIRVerifyClientResponseCallback callback) { - XCTAssertNil(request.appToken); + .andCallBlock1(^(FIRAuthAPNSTokenCallback callback) { + NSError *error = [NSError errorWithDomain:FIRAuthErrorDomain + code:FIRAuthErrorCodeMissingAppToken + userInfo:nil]; + callback(nil, error); + }); + OCMExpect([_mockBackend getProjectConfig:[OCMArg any] callback:[OCMArg any]]) + .andCallBlock2(^(FIRGetProjectConfigRequest *request, + FIRGetProjectConfigResponseCallback callback) { + XCTAssertNotNil(request); + dispatch_async(FIRAuthGlobalWorkQueue(), ^() { + id mockGetProjectConfigResponse = OCMClassMock([FIRGetProjectConfigResponse class]); + OCMStub([mockGetProjectConfigResponse authorizedDomains]). + andReturn(@[ kFakeAuthorizedDomain]); + callback(mockGetProjectConfigResponse, nil); + }); + }); + id mockUIDelegate = OCMProtocolMock(@protocol(FIRAuthUIDelegate)); + + // Expect view controller presentation by UIDelegate. + OCMExpect([_mockURLPresenter presentURL:OCMOCK_ANY + UIDelegate:mockUIDelegate + callbackMatcher:OCMOCK_ANY + completion:OCMOCK_ANY]).andDo(^(NSInvocation *invocation) { + __unsafe_unretained id unretainedArgument; + // Indices 0 and 1 indicate the hidden arguments self and _cmd. + // `completion` is at index 5 + [invocation getArgument:&unretainedArgument atIndex:5]; + FIRAuthURLPresentationCompletion completion = unretainedArgument; dispatch_async(FIRAuthGlobalWorkQueue(), ^() { - // The backend is supposed to return an error. - callback(nil, [NSError errorWithDomain:FIRAuthErrorDomain + completion(nil, [NSError errorWithDomain:FIRAuthErrorDomain code:FIRAuthErrorCodeMissingAppToken userInfo:nil]); }); @@ -939,23 +1010,28 @@ static const NSTimeInterval kExpectationTimeout = 2; XCTestExpectation *expectation = [self expectationWithDescription:@"callback"]; [_provider verifyPhoneNumber:kTestPhoneNumber + UIDelegate:mockUIDelegate completion:^(NSString *_Nullable verificationID, NSError *_Nullable error) { XCTAssertTrue([NSThread isMainThread]); - XCTAssertNil(verificationID); - XCTAssertEqualObjects(error.domain, FIRAuthErrorDomain); XCTAssertEqual(error.code, FIRAuthErrorCodeMissingAppToken); + XCTAssertNil(verificationID); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kExpectationTimeout handler:nil]; + OCMVerifyAll(_mockBackend); OCMVerifyAll(_mockNotificationManager); - OCMVerifyAll(_mockAppCredentialManager); - OCMVerifyAll(_mockAPNSTokenManager); } /** @fn testVerifyClient @brief Tests verifying client before sending verification code. */ - (void)testVerifyClient { + id mockBundle = OCMClassMock([NSBundle class]); + OCMStub(ClassMethod([mockBundle mainBundle])).andReturn(mockBundle); + OCMStub([mockBundle objectForInfoDictionaryKey:@"CFBundleURLTypes"]) + .andReturn(@[ @{ @"CFBundleURLSchemes" : @[ kFakeReverseClientID ] } ]); + OCMStub([mockBundle bundleIdentifier]).andReturn(kFakeBundleID); + OCMExpect([_mockNotificationManager checkNotificationForwardingWithCallback:OCMOCK_ANY]) .andCallBlock1(^(FIRAuthNotificationForwardingCallback callback) { callback(YES); }); OCMExpect([_mockAppCredentialManager credential]).andReturn(nil); @@ -1007,6 +1083,7 @@ static const NSTimeInterval kExpectationTimeout = 2; XCTestExpectation *expectation = [self expectationWithDescription:@"callback"]; [_provider verifyPhoneNumber:kTestPhoneNumber + UIDelegate:nil completion:^(NSString *_Nullable verificationID, NSError *_Nullable error) { XCTAssertTrue([NSThread isMainThread]); XCTAssertNil(error); @@ -1024,6 +1101,12 @@ static const NSTimeInterval kExpectationTimeout = 2; @brief Tests failed retry after failing to send verification code. */ - (void)testSendVerificationCodeFailedRetry { + id mockBundle = OCMClassMock([NSBundle class]); + OCMStub(ClassMethod([mockBundle mainBundle])).andReturn(mockBundle); + OCMStub([mockBundle objectForInfoDictionaryKey:@"CFBundleURLTypes"]) + .andReturn(@[ @{ @"CFBundleURLSchemes" : @[ kFakeReverseClientID ] } ]); + OCMStub([mockBundle bundleIdentifier]).andReturn(kFakeBundleID); + OCMExpect([_mockNotificationManager checkNotificationForwardingWithCallback:OCMOCK_ANY]) .andCallBlock1(^(FIRAuthNotificationForwardingCallback callback) { callback(YES); }); @@ -1097,6 +1180,7 @@ static const NSTimeInterval kExpectationTimeout = 2; XCTestExpectation *expectation = [self expectationWithDescription:@"callback"]; [_provider verifyPhoneNumber:kTestPhoneNumber + UIDelegate:nil completion:^(NSString *_Nullable verificationID, NSError *_Nullable error) { XCTAssertTrue([NSThread isMainThread]); XCTAssertNil(verificationID); @@ -1114,6 +1198,12 @@ static const NSTimeInterval kExpectationTimeout = 2; @brief Tests successful retry after failing to send verification code. */ - (void)testSendVerificationCodeSuccessFulRetry { + id mockBundle = OCMClassMock([NSBundle class]); + OCMStub(ClassMethod([mockBundle mainBundle])).andReturn(mockBundle); + OCMStub([mockBundle objectForInfoDictionaryKey:@"CFBundleURLTypes"]) + .andReturn(@[ @{ @"CFBundleURLSchemes" : @[ kFakeReverseClientID ] } ]); + OCMStub([mockBundle bundleIdentifier]).andReturn(kFakeBundleID); + OCMExpect([_mockNotificationManager checkNotificationForwardingWithCallback:OCMOCK_ANY]) .andCallBlock1(^(FIRAuthNotificationForwardingCallback callback) { callback(YES); }); @@ -1189,6 +1279,7 @@ static const NSTimeInterval kExpectationTimeout = 2; XCTestExpectation *expectation = [self expectationWithDescription:@"callback"]; [_provider verifyPhoneNumber:kTestPhoneNumber + UIDelegate:nil completion:^(NSString *_Nullable verificationID, NSError *_Nullable error) { XCTAssertNil(error); XCTAssertEqualObjects(verificationID, kTestVerificationID); diff --git a/Firebase/Auth/Source/AuthProviders/Phone/FIRPhoneAuthProvider.m b/Firebase/Auth/Source/AuthProviders/Phone/FIRPhoneAuthProvider.m index 2d06a15..3532861 100644 --- a/Firebase/Auth/Source/AuthProviders/Phone/FIRPhoneAuthProvider.m +++ b/Firebase/Auth/Source/AuthProviders/Phone/FIRPhoneAuthProvider.m @@ -108,20 +108,6 @@ NSString *const kReCAPTCHAURLStringFormat = @"https://%@/__/auth/handler?"; return self; } -- (void)verifyPhoneNumber:(NSString *)phoneNumber - completion:(nullable FIRVerificationResultCallback)completion { - dispatch_async(FIRAuthGlobalWorkQueue(), ^{ - [self internalVerifyPhoneNumber:phoneNumber completion:^(NSString *_Nullable verificationID, - NSError *_Nullable error) { - if (completion) { - dispatch_async(dispatch_get_main_queue(), ^{ - completion(verificationID, error); - }); - } - }]; - }); -} - - (void)verifyPhoneNumber:(NSString *)phoneNumber UIDelegate:(nullable id)UIDelegate completion:(nullable FIRVerificationResultCallback)completion { diff --git a/Firebase/Auth/Source/Public/FIRPhoneAuthProvider.h b/Firebase/Auth/Source/Public/FIRPhoneAuthProvider.h index bd68e84..28757f5 100644 --- a/Firebase/Auth/Source/Public/FIRPhoneAuthProvider.h +++ b/Firebase/Auth/Source/Public/FIRPhoneAuthProvider.h @@ -61,32 +61,6 @@ NS_SWIFT_NAME(PhoneAuthProvider) */ + (instancetype)providerWithAuth:(FIRAuth *)auth NS_SWIFT_NAME(provider(auth:)); -/** @fn verifyPhoneNumber:completion: - @brief Please use `verifyPhoneNumber:UIDelegate:completion:` instead. - - @param phoneNumber The phone number to be verified. - @param completion The callback to be invoked when the verification flow is finished. - - @remarks Possible error codes: - - + `FIRAuthErrorCodeAppNotVerified` - Indicates that Firebase could not retrieve the - silent push notification and therefore could not verify your app. - + `FIRAuthErrorCodeInvalidAppCredential` - Indicates that The APNs device token provided - is either incorrect or does not match the private certificate uploaded to the Firebase - Console. - + `FIRAuthErrorCodeQuotaExceeded` - Indicates that the phone verification quota for this - project has been exceeded. - + `FIRAuthErrorCodeInvalidPhoneNumber` - Indicates that the phone number provided is - invalid. - + `FIRAuthErrorCodeMissingPhoneNumber` - Indicates that a phone number was not provided. - + `FIRAuthErrorCodeMissingAppToken` - Indicates that the APNs device token could not be - obtained. The app may not have set up remote notification correctly, or may fail to - forward the APNs device token to FIRAuth if app delegate swizzling is disabled. - */ -- (void)verifyPhoneNumber:(NSString *)phoneNumber - completion:(nullable FIRVerificationResultCallback)completion - __attribute__((deprecated)); - /** @fn verifyPhoneNumber:UIDelegate:completion: @brief Starts the phone number authentication flow by sending a verifcation code to the specified phone number. -- cgit v1.2.3 From a0e10d1add6b7cf7213b8fd73aaf78d9d0ecd2eb Mon Sep 17 00:00:00 2001 From: Ryan Wilson Date: Tue, 1 May 2018 09:42:57 -0400 Subject: Remove logging count for this release. (#1201) --- Example/Core/Tests/FIRLoggerTest.m | 27 --------------------------- Firebase/Core/FIRLogger.m | 27 --------------------------- Firebase/Core/Private/FIRLogger.h | 15 --------------- 3 files changed, 69 deletions(-) (limited to 'Example') diff --git a/Example/Core/Tests/FIRLoggerTest.m b/Example/Core/Tests/FIRLoggerTest.m index dfc7cc8..7da62db 100644 --- a/Example/Core/Tests/FIRLoggerTest.m +++ b/Example/Core/Tests/FIRLoggerTest.m @@ -239,33 +239,6 @@ static NSString *const kMessageCode = @"I-COR000001"; XCTAssertEqual(FIRLoggerLevelDebug, ASL_LEVEL_DEBUG); } -- (void)testErrorNumberIncrement { - OCMStub([self.userDefaultsMock integerForKey:kFIRLoggerErrorCountKey]).andReturn(10); - OCMExpect([self.userDefaultsMock setInteger:11 forKey:kFIRLoggerErrorCountKey]); - FIRLogError(kFIRLoggerCore, kMessageCode, @"Error."); - - // Use a delay since the logging is async. - OCMVerifyAllWithDelay(self.userDefaultsMock, 1); -} - -- (void)testWarningNumberIncrement { - OCMStub([self.userDefaultsMock integerForKey:kFIRLoggerWarningCountKey]).andReturn(1); - OCMExpect([self.userDefaultsMock setInteger:2 forKey:kFIRLoggerWarningCountKey]); - FIRLogWarning(kFIRLoggerCore, kMessageCode, @"Warning."); - - // Use a delay since the logging is async. - OCMVerifyAllWithDelay(self.userDefaultsMock, 1); -} - -- (void)testResetIssuesCount { - OCMExpect([self.userDefaultsMock setInteger:0 forKey:kFIRLoggerErrorCountKey]); - OCMExpect([self.userDefaultsMock setInteger:0 forKey:kFIRLoggerWarningCountKey]); - FIRResetNumberOfIssuesLogged(); - - // Use a delay since the logging is async. - OCMVerifyAllWithDelay(self.userDefaultsMock, 1); -} - // Helper functions. - (BOOL)logExists { [self drainFIRClientQueue]; diff --git a/Firebase/Core/FIRLogger.m b/Firebase/Core/FIRLogger.m index ba28f4c..739664d 100644 --- a/Firebase/Core/FIRLogger.m +++ b/Firebase/Core/FIRLogger.m @@ -186,7 +186,6 @@ BOOL FIRIsLoggableLevel(FIRLoggerLevel loggerLevel, BOOL analyticsComponent) { #ifdef DEBUG void FIRResetLogger() { sFIRLoggerOnceToken = 0; - FIRResetNumberOfIssuesLogged(); [[NSUserDefaults standardUserDefaults] removeObjectForKey:kFIRPersistedDebugModeKey]; } @@ -233,17 +232,6 @@ void FIRLogBasic(FIRLoggerLevel level, dispatch_async(sFIRClientQueue, ^{ asl_log(sFIRLoggerClient, NULL, level, "%s", logMsg.UTF8String); }); - - // Keep count of how many errors and warnings are triggered. - if (level == FIRLoggerLevelError) { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - NSInteger errorCount = [defaults integerForKey:kFIRLoggerErrorCountKey]; - [defaults setInteger:errorCount + 1 forKey:kFIRLoggerErrorCountKey]; - } else if (level == FIRLoggerLevelWarning) { - NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; - NSInteger warningCount = [defaults integerForKey:kFIRLoggerWarningCountKey]; - [defaults setInteger:warningCount + 1 forKey:kFIRLoggerWarningCountKey]; - } } #pragma clang diagnostic pop @@ -271,21 +259,6 @@ FIR_LOGGING_FUNCTION(Debug) #undef FIR_MAKE_LOGGER -#pragma mark - Number of errors and warnings - -NSInteger FIRNumberOfErrorsLogged(void) { - return [[NSUserDefaults standardUserDefaults] integerForKey:kFIRLoggerErrorCountKey]; -} - -NSInteger FIRNumberOfWarningsLogged(void) { - return [[NSUserDefaults standardUserDefaults] integerForKey:kFIRLoggerWarningCountKey]; -} - -void FIRResetNumberOfIssuesLogged(void) { - [[NSUserDefaults standardUserDefaults] setInteger:0 forKey:kFIRLoggerErrorCountKey]; - [[NSUserDefaults standardUserDefaults] setInteger:0 forKey:kFIRLoggerWarningCountKey]; -} - #pragma mark - FIRLoggerWrapper @implementation FIRLoggerWrapper diff --git a/Firebase/Core/Private/FIRLogger.h b/Firebase/Core/Private/FIRLogger.h index e095e4e..cbb62e2 100644 --- a/Firebase/Core/Private/FIRLogger.h +++ b/Firebase/Core/Private/FIRLogger.h @@ -71,21 +71,6 @@ void FIRSetAnalyticsDebugMode(BOOL analyticsDebugMode); */ void FIRSetLoggerLevel(FIRLoggerLevel loggerLevel); -/** - * Retrieve the number of errors that have been logged since the stat was last reset. - */ -NSInteger FIRNumberOfErrorsLogged(void); - -/** - * Retrieve the number of warnings that have been logged since the stat was last reset. - */ -NSInteger FIRNumberOfWarningsLogged(void); - -/** - * Reset number of errors and warnings that have been logged to 0. - */ -void FIRResetNumberOfIssuesLogged(void); - /** * Checks if the specified logger level is loggable given the current settings. * (required) log level (one of the FIRLoggerLevel enum values). -- cgit v1.2.3 From 56a529531b5ecd81a68c098ec8fbc5b8a6ec3fcf Mon Sep 17 00:00:00 2001 From: Paul Beusterien Date: Fri, 4 May 2018 10:13:02 -0700 Subject: Disable pre-release repos (#1228) --- Example/Podfile | 6 +++--- Firestore/Example/Podfile | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'Example') diff --git a/Example/Podfile b/Example/Podfile index 774635c..61913f4 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -1,6 +1,6 @@ -#delete source lines before master merge -source 'sso://cpdc-internal/spec' -source 'https://github.com/CocoaPods/Specs.git' +# Uncomment the next two lines for pre-release testing +#source 'sso://cpdc-internal/spec' +#source 'https://github.com/CocoaPods/Specs.git' use_frameworks! diff --git a/Firestore/Example/Podfile b/Firestore/Example/Podfile index a745de7..1de1906 100644 --- a/Firestore/Example/Podfile +++ b/Firestore/Example/Podfile @@ -1,6 +1,6 @@ -#delete source lines before master merge -source 'sso://cpdc-internal/spec' -source 'https://github.com/CocoaPods/Specs.git' +# Uncomment the next two lines for pre-release testing +#source 'sso://cpdc-internal/spec' +#source 'https://github.com/CocoaPods/Specs.git' # The next line is the forcing function for the Firebase pod. The Firebase # version's subspecs should depend on the component versions in their -- cgit v1.2.3