99#import " Branch+Validator.h"
1010#import " BNCSystemObserver.h"
1111#import " BranchConstants.h"
12+ #import " BNCApplication.h"
1213
1314void BNCForceBranchValidatorCategoryToLoad (void ) {
1415 // Empty body but forces loader to load the category.
@@ -38,14 +39,15 @@ - (void)validateSDKIntegrationCore {
3839
3940- (void ) startValidation {
4041 BNCPreferenceHelper *preferenceHelper = [BNCPreferenceHelper preferenceHelper ];
41- NSString *endpoint = [BRANCH_REQUEST_ENDPOINT_APP_LINK_SETTINGS stringByAppendingPathComponent: preferenceHelper.lastRunBranchKey];
42+ NSString *endpoint =
43+ [BRANCH_REQUEST_ENDPOINT_APP_LINK_SETTINGS stringByAppendingPathComponent: preferenceHelper.lastRunBranchKey];
4244 [[[BNCServerInterface alloc ] init ]
4345 getRequest: nil
4446 url: [preferenceHelper getAPIURL: endpoint]
4547 key: nil
46- callback: ^(BNCServerResponse *response, NSError *error) {
48+ callback: ^ (BNCServerResponse *response, NSError *error) {
4749 if (error) {
48- [self showAlertWithTitle: @" " message: @" " ];
50+ [self showAlertWithTitle: @" Error " message: error.localizedDescription ];
4951 } else {
5052 [self validateIntegrationWithServerResponse: response];
5153 }
@@ -59,25 +61,25 @@ - (void) validateIntegrationWithServerResponse:(BNCServerResponse*)response {
5961 NSLog (@" ** Initiating Branch integration verification **" );
6062 NSLog (@" -------------------------------------------------" );
6163
62- NSLog (@" ------ checking for URI scheme correctness ------" );
64+ NSLog (@" ------ Checking for URI scheme correctness ------" );
6365 NSString *serverUriScheme = response.data [@" ios_uri_scheme" ];
6466 NSString *clientUriScheme = [NSString stringWithFormat: @" %@%@ " , [BNCSystemObserver getDefaultUriScheme ], @" ://" ];
6567 NSString *uriScheme = [serverUriScheme isEqualToString: clientUriScheme] ? passString : errorString;
6668 NSString *uriSchemeMessage = [NSString stringWithFormat: @" %@ : Dashboard Link Settings page '%@ ' compared to client side '%@ '" , uriScheme, serverUriScheme, clientUriScheme];
6769 NSLog (@" %@ " ,uriSchemeMessage);
6870 NSLog (@" -------------------------------------------------" );
6971
70- NSLog (@" -- checking for bundle identifier correctness ---" );
72+ NSLog (@" -- Checking for bundle identifier correctness ---" );
7173 NSString *serverBundleIdentifier = response.data [@" ios_bundle_id" ];
7274 NSString *clientBundleIdentifier = [[NSBundle mainBundle ] bundleIdentifier ];
7375 NSString *bundleIdentifier = [serverBundleIdentifier isEqualToString: clientBundleIdentifier] ? passString : errorString;
7476 NSString *bundleIdentifierMessage = [NSString stringWithFormat: @" %@ : Dashboard Link Settings page '%@ ' compared to client side '%@ '" , bundleIdentifier, serverBundleIdentifier, clientBundleIdentifier];
7577 NSLog (@" %@ " ,bundleIdentifierMessage);
7678 NSLog (@" -------------------------------------------------" );
7779
78- NSLog (@" ----- checking for iOS Team ID correctness ------" );
80+ NSLog (@" ----- Checking for iOS Team ID correctness ------" );
7981 NSString *serverTeamId = response.data [@" ios_team_id" ];
80- NSString *clientTeamId = [BNCSystemObserver getTeamIdentifier ] ;
82+ NSString *clientTeamId = [BNCApplication currentApplication ]. teamID ;
8183 NSString *teamID = [serverTeamId isEqualToString: clientTeamId] ? passString : errorString;
8284 NSString *teamIDMessage = [NSString stringWithFormat: @" %@ : Dashboard Link Settings page '%@ ' compared to client side '%@ '" , teamID, serverTeamId, clientTeamId];
8385 NSLog (@" %@ " ,teamIDMessage);
@@ -93,7 +95,7 @@ - (void) validateIntegrationWithServerResponse:(BNCServerResponse*)response {
9395 }
9496
9597 NSLog (@" -------------------------------------------------------------------------------------------------------------------" );
96- NSLog (@" -----To test your deeplink routing append ?validate =true to any branch link and click it on your mobile device-----" );
98+ NSLog (@" -----To test your deeplink routing append ?bnc_validate =true to any branch link and click it on your mobile device-----" );
9799 NSLog (@" -------------------------------------------------------------------------------------------------------------------" );
98100
99101 BOOL testsFailed = NO ;
@@ -170,14 +172,20 @@ - (void) validateIntegrationWithServerResponse:(BNCServerResponse*)response {
170172
171173- (void ) showNextStep {
172174 NSString *message =
173- @" \n Great! Comment out the 'validateSDKIntegration' line in your app.\n\n "
175+ @" \n Great! Remove the 'validateSDKIntegration' line in your app.\n\n "
174176 " Next check your deep link routing.\n\n "
175- " Append '?validate =true' to any of your app's Branch links and "
176- " click it on your mobile device (not the Simulator!) to start the test.\n\n "
177+ " Append '?bnc_validate =true' to any of your app's Branch links and "
178+ " click on it on your mobile device (not the Simulator!) to start the test.\n\n "
177179 " For instance, to validate a link like:\n "
178180 " https://<yourapp>.app.link/NdJ6nFzRbK\n\n "
179181 " click on:\n "
180- " https://<yourapp>.app.link/NdJ6nFzRbK?validate=true" ;
182+ " https://<yourapp>.app.link/NdJ6nFzRbK?bnc_validate=true" ;
183+ NSLog (
184+ @" \n ----------------------------------------------------------------------------"
185+ " \n Branch Integration Next Steps\n "
186+ " \n "
187+ " %@ "
188+ " \n ----------------------------------------------------------------------------" , message);
181189 [self showAlertWithTitle: @" Next Step" message: message];
182190}
183191
@@ -283,6 +291,7 @@ + (NSString *) returnNonUniversalLink:(NSString *) referringLink {
283291 referringLink = [referringLink stringByAppendingString: @" /e/" ];
284292 }
285293 }
294+ referringLink = [referringLink stringByReplacingOccurrencesOfString: @" -alternate" withString: @" " ];
286295 return referringLink;
287296}
288297
0 commit comments