Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS Integration Validator 2.0 #1439

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

sharath-branch
Copy link
Contributor

Reference

No related JIRA ticket, part of the initiative to improve the Branch SDK implementation QA process.

Summary

Enhanced the iOS Integration Validator with multiple quality of life changes to improve developer experience, aid our support team to debug faster and improve the overall integration testing process.

Motivation

The current iOS integration validator is a good first step for any developer to test their Branch iOS SDK integration. However, it is missing a few key details that can make it easy for the developer to validate their integration. Additionally, there are three key pain points that are solved as quality of life enhancements:

  1. When tests fail, we now have steps to help them fix the issues with corresponding references
  2. The developer can export logs right from the validator to share data with the PS or Support team.
  3. The Integration Validator can now be accessed on-the-fly using a query parameter on any Branch link, eliminating the need for a separate build that initiates just the validator. This eases the testing process for QA teams, PS and even our Support team as they can now run a preliminary check by simply accessing the App Store app!

Type Of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Testing Instructions

There are a total of 8 new changes that can be observed through this PR.

  1. There's an exciting new way to trigger the validator. Add validate_integration=true as a query parameter to any Branch link and click on it to trigger the Integration Validator. This complements the old method beautifully to give developers two great ways to trigger the validator.
  2. The Branch SDK version is now shown on the validator.
  3. The alert shows whether the Branch live or test key is being used.
  4. Default Link Domain is validated with info.plist
  5. Alternate Link Domain is validated with info.plist
  6. IDFA accessibility is determined
  7. When tests fail, the alert now gives an option for the developer to understand what changes need to be made along with references to the documentation website.
  8. Logs can now be exported as a text file and shared using the native share sheet

IMG_0008 2
IMG_0009 2
Screenshot 2024-10-15 at 4 55 05 PM
https://github.com/user-attachments/assets/a14334cd-7764-42a8-bbf0-b4e7b12773ca

cc @BranchMetrics/saas-sdk-devs for visibility.

@sharath-branch sharath-branch marked this pull request as ready for review October 22, 2024 10:53
@ahmednawar
Copy link
Contributor

@NidhiDixit09 @nsingh-branch can you please review? this has been sitting idle for a while

@nsingh-branch
Copy link
Contributor

@NidhiDixit09 @nsingh-branch can you please review? this has been sitting idle for a while

We had a meeting with Rob yesterday and I believe he's going to be combining the new deep linking validator into this PR as well.

@rob-gioia-branch Is that correct?

@rob-gioia-branch
Copy link
Contributor

@NidhiDixit09 @nsingh-branch can you please review? this has been sitting idle for a while

We had a meeting with Rob yesterday and I believe he's going to be combining the new deep linking validator into this PR as well.

@rob-gioia-branch Is that correct?

@nsingh-branch yes that is correct, going to merge the two branches together so that the code is in one PR, and the tests in one validator popup. Will do that soon so that folks can review!

Thank you for the bump @ahmednawar ! :)

NSArray *linkDomains = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"branch_universal_link_domains"];

for (NSString *domain in linkDomains) {
if ([domain isEqualToString:serverLinkDomain]) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sharath-branch linkdomains strings can have prefix applinks: also. ( Suggested format is our docs is - applinks:subdomain.app.link https://help.branch.io/developers-hub/docs/ios-basic-integration#3-configure-associated-domains ) . So this check will fail if user adds applinks: to domain in info.plist

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is checking only the info.plist actually and not the associated domains. We recommend adding the prefix applinks: only to associated domains. The recommendation is to add the domains directly to the info.plist without any prefix (https://help.branch.io/developers-hub/docs/ios-basic-integration#4-configure-infoplist).

@@ -165,6 +165,17 @@ + (BOOL)compareUriSchemes : (NSString *) serverUriScheme {
return false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sharath-branch At line no. 162, if code returns from here, it will not check second and more urlType in array urlTypes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks!

case BranchLinkDomainError:
return @"Check the link domain and alternate domain values in your info.plist file under the key 'branch_universal_link_domains'. The values should match with the ones on the Branch dashboard.\n\n";
case BranchURISchemeError:
return @"The URI scheme in your info.plist file shoudl match with the URI scheme value for iOS on the Branch dashboard.\n\n";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo - shoudl should be should :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed :)

NSString *uriScheme = [BNCSystemObserver compareUriSchemes:serverUriScheme] ? passString : errorString;
bool doUriSchemesMatch = [BNCSystemObserver compareUriSchemes:serverUriScheme];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor optimization -

bool doUriSchemesMatch = [BNCSystemObserver compareUriSchemes:serverUriScheme];

NSString *uriScheme = doUriSchemesMatch ? passString : errorString;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


@interface BranchFileLogger ()

@property (nonatomic, strong) NSString *logFilePath;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property is not used anywhere. If its not required, it can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's actually a private property that's used in the functions within the class. Have fixed some functions to reference this property which was previously missing.

@@ -2107,6 +2107,8 @@ - (void)handleInitSuccessAndCallCallback:(BOOL)callCallback sceneIdentifier:(NSS
id<NSObject> sharedApplication = [applicationClass performSelector:@selector(sharedApplication)];
if ([sharedApplication respondsToSelector:@selector(openURL:)])
[sharedApplication performSelector:@selector(openURL:) withObject:comp.URL];
} else if ([latestReferringParams[@"validate_integration"] isEqualToString:@"true"]) {
[self validateSDKIntegration];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will happen if deep linking fails ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If deep linking fails completely, this will never trigger which is an outcome we are fine with. But there are multiple entry points to this function - let's say universal link launch fails, it will launch via URI scheme. If both of these fail, developer can try with the alternate link domain. The idea is that if this fails to load completely, we still have some understanding that the core issue is with the universal links setup itself.

As of today, debugging an issue is a blind spot for CX teams because the error could be anywhere. This function helps in breaking down the issue into (a). either the issue is fundamentally with the links setup (if the validator doesn't launch at all) or (b). the issue is one of the issues highlighted by the validator.

//
// Created by Sharath Sriram on 15/10/24.
//

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file supposed to be public ? Its mainly used by "Branch+Validator.h" which is inside private folder.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants