Skip to content

Commit 0e16e6c

Browse files
committed
Fix style. Run ./scripts/style.sh
1 parent 8656130 commit 0e16e6c

File tree

5 files changed

+56
-57
lines changed

5 files changed

+56
-57
lines changed

Example/DynamicLinks/Tests/FIRDynamicLinksTest.m

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,20 +1026,20 @@ - (void)testValidCustomDomainNames {
10261026

10271027
[FIRApp configure];
10281028
NSArray<NSString *> *urlStrings = @[
1029-
@"https://google.com/1", // Valid domain. Any path.
1030-
@"https://google.com/2", // Valid domain. Any path.
1031-
@"https://google.com/one", // Valid domain. Specified path.
1032-
@"https://g.co/1", // Valid domain. Any path.
1033-
@"https://a.firebase.com/mypath/",// Valid subdomain.
1034-
@"https://a.firebase.com/mypath/abcd/efgh",// Long path.
1035-
];
1029+
@"https://google.com/1", // Valid domain. Any path.
1030+
@"https://google.com/2", // Valid domain. Any path.
1031+
@"https://google.com/one", // Valid domain. Specified path.
1032+
@"https://g.co/1", // Valid domain. Any path.
1033+
@"https://a.firebase.com/mypath/", // Valid subdomain.
1034+
@"https://a.firebase.com/mypath/abcd/efgh", // Long path.
1035+
];
10361036

10371037
for (NSString *urlString in urlStrings) {
10381038
NSURL *url = [NSURL URLWithString:urlString];
10391039
BOOL matchesShortLinkFormat = [self.service matchesShortLinkFormat:url];
10401040

10411041
XCTAssertTrue(matchesShortLinkFormat,
1042-
@"Non-DDL domain URL matched short link format with URL: %@", url);
1042+
@"Non-DDL domain URL matched short link format with URL: %@", url);
10431043
}
10441044
}
10451045

@@ -1053,15 +1053,15 @@ - (void)testInvalidCustomDomainNames {
10531053

10541054
[FIRApp configure];
10551055
NSArray<NSString *> *urlStrings = @[
1056-
@"mydomain.com", // Domain not in plist. Also, no scheme.
1057-
@"http://mydomain", // Domain not in plist. No path.
1058-
@"google.com", // Valid domain. No scheme.
1059-
@"https://google.com", // Valid domain. No path.
1060-
@"http://google.com", // Valid domain. Invalid scheme.
1061-
@"https://g.co.com/abc", //Invalid domain starts with valid domain.
1062-
@"https://firebase.com/mypath", // Invalid (sub)domain.
1063-
@"https://b.firebase.com/mypath" // Invalid subdomain.
1064-
];
1056+
@"mydomain.com", // Domain not in plist. Also, no scheme.
1057+
@"http://mydomain", // Domain not in plist. No path.
1058+
@"google.com", // Valid domain. No scheme.
1059+
@"https://google.com", // Valid domain. No path.
1060+
@"http://google.com", // Valid domain. Invalid scheme.
1061+
@"https://g.co.com/abc", // Invalid domain starts with valid domain.
1062+
@"https://firebase.com/mypath", // Invalid (sub)domain.
1063+
@"https://b.firebase.com/mypath" // Invalid subdomain.
1064+
];
10651065

