Skip to content

Commit c4ae7f4

Browse files
committed
Merge branch 'master' into bs-appauthcleanup
* master: (26 commits) Functions Interop (#2113) Add a travis cron job for CocoaPod symbol collision testing (#2154) Save schema version on downgrade, add test to verify (#2153) Silence Storage Unit Test `nil` warning. (#2150) Update versions for Release 5.14.0 (#2145) gRPC: fix cases where gRPC call could be finished twice (#2146) Fix Swizzler test warnings (#2144) Update Auth CHANGELOG.md (#2128) Make fuzz tests optional until they pass (#2143) Add support of Game Center sign in (#2127) Add test for deprecated FDLURLComponents init API. (#2133) fix a typo in integration test (#2131) Make fuzzing less verbose to avoid exceeding Travis log limit (#2126) Move to `domainURIPrefix` for FIRDynamicLinkComponents (#2119) Carthage instructions for new gRPCCertificates.bundle location (#2132) Fix pod lib lint GoogleUtilities.podspec --use-libraries regression (#2130) Avoid using default FIROptions directly. (#2124) Changelog entry for LRU GC (#2122) Revert "Add Firebase Source to Header Search Path" (#2123) Custom fdl domain (#2121) ...
2 parents 241a9d0 + 87a206e commit c4ae7f4

File tree

133 files changed

+3567
-429
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+3567
-429
lines changed

.travis.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,15 @@ jobs:
112112
# The travis_wait is necessary because the command takes more than 10 minutes.
113113
- travis_wait ./scripts/if_cron.sh ./scripts/pod_lib_lint.sh FirebaseFirestore.podspec --use-libraries --allow-warnings --no-subspecs
114114

115+
# Daily test for symbol collisions between Firebase and CocoaPods.
116+
- stage: test
117+
env:
118+
- PROJECT=SymbolCollision PLATFORM=iOS METHOD=xcodebuild
119+
before_install:
120+
- ./scripts/if_cron.sh ./scripts/install_prereqs.sh
121+
script:
122+
- ./scripts/if_cron.sh ./scripts/build.sh $PROJECT $PLATFORM $METHOD
123+
115124
# Alternative platforms
116125

117126
# Xcode 9
@@ -248,6 +257,7 @@ jobs:
248257
script:
249258
- ./scripts/if_changed.sh ./scripts/build.sh $PROJECT $PLATFORM $METHOD
250259

260+
allow_failures:
251261
# Run fuzz tests only on cron jobs.
252262
- stage: test
253263
env:
@@ -262,7 +272,6 @@ jobs:
262272
# need to make them fatal for the purposes of the test run.
263273

264274
# TODO(varconst): disallow sanitizers to fail once we fix all existing issues.
265-
allow_failures:
266275
- env:
267276
- PROJECT=Firestore PLATFORM=macOS METHOD=cmake SANITIZERS=asan
268277
- env:

Carthage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseStorageBinary.jso
6363
into the Xcode project and make sure they're added to the
6464
`Copy Bundle Resources` Build Phase :
6565
- For Firestore:
66-
- ./Carthage/Build/iOS/gRPC.framework/gRPCCertificates.bundle
66+
- ./Carthage/Build/iOS/FirebaseFirestore.framework/gRPCCertificates.bundle
6767
- For Invites:
6868
- ./Carthage/Build/iOS/FirebaseInvites.framework/GoogleSignIn.bundle
6969
- ./Carthage/Build/iOS/FirebaseInvites.framework/GPPACLPickerResources.bundle

Example/Auth/Sample/MainViewController.m

Lines changed: 127 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#import "MainViewController.h"
1818

1919
#import <objc/runtime.h>
20+
#import <GameKit/GameKit.h>
2021

2122
#import <FirebaseCore/FIRApp.h>
2223
#import <FirebaseCore/FIRAppInternal.h>
@@ -25,6 +26,7 @@
2526
#import "AppManager.h"
2627
#import "AuthCredentials.h"
2728
#import "FIRAdditionalUserInfo.h"
29+
#import "FIRGameCenterAuthProvider.h"
2830
#import "FIROAuthProvider.h"
2931
#import "FIRPhoneAuthCredential.h"
3032
#import "FIRPhoneAuthProvider.h"
@@ -589,11 +591,41 @@
589591
static NSString *const kPhoneNumberSignInReCaptchaTitle = @"Sign in With Phone Number";
590592

591593
/** @var kVerifyIOSClientTitle
592-
@brief The title for button to verify iOS client.
594+
@brief The title for button to verify iOS client.
593595
*/
594596
static NSString *const kVerifyIOSClientTitle = @"Verify iOS client";
595597

596-
/** @var kIsNewUserToggleTitle
598+
/** @var kGameCenterAuthSectionTitle
599+
@brief The title for the section of Game Center
600+
*/
601+
static NSString *const kGameCenterAuthSectionTitle = @"Game Center";
602+
603+
/** @var kLogInWithSystemGameCenterTitle
604+
@brief The title for the button to log into the Game Center account
605+
*/
606+
static NSString *const kLogInWithSystemGameCenterTitle = @"Log In System Game Center";
607+
608+
/** @var kSignInWithGameCenterTitle
609+
@brief The title for the button to sign in with Game Center
610+
*/
611+
static NSString *const kSignInWithGameCenterTitle = @"Sign in Game Center";
612+
613+
/** @var kLinkWithGameCenterTitle
614+
@brief The title for the button to link with Game Center
615+
*/
616+
static NSString *const kLinkWithGameCenterTitle = @"Link Game Center";
617+
618+
/** @var kUnlinkWithGameCenterTitle
619+
@brief The title for the button to unlink with Game Center
620+
*/
621+
static NSString *const kUnlinkWithGameCenterTitle = @"Unlink Game Center";
622+
623+
/** @var kReauthenticateWithGameCenterTitle
624+
@brief The title for the button to reauthenticate with Game Center
625+
*/
626+
static NSString *const kReauthenticateWithGameCenterTitle = @"Reauthenticate Game Center";
627+
628+
/** @var kNewOrExistingUserToggleTitle
597629
@brief The title for button to enable new or existing user toggle.
598630
*/
599631
static NSString *const kNewOrExistingUserToggleTitle = @"New or Existing User Toggle";
@@ -707,6 +739,8 @@ - (id)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundl
707739
}
708740

709741
- (void)viewDidLoad {
742+
[super viewDidLoad];
743+
710744
// Give us a circle for the image view:
711745
_userInfoTableViewCell.userInfoProfileURLImageView.layer.cornerRadius =
712746
_userInfoTableViewCell.userInfoProfileURLImageView.frame.size.width / 2.0f;
@@ -745,6 +779,20 @@ - (void)updateTable {
745779
_isNewUserToggleOn = !_isNewUserToggleOn;
746780
[self updateTable]; }],
747781
]],
782+
[StaticContentTableViewSection sectionWithTitle:kGameCenterAuthSectionTitle cells:@[
783+
[StaticContentTableViewCell cellWithTitle:kLogInWithSystemGameCenterTitle
784+
action:^{ [weakSelf logInWithSystemGameCenter]; }],
785+
[StaticContentTableViewCell cellWithTitle:kSignInWithGameCenterTitle
786+
action:^{ [weakSelf signInWithGameCenter]; }],
787+
[StaticContentTableViewCell cellWithTitle:kLinkWithGameCenterTitle
788+
action:^{ [weakSelf linkWithGameCenter]; }],
789+
[StaticContentTableViewCell cellWithTitle:kUnlinkWithGameCenterTitle
790+
action:^{
791+
[weakSelf unlinkFromProvider:FIRGameCenterAuthProviderID completion:nil];
792+
}],
793+
[StaticContentTableViewCell cellWithTitle:kReauthenticateWithGameCenterTitle
794+
action:^{ [weakSelf reauthenticateWithGameCenter]; }],
795+
]],
748796
[StaticContentTableViewSection sectionWithTitle:kPhoneAuthSectionTitle cells:@[
749797
[StaticContentTableViewCell cellWithTitle:kPhoneNumberSignInReCaptchaTitle
750798
action:^{ [weakSelf signInWithPhoneNumberWithPrompt]; }],
@@ -1726,6 +1774,83 @@ - (void)signInFacebookAndRetrieveData {
17261774
[self signinWithProvider:[AuthProviders facebook] retrieveData:YES];
17271775
}
17281776

1777+
- (void)logInWithSystemGameCenter {
1778+
GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
1779+
localPlayer.authenticateHandler = ^(UIViewController * _Nullable viewController,
1780+
NSError * _Nullable error) {
1781+
if (error) {
1782+
[self showTypicalUIForUserUpdateResultsWithTitle:@"Game Center Error" error:error];
1783+
} else if (viewController != nil) {
1784+
[self presentViewController:viewController animated:YES completion:nil];
1785+
}
1786+
};
1787+
}
1788+
1789+
- (void)signInWithGameCenter {
1790+
[FIRGameCenterAuthProvider getCredentialWithCompletion:
1791+
^(FIRAuthCredential * _Nullable credential, NSError * _Nullable error) {
1792+
if (error) {
1793+
[self showTypicalUIForUserUpdateResultsWithTitle:@"Game Center Error" error:error];
1794+
} else {
1795+
[[AppManager auth] signInAndRetrieveDataWithCredential:credential
1796+
completion:^(FIRAuthDataResult * _Nullable result,
1797+
NSError * _Nullable error) {
1798+
[self hideSpinner:^{
1799+
if (error) {
1800+
[self logFailure:@"Sign in with Game Center failed" error:error];
1801+
} else {
1802+
[self logSuccess:@"Sign in with Game Center succeeded."];
1803+
}
1804+
[self showTypicalUIForUserUpdateResultsWithTitle:@"Sign In Error" error:error];
1805+
}];
1806+
}];
1807+
}
1808+
}];
1809+
}
1810+
1811+
- (void)linkWithGameCenter {
1812+
[FIRGameCenterAuthProvider getCredentialWithCompletion:
1813+
^(FIRAuthCredential * _Nullable credential, NSError * _Nullable error) {
1814+
if (error) {
1815+
[self showTypicalUIForUserUpdateResultsWithTitle:@"Game Center Error" error:error];
1816+
} else {
1817+
[[self user] linkAndRetrieveDataWithCredential:credential
1818+
completion:^(FIRAuthDataResult * _Nullable result,
1819+
NSError * _Nullable error) {
1820+
[self hideSpinner:^{
1821+
if (error) {
1822+
[self logFailure:@"Link with Game Center failed" error:error];
1823+
} else {
1824+
[self logSuccess:@"Link with Game Center succeeded."];
1825+
}
1826+
[self showTypicalUIForUserUpdateResultsWithTitle:@"Link Error" error:error];
1827+
}];
1828+
}];
1829+
}
1830+
}];
1831+
}
1832+
1833+
- (void)reauthenticateWithGameCenter {
1834+
[FIRGameCenterAuthProvider getCredentialWithCompletion:
1835+
^(FIRAuthCredential * _Nullable credential, NSError * _Nullable error) {
1836+
if (error) {
1837+
[self showTypicalUIForUserUpdateResultsWithTitle:@"Game Center Error" error:error];
1838+
} else {
1839+
[[self user] reauthenticateAndRetrieveDataWithCredential:credential
1840+
completion:^(FIRAuthDataResult * _Nullable result,
1841+
NSError * _Nullable error) {
1842+
[self hideSpinner:^{
1843+
if (error) {
1844+
[self logFailure:@"Reauthenticate with Game Center failed" error:error];
1845+
} else {
1846+
[self logSuccess:@"Reauthenticate with Game Center succeeded."];
1847+
}
1848+
[self showTypicalUIForUserUpdateResultsWithTitle:@"Reauthenticate Error" error:error];
1849+
}];
1850+
}];
1851+
}
1852+
}];
1853+
}
17291854
/** @fn signInEmailPassword
17301855
@brief Invoked when "Sign in with Email/Password" row is pressed.
17311856
*/

Example/Auth/Tests/FIRGetOOBConfirmationCodeRequestTests.m

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,16 @@
126126
*/
127127
static NSString *const kCanHandleCodeInAppKey = @"canHandleCodeInApp";
128128

129+
/** @var kDynamicLinkDomainKey
130+
@brief The key for the "dynamic link domain" value in the request.
131+
*/
132+
static NSString *const kDynamicLinkDomainKey = @"dynamicLinkDomain";
133+
134+
/** @var kDynamicLinkDomain
135+
@brief Fake dynamic link domain for testing.
136+
*/
137+
static NSString *const kDynamicLinkDomain = @"test.page.link";
138+
129139
/** @class FIRGetOOBConfirmationCodeRequestTests
130140
@brief Tests for @c FIRGetOOBConfirmationCodeRequest.
131141
*/
@@ -194,6 +204,7 @@ - (void)testPasswordResetRequest {
194204
[NSNumber numberWithBool:YES]);
195205
XCTAssertEqualObjects(_RPCIssuer.decodedRequest[kCanHandleCodeInAppKey],
196206
[NSNumber numberWithBool:YES]);
207+
XCTAssertEqualObjects(_RPCIssuer.decodedRequest[kDynamicLinkDomainKey], kDynamicLinkDomain);
197208
}
198209

199210
/** @fn testSignInWithEmailLinkRequest
@@ -230,6 +241,7 @@ - (void)testSignInWithEmailLinkRequest {
230241
[NSNumber numberWithBool:YES]);
231242
XCTAssertEqualObjects(_RPCIssuer.decodedRequest[kCanHandleCodeInAppKey],
232243
[NSNumber numberWithBool:YES]);
244+
XCTAssertEqualObjects(_RPCIssuer.decodedRequest[kDynamicLinkDomainKey], kDynamicLinkDomain);
233245
}
234246

235247

@@ -268,6 +280,7 @@ - (void)testEmailVerificationRequest {
268280
[NSNumber numberWithBool:YES]);
269281
XCTAssertEqualObjects(_RPCIssuer.decodedRequest[kCanHandleCodeInAppKey],
270282
[NSNumber numberWithBool:YES]);
283+
XCTAssertEqualObjects(_RPCIssuer.decodedRequest[kDynamicLinkDomainKey], kDynamicLinkDomain);
271284
}
272285

273286
#pragma mark - Helpers
@@ -284,6 +297,7 @@ - (FIRActionCodeSettings *)fakeActionCodeSettings {
284297
minimumVersion:kAndroidMinimumVersion];
285298
actionCodeSettings.handleCodeInApp = YES;
286299
actionCodeSettings.URL = [NSURL URLWithString:kContinueURL];
300+
actionCodeSettings.dynamicLinkDomain = kDynamicLinkDomain;
287301
return actionCodeSettings;
288302
}
289303

0 commit comments

Comments
 (0)