Skip to content

Commit

Permalink
Refactoring method names. (#11680)
Browse files Browse the repository at this point in the history
  • Loading branch information
eldhosembabu authored Aug 18, 2023
1 parent d65cecb commit 171f020
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 15 deletions.
4 changes: 0 additions & 4 deletions FirebaseDynamicLinks/Sources/FIRDLDefaultRetrievalProcessV2.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ NS_ASSUME_NONNULL_BEGIN

/**
Class to encapsulate logic related to retrieving pending dynamic link.
In V2 changed comparing to FIRDLDefaultRetrievalProcess:
- removed Java Script fingerprint and replaced by passing device parametres directly to endpoint;
- added device model name to endpoint;
- added handling of iPhone Apps running in compatibility mode on iPad.
*/
@interface FIRDLDefaultRetrievalProcessV2 : NSObject <FIRDLRetrievalProcessProtocol>

Expand Down
5 changes: 3 additions & 2 deletions FirebaseDynamicLinks/Sources/FIRDLDefaultRetrievalProcessV2.m
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ - (void)retrievePendingDynamicLinkInternal {
// Disable deprecated warning for internal methods.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// If there is not a unique match, we will send an additional request for fingerprinting.
// If there is not a unique match, we will send an additional request for device heuristics based
// matching.
[_networkingService
retrievePendingDynamicLinkWithIOSVersion:[UIDevice currentDevice].systemVersion
resolutionHeight:resolutionHeight
Expand Down Expand Up @@ -245,7 +246,7 @@ - (void)fetchLocaleFromWebView {
if (_jsExecutor) {
return;
}
NSString *jsString = @"window.generateFingerprint=()=>navigator.language||''";
NSString *jsString = @"window.generateDeviceHeuristics=()=>navigator.language||''";
_jsExecutor = [[FIRDLJavaScriptExecutor alloc] initWithDelegate:self script:jsString];
}

Expand Down
10 changes: 5 additions & 5 deletions FirebaseDynamicLinks/Sources/FIRDLJavaScriptExecutor.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@

NS_ASSUME_NONNULL_BEGIN

static NSString *const kJSMethodName = @"generateFingerprint";
static NSString *const kJSMethodName = @"generateDeviceHeuristics";

/** Creates and returns the FDL JS method name. */
NSString *FIRDLTypeofFingerprintJSMethodNameString(void) {
NSString *FIRDLTypeofDeviceHeuristicsJSMethodNameString(void) {
static NSString *methodName;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Expand All @@ -38,7 +38,7 @@
}

/** Creates and returns the FDL JS method definition. */
NSString *GINFingerprintJSMethodString(void) {
NSString *GINDeviceHeuristicsJSMethodString(void) {
static NSString *methodString;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
Expand Down Expand Up @@ -121,15 +121,15 @@ - (void)webView:(WKWebView *)webView
__weak __typeof__(self) weakSelf = self;

// Make sure that the javascript was loaded successfully before calling the method.
[webView evaluateJavaScript:FIRDLTypeofFingerprintJSMethodNameString()
[webView evaluateJavaScript:FIRDLTypeofDeviceHeuristicsJSMethodNameString()
completionHandler:^(id _Nullable typeofResult, NSError *_Nullable typeError) {
if (typeError) {
[weakSelf handleExecutionError:typeError];
return;
}
if ([typeofResult isEqual:@"function"]) {
[webView
evaluateJavaScript:GINFingerprintJSMethodString()
evaluateJavaScript:GINDeviceHeuristicsJSMethodString()
completionHandler:^(id _Nullable result, NSError *_Nullable functionError) {
__typeof__(self) strongSelf = weakSelf;
if ([result isKindOfClass:[NSString class]]) {
Expand Down
2 changes: 1 addition & 1 deletion FirebaseDynamicLinks/Sources/FIRDynamicLinkNetworking.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ typedef NS_ENUM(NSInteger, FIRDynamicLinkNetworkingRetrievalProcessType) {
// iSDK performs a server lookup using default match in the background
// when app is first-opened; no API called by developer.
FIRDynamicLinkNetworkingRetrievalProcessTypeImplicitDefault = 1,
// iSDK performs a server lookup by device fingerprint upon a dev API call.
// iSDK performs a server lookup by device heuristics upon a dev API call.
FIRDynamicLinkNetworkingRetrievalProcessTypeExplicitDefault = 2,
// iSDK performs a unique match only if default match is found upon a dev
// API call.
Expand Down
2 changes: 1 addition & 1 deletion FirebaseDynamicLinks/Sources/FIRDynamicLinks.m
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ - (nullable FIRDynamicLink *)dynamicLinkFromCustomSchemeURL:(NSURL *)url {
}

if ([url.path isEqualToString:@"/link"] && [url.host isEqualToString:@"google"]) {
// This URL is a callback url from a fingerprint match
// This URL is a callback url from a device heuristics based match
// Extract information from query.
NSString *query = url.query;

Expand Down
4 changes: 2 additions & 2 deletions FirebaseDynamicLinks/Tests/Unit/FIRDynamicLinksTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ - (void)testCustomScheme_FirstTimeOpenedWithCustomSchemeShouldGetStrongMatch {
XCTAssertEqualObjects(dynamicLink.inviteId, invitationId);
}

- (void)testCustomScheme_FirstTimeOpenedFromFingerprintCodepathShouldGetWeakMatch {
- (void)testCustomScheme_FirstTimeOpenedFromDeviceHeuristicsCodepathShouldGetWeakMatch {
NSString *invitationId = @"21392094021749127-4389172947";

NSString *urlString =
Expand All @@ -421,7 +421,7 @@ - (void)testCustomScheme_FirstTimeOpenedFromFingerprintCodepathShouldGetWeakMatc
FIRDynamicLink *dynamicLink = [self.service dynamicLinkFromCustomSchemeURL:url];
XCTAssertEqual(
dynamicLink.matchConfidence, FIRDynamicLinkMatchConfidenceWeak,
@"matchConfidence should be weak when app is first opened from fingerprint codepath.");
@"matchConfidence should be weak when app is first opened from device heuristics codepath.");
XCTAssertNil(dynamicLink.url);
XCTAssertEqualObjects(dynamicLink.inviteId, invitationId);
}
Expand Down

0 comments on commit 171f020

Please sign in to comment.