10661066
for (NSString *urlString in urlStrings) {
10671067
NSURL *url = [NSURL URLWithString:urlString];

Example/DynamicLinks/Tests/GINDurableDeepLinkServiceReceivingTests.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
#import <UIKit/UIKit.h>
1818
#import <XCTest/XCTest.h>
1919

20-
#import "DynamicLinks/GINDurableDeepLinkServiceReceiving+Private.h"
2120
#import <OCMock/OCMock.h>
21+
#import "DynamicLinks/GINDurableDeepLinkServiceReceiving+Private.h"
2222

2323
@interface GINDurableDeepLinkServiceReceivingTests : XCTestCase
2424
@end

Firebase/DynamicLinks/FIRDynamicLinks.m

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@
4141
#import "DynamicLinks/Utilities/FDLUtilities.h"
4242

4343
#ifndef FIRDynamicLinks_VERSION
44-
#error \
45-
"FIRDynamicLinks_VERSION is not defined: add -DFIRDynamicLinks_VERSION=... to the build \
44+
#error "FIRDynamicLinks_VERSION is not defined: add -DFIRDynamicLinks_VERSION=... to the build \
4645
invocation"
4746
#endif
4847
@@ -123,8 +122,8 @@ + (void)load {
123122
124123
+ (nonnull NSArray<FIRComponent *> *)componentsToRegister {
125124
// Product requirement is enforced by CocoaPod. Not technical requirement for analytics.
126-
FIRDependency *analyticsDep =
127-
[FIRDependency dependencyWithProtocol:@protocol(FIRAnalyticsInterop) isRequired:NO];
125+
FIRDependency *analyticsDep = [FIRDependency dependencyWithProtocol:@protocol(FIRAnalyticsInterop)
126+
isRequired:NO];
128127
FIRComponentCreationBlock creationBlock =
129128
^id _Nullable(FIRComponentContainer *container, BOOL *isCacheable) {
130129
// Ensure it's cached so it returns the same instance every time dynamicLinks is called.
@@ -580,8 +579,9 @@ + (NSString *)diagnosticAnalyzeEntitlements {
580579
stringByAppendingPathComponent:@"embedded.mobileprovision"];
581580

582581
NSError *error;
583-
NSMutableData *profileData =
584-
[NSMutableData dataWithContentsOfFile:embeddedMobileprovisionFilePath options:0 error:&error];
582+
NSMutableData *profileData = [NSMutableData dataWithContentsOfFile:embeddedMobileprovisionFilePath
583+
options:0
584+
error:&error];
585585

586586
if (!profileData.length || error) {
587587
return @"\tSKIPPED: Not able to read entitlements (embedded.mobileprovision).\n";
@@ -672,21 +672,20 @@ + (NSString *)performDiagnosticsIncludingHeaderFooter:(BOOL)includingHeaderFoote
672672

673673
#if TARGET_IPHONE_SIMULATOR
674674
// check is Simulator and print WARNING that Universal Links is not supported on Simulator
675-
[diagnosticString appendString:
676-
@"WARNING: iOS Simulator does not support Universal Links. Firebase "
677-
@"Dynamic Links SDK functionality will be limited. Some FDL "
678-
@"features may be missing or will not work correctly.\n"];
675+
[diagnosticString
676+
appendString:@"WARNING: iOS Simulator does not support Universal Links. Firebase "
677+
@"Dynamic Links SDK functionality will be limited. Some FDL "
678+
@"features may be missing or will not work correctly.\n"];
679679
#endif // TARGET_IPHONE_SIMULATOR
680680

681681
id<UIApplicationDelegate> applicationDelegate = [UIApplication sharedApplication].delegate;
682682
if (![applicationDelegate respondsToSelector:@selector(application:openURL:options:)]) {
683683
detectedErrorsCnt++;
684-
[diagnosticString appendFormat:
685-
@"ERROR: UIApplication delegate %@ does not implements selector "
686-
@"%@. FDL depends on this implementation to retrieve pending "
687-
@"dynamic link.\n",
688-
applicationDelegate,
689-
NSStringFromSelector(@selector(application:openURL:options:))];
684+
[diagnosticString appendFormat:@"ERROR: UIApplication delegate %@ does not implements selector "
685+
@"%@. FDL depends on this implementation to retrieve pending "
686+
@"dynamic link.\n",
687+
applicationDelegate,
688+
NSStringFromSelector(@selector(application:openURL:options:))];
690689
}
691690

692691
// check that Info.plist has custom URL scheme and the scheme is the same as bundleID or
@@ -708,16 +707,14 @@ + (NSString *)performDiagnosticsIncludingHeaderFooter:(BOOL)includingHeaderFoote
708707
}
709708
if (!URLSchemeFoundInPlist) {
710709
detectedErrorsCnt++;
711-
[diagnosticString appendFormat:
712-
@"ERROR: Specified custom URL scheme is %@ but Info.plist do "
713-
@"not contain such scheme in "
714-
"CFBundleURLTypes key.\n",
715-
URLScheme];
710+
[diagnosticString appendFormat:@"ERROR: Specified custom URL scheme is %@ but Info.plist do "
711+
@"not contain such scheme in "
712+
"CFBundleURLTypes key.\n",
713+
URLScheme];
716714
} else {
717-
[diagnosticString appendFormat:
718-
@"\tSpecified custom URL scheme is %@ and Info.plist contains "
719-
@"such scheme in CFBundleURLTypes key.\n",
720-
URLScheme];
715+
[diagnosticString appendFormat:@"\tSpecified custom URL scheme is %@ and Info.plist contains "
716+
@"such scheme in CFBundleURLTypes key.\n",
717+
URLScheme];
721718
}
722719

723720
#if !TARGET_IPHONE_SIMULATOR
@@ -748,8 +745,8 @@ + (void)performDiagnosticsWithCompletion:(void (^_Nullable)(NSString *diagnostic
748745
BOOL hasErrors))completionHandler;
749746
{
750747
NSInteger detectedErrorsCnt = 0;
751-
NSString *diagnosticString =
752-
[self performDiagnosticsIncludingHeaderFooter:YES detectedErrors:&detectedErrorsCnt];
748+
NSString *diagnosticString = [self performDiagnosticsIncludingHeaderFooter:YES
749+
detectedErrors:&detectedErrorsCnt];
753750
if (completionHandler) {
754751
completionHandler(diagnosticString, detectedErrorsCnt > 0);
755752
} else {

Firebase/DynamicLinks/Utilities/FDLUtilities.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,6 @@ NSString *FIRDLMatchTypeStringFromServerString(NSString *_Nullable serverMatchTy
139139
/**
140140
Add custom domains from the info.plist to the internal whitelist.
141141
*/
142-
void FIRDLAddToWhiteListForCustomDomainsArray(NSArray* _Nonnull customDomains);
142+
void FIRDLAddToWhiteListForCustomDomainsArray(NSArray *_Nonnull customDomains);
143143

144144
NS_ASSUME_NONNULL_END

Firebase/DynamicLinks/Utilities/FDLUtilities.m

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
components.path = @"/app/_/deeplink";
4545
NSMutableArray *queryItems = [NSMutableArray array];
4646

47-
[queryItems
48-
addObject:[NSURLQueryItem queryItemWithName:kFDLBundleIDQueryParameterName value:bundleID]];
49-
[queryItems
50-
addObject:[NSURLQueryItem queryItemWithName:kFDLURLSchemeQueryParameterName value:urlScheme]];
47+
[queryItems addObject:[NSURLQueryItem queryItemWithName:kFDLBundleIDQueryParameterName
48+
value:bundleID]];
49+
[queryItems addObject:[NSURLQueryItem queryItemWithName:kFDLURLSchemeQueryParameterName
50+
value:urlScheme]];
5151
[components setQueryItems:queryItems];
5252

5353
return [components URL];
@@ -195,12 +195,13 @@ BOOL FIRDLOSVersionSupported(NSString *_Nullable systemVersion, NSString *minSup
195195

196196
BOOL FIRDLIsURLForWhiteListedCustomDomain(NSURL *_Nullable URL) {
197197
BOOL customDomainMatchFound = false;
198-
for(NSURL* allowedCustomDomain in FIRDLCustomDomains) {
198+
for (NSURL *allowedCustomDomain in FIRDLCustomDomains) {
199199
// All custom domain host names should match at a minimum.
200200
if ([allowedCustomDomain.host isEqualToString:URL.host]) {
201201
// Next, do a string compare to check if the full path matches as well.
202-
if (([URL.absoluteString rangeOfString:allowedCustomDomain.absoluteString options:NSCaseInsensitiveSearch | NSAnchoredSearch].location) == 0)
203-
{
202+
if (([URL.absoluteString rangeOfString:allowedCustomDomain.absoluteString
203+
options:NSCaseInsensitiveSearch | NSAnchoredSearch]
204+
.location) == 0) {
204205
customDomainMatchFound = true;
205206
break;
206207
}
@@ -248,11 +249,12 @@ BOOL FIRDLMatchesShortLinkFormat(NSURL *URL) {
248249
return matchMap[serverMatchTypeString] ?: @"none";
249250
}
250251

251-
void FIRDLAddToWhiteListForCustomDomainsArray(NSArray* _Nonnull customDomains) {
252+
void FIRDLAddToWhiteListForCustomDomainsArray(NSArray *_Nonnull customDomains) {
252253
// Duplicates will be weeded out when converting to a set.
253-
NSMutableArray *validCustomDomains = [[NSMutableArray alloc] initWithCapacity:customDomains.count];
254-
for(NSString* customDomainEntry in customDomains) {
255-
NSURL* customDomainURL = [NSURL URLWithString:customDomainEntry];
254+
NSMutableArray *validCustomDomains =
255+
[[NSMutableArray alloc] initWithCapacity:customDomains.count];
256+
for (NSString *customDomainEntry in customDomains) {
257+
NSURL *customDomainURL = [NSURL URLWithString:customDomainEntry];
256258
// We require a valid scheme for each custom domain enumerated in the info.plist file.
257259
if (customDomainURL && customDomainURL.scheme) {
258260
[validCustomDomains addObject:customDomainURL];

0 commit comments

Comments
 (0)