Skip to content

Commit c1f2413

Browse files
committed
Merge branch 'master' into morganchen/emu
2 parents 6dde31f + c264003 commit c1f2413

28 files changed

+91
-30
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ template_path=.github/ISSUE_TEMPLATE/bug_report.md
2525

2626
* Xcode version: _____
2727
* Firebase SDK version: _____
28-
* Firebase Component: _____ (Auth, Core, Database, Firestore, Messaging, Storage, etc)
29-
* Component version: _____
3028
* Installation method: `CocoaPods | Carthage | Zip file | Swift Package Manager` (select one)
29+
* Firebase Component: _____ (Auth, Core, Database, Firestore, Messaging, Storage, etc)
3130

3231
### [REQUIRED] Step 2: Describe the problem
3332

FirebaseDynamicLinks/Sources/FIRDynamicLinks.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,7 @@ - (BOOL)handleIncomingCustomSchemeDeepLink:(NSURL *)url {
510510

511511
- (void)passRetrievedDynamicLinkToApplication:(NSURL *)url {
512512
id<UIApplicationDelegate> applicationDelegate = [UIApplication sharedApplication].delegate;
513-
if (applicationDelegate &&
514-
[applicationDelegate respondsToSelector:@selector(application:openURL:options:)]) {
513+
if ([self isOpenUrlMethodPresentInAppDelegate:applicationDelegate]) {
515514
// pass url directly to application delegate to avoid hop into
516515
// iOS handling of the universal links
517516
[applicationDelegate application:[UIApplication sharedApplication] openURL:url options:@{}];
@@ -521,6 +520,11 @@ - (void)passRetrievedDynamicLinkToApplication:(NSURL *)url {
521520
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
522521
}
523522

523+
- (BOOL)isOpenUrlMethodPresentInAppDelegate:(id<UIApplicationDelegate>)applicationDelegate {
524+
return applicationDelegate &&
525+
[applicationDelegate respondsToSelector:@selector(application:openURL:options:)];
526+
}
527+
524528
- (void)handlePendingDynamicLinkRetrievalFailureWithErrorCode:(NSInteger)errorCode
525529
errorDescription:(NSString *)errorDescription
526530
underlyingError:(nullable NSError *)underlyingError {

FirebaseDynamicLinks/Tests/Unit/FIRDynamicLinksTest.m

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ - (BOOL)setUpWithLaunchOptions:(nullable NSDictionary *)launchOptions
7979
urlScheme:(nullable NSString *)urlScheme
8080
userDefaults:(nullable NSUserDefaults *)userDefaults;
8181
- (BOOL)canParseUniversalLinkURL:(nullable NSURL *)url;
82+
- (void)passRetrievedDynamicLinkToApplication:(NSURL *)url;
83+
- (BOOL)isOpenUrlMethodPresentInAppDelegate:(id<UIApplicationDelegate>)applicationDelegate;
8284
@end
8385

8486
@interface FakeShortLinkResolver : FIRDynamicLinkNetworking
@@ -1119,7 +1121,7 @@ - (void)test_retrievePendingDeepLinkShouldSetkFIRDLOpenURLKeyRegardlessOfFailure
11191121
apiKey:kAPIKey
11201122
urlScheme:nil
11211123
userDefaults:[NSUserDefaults standardUserDefaults]];
1122-
FIRDynamicLinks<FIRDLRetrievalProcessDelegate> *deleagte =
1124+
FIRDynamicLinks<FIRDLRetrievalProcessDelegate> *delegate =
11231125
(FIRDynamicLinks<FIRDLRetrievalProcessDelegate> *)self.service;
11241126

11251127
// Error Result to pass
@@ -1131,13 +1133,36 @@ - (void)test_retrievePendingDeepLinkShouldSetkFIRDLOpenURLKeyRegardlessOfFailure
11311133

11321134
FIRDLDefaultRetrievalProcessV2 *defaultRetrievalProcess = [FIRDLDefaultRetrievalProcessV2 alloc];
11331135

1134-
[deleagte retrievalProcess:defaultRetrievalProcess completedWithResult:result];
1136+
[delegate retrievalProcess:defaultRetrievalProcess completedWithResult:result];
11351137

11361138
NSString *kFIRDLOpenURLKey = @"com.google.appinvite.openURL";
11371139
XCTAssertEqual([[NSUserDefaults standardUserDefaults] boolForKey:kFIRDLOpenURLKey], YES,
11381140
@"kFIRDLOpenURL key should be set regardless of failures");
11391141
}
11401142

1143+
- (void)test_passRetrievedDynamicLinkToApplicationDelegatesProperly {
1144+
// Creating ApplicationDelegate partial mock object.
1145+
id applicationDelegate = OCMPartialMock([UIApplication sharedApplication].delegate);
1146+
// Creating FIRDynamicLinks partial mock object.
1147+
id firebaseDynamicLinks = OCMPartialMock(self.service);
1148+
// Stubbing Application delegate to return YES when application:openURL:options method is called.
1149+
// Not sure why this is required as we are not concerned about its return, but without this, the
1150+
// test will throw NSInvalidArgumentException with message "unrecognized selector sent to
1151+
// instance".
1152+
OCMStub([applicationDelegate application:[OCMArg any] openURL:[OCMArg any] options:[OCMArg any]])
1153+
.andReturn(YES);
1154+
// Stubbing firebase dynamiclinks instance to return YES when isOpenUrlMethodPresentInAppDelegate
1155+
// is called.
1156+
OCMStub([firebaseDynamicLinks isOpenUrlMethodPresentInAppDelegate:[OCMArg any]]).andReturn(YES);
1157+
1158+
// Executing the function with a URL.
1159+
NSURL *url = [NSURL URLWithString:@"http://www.google.com"];
1160+
[firebaseDynamicLinks passRetrievedDynamicLinkToApplication:url];
1161+
1162+
// Verifying the application:openURL:options method is called in AppDelegate.
1163+
OCMVerify([applicationDelegate application:[OCMArg any] openURL:url options:[OCMArg any]]);
1164+
}
1165+
11411166
#pragma mark - Self-diagnose tests
11421167

11431168
- (void)testSelfDiagnoseWithNilCompletion {

GoogleUtilities/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# 7.1.0 -- Unreleased
22
- Added `NSURLSession` promise extension. (#6753)
3+
- `ios_on_mac` option added to `GULAppEnvironmentUtil.applePlatform()`. (#6799)
34

45
# 7.0.0
56
- All APIs are now public. All CocoaPods private headers are transitioned to public. Note that

GoogleUtilities/Environment/third_party/GULAppEnvironmentUtil.m

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,14 +272,24 @@ + (NSString *)applePlatform {
272272
#if TARGET_OS_MACCATALYST
273273
applePlatform = @"maccatalyst";
274274
#elif TARGET_OS_IOS
275+
276+
#if defined(__IPHONE_14_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000
277+
if (@available(iOS 14.0, *)) {
278+
applePlatform = [NSProcessInfo processInfo].isiOSAppOnMac ? @"ios_on_mac" : @"ios";
279+
} else {
280+
applePlatform = @"ios";
281+
}
282+
#else // defined(__IPHONE_14_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000
275283
applePlatform = @"ios";
284+
#endif // defined(__IPHONE_14_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000
285+
276286
#elif TARGET_OS_TV
277287
applePlatform = @"tvos";
278288
#elif TARGET_OS_OSX
279289
applePlatform = @"macos";
280290
#elif TARGET_OS_WATCH
281291
applePlatform = @"watchos";
282-
#endif
292+
#endif // TARGET_OS_MACCATALYST
283293

284294
return applePlatform;
285295
}

ReleaseTooling/CarthageJSON/FirebaseABTestingBinary.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,6 @@
5555
"6.7.0": "https://dl.google.com/dl/firebase/ios/carthage/6.7.0/ABTesting-69cf17255f965180.zip",
5656
"6.8.0": "https://dl.google.com/dl/firebase/ios/carthage/6.8.0/ABTesting-0cfcdbeb0f1f23e5.zip",
5757
"6.8.1": "https://dl.google.com/dl/firebase/ios/carthage/6.8.1/ABTesting-55feba1b99b3ebf4.zip",
58-
"6.9.0": "https://dl.google.com/dl/firebase/ios/carthage/6.9.0/ABTesting-a17b271bd2822405.zip"
58+
"6.9.0": "https://dl.google.com/dl/firebase/ios/carthage/6.9.0/ABTesting-a17b271bd2822405.zip",
59+
"7.0.0": "https://dl.google.com/dl/firebase/ios/carthage/7.0.0/FirebaseABTesting-4520f0f18180693c.zip"
5960
}

ReleaseTooling/CarthageJSON/FirebaseAdMobBinary.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,6 @@
5555
"6.7.0": "https://dl.google.com/dl/firebase/ios/carthage/6.7.0/AdMob-d76755368433e50e.zip",
5656
"6.8.0": "https://dl.google.com/dl/firebase/ios/carthage/6.8.0/AdMob-f24caa8b0c950885.zip",
5757
"6.8.1": "https://dl.google.com/dl/firebase/ios/carthage/6.8.1/AdMob-d76755368433e50e.zip",
58-
"6.9.0": "https://dl.google.com/dl/firebase/ios/carthage/6.9.0/AdMob-50597c9e7223ee44.zip"
58+
"6.9.0": "https://dl.google.com/dl/firebase/ios/carthage/6.9.0/AdMob-50597c9e7223ee44.zip",
59+
"7.0.0": "https://dl.google.com/dl/firebase/ios/carthage/7.0.0/Google-Mobile-Ads-SDK-57acca92672ef61b.zip"
5960
}

ReleaseTooling/CarthageJSON/FirebaseAnalyticsBinary.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,6 @@
5656
"6.7.0": "https://dl.google.com/dl/firebase/ios/carthage/6.7.0/Analytics-daecbd4990b42fd1.zip",
5757
"6.8.0": "https://dl.google.com/dl/firebase/ios/carthage/6.8.0/Analytics-63dcd08a4182f525.zip",
5858
"6.8.1": "https://dl.google.com/dl/firebase/ios/carthage/6.8.1/Analytics-664a64b073ca7e5a.zip",
59-
"6.9.0": "https://dl.google.com/dl/firebase/ios/carthage/6.9.0/Analytics-8e4f2b0b33540341.zip"
59+
"6.9.0": "https://dl.google.com/dl/firebase/ios/carthage/6.9.0/Analytics-8e4f2b0b33540341.zip",
60+
"7.0.0": "https://dl.google.com/dl/firebase/ios/carthage/7.0.0/FirebaseAnalytics-13faccd30235aef6.zip"
6061
}

ReleaseTooling/CarthageJSON/FirebaseAppDistributionBinary.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"6.31.0": "https://dl.google.com/dl/firebase/ios/carthage/6.31.0/FirebaseAppDistribution-07f6a2cf7f576a8a.zip",
33
"6.32.0": "https://dl.google.com/dl/firebase/ios/carthage/6.32.0/FirebaseAppDistribution-a9c4f5db794508ca.zip",
44
"6.33.0": "https://dl.google.com/dl/firebase/ios/carthage/6.33.0/FirebaseAppDistribution-448a96d2ade54581.zip",
5-
"6.34.0": "https://dl.google.com/dl/firebase/ios/carthage/6.34.0/FirebaseAppDistribution-4f620647df681d5b.zip"
5+
"6.34.0": "https://dl.google.com/dl/firebase/ios/carthage/6.34.0/FirebaseAppDistribution-4f620647df681d5b.zip",
6+
"7.0.0": "https://dl.google.com/dl/firebase/ios/carthage/7.0.0/FirebaseAppDistribution-f6bfaecf3d2b86e3.zip"
67
}

ReleaseTooling/CarthageJSON/FirebaseAuthBinary.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,6 @@
5555
"6.7.0": "https://dl.google.com/dl/firebase/ios/carthage/6.7.0/Auth-649b7f73fb368ff1.zip",
5656
"6.8.0": "https://dl.google.com/dl/firebase/ios/carthage/6.8.0/Auth-d6000066c46f6cc0.zip",
5757
"6.8.1": "https://dl.google.com/dl/firebase/ios/carthage/6.8.1/Auth-7ef8889c95095243.zip",
58-
"6.9.0": "https://dl.google.com/dl/firebase/ios/carthage/6.9.0/Auth-af61df0a74e5c3bd.zip"
58+
"6.9.0": "https://dl.google.com/dl/firebase/ios/carthage/6.9.0/Auth-af61df0a74e5c3bd.zip",
59+
"7.0.0": "https://dl.google.com/dl/firebase/ios/carthage/7.0.0/FirebaseAuth-5e3de37f95a24442.zip"
5960
}

0 commit comments

Comments
 (0)