-
Notifications
You must be signed in to change notification settings - Fork 295
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
App installed check #1233
App installed check #1233
Conversation
@@ -83,7 +87,12 @@ import BraintreeDataCollector | |||
_ request: BTPayPalVaultRequest, | |||
completion: @escaping (BTPayPalAccountNonce?, Error?) -> Void | |||
) { | |||
tokenize(request: request, completion: completion) | |||
// Check if PayPal app is installed | |||
if request.enablePayPalAppSwitch == true { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want to diverge in the flow just yet. We still need to get the response back from this API call which will either contain the Venice URL, or it won't. Based on if the URL present, we will or won't proceed with app switch flow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where we instead want to do the appInstalled
check. If that check fails, we don't want to bother encoding these additional parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I've updated the PR with the changes
…o app-installed-check # Conflicts: # CHANGELOG.md
.github/workflows/build.yml
Outdated
@@ -5,22 +5,22 @@ concurrency: | |||
cancel-in-progress: true | |||
jobs: | |||
cocoapods: | |||
name: CocoaPods (Xcode 14.3) | |||
name: CocoaPods (Xcode 15.1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the base branch needs to be updated for this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's strange... I'll update the app-installed-check
branch with the main and see if that helps
…ree/braintree_ios into app-installed-check # Conflicts: # CHANGELOG.md # Sources/BraintreePayPal/BTPayPalClient.swift
@@ -728,6 +728,27 @@ class BTPayPalClient_Tests: XCTestCase { | |||
} | |||
|
|||
|
|||
func testIsiOSAppSwitchAvailable_whenApplicationCanOpenPayPalInAppURL_returnsTrue() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of asserting that the function isPayPalAppInstalled
returns some boolean, we rather want our unit tests to assert on the component's public API (in this case BTPayPalClient
). Implementation details (such as if the app installed check lives in a method or not) should be able to change without breaking our unit tests.
So this test should assert on the end result behavior, which is that the API POST request to /v1/paypal_hermes/create_payment_resource
does include the app switch params if the app is installed, and does not include the app switch params if the app is not installed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback! I've made changes to test the endpoints
…ree/braintree_ios into app-installed-check
…o app-installed-check
…o paypal-app-switch-feature
…aintree_ios into app-installed-check # Conflicts: # UnitTests/BraintreePayPalTests/BTPayPalClient_Tests.swift
# Conflicts: # Sources/BraintreePayPal/BTPayPalClient.swift
…aintree_ios into app-installed-check # Conflicts: # Sources/BraintreePayPal/BTPayPalClient.swift
self.payPalAppInstalled = self.isPayPalAppInstalled() | ||
|
||
if !self.payPalAppInstalled { | ||
(request as? BTPayPalVaultRequest)?.enablePayPalAppSwitch = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Summary of changes
We want to check if the PayPal app is installed. This branch will be merged into
paypal-app-switch-feature
. This PR doesn't cover the actual app switching to the PayPal app. To test, change the url scheme tomaps://
Checklist
Authors