-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Present SFSafariViewController only for http and https schemes #655
Conversation
@@ -132,12 +132,6 @@ internal final class CheckoutViewController: DeprecatedWebViewController { | |||
self.present(vc, animated: true, completion: nil) | |||
} | |||
|
|||
fileprivate func goToSafariBrowser(url: URL) { |
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.
There were 6 duplicated functions thorough our codebase...it should now be much DRYer
Library/UIViewController+URL.swift
Outdated
public extension UIViewController { | ||
static var supportedURLSchemes = ["http", "https"] | ||
|
||
func goTo(url: URL, application: UIApplicationType = UIApplication.shared) { |
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.
I think this dependency injection is totally fine - just wondering if we want to deviate from using Environment
at this point in time?
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.
Can you elaborate a bit? Not sure where you going with Environment
? This injection is mostly for testing purposes
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.
Oh, yes I mean we currently do all dependency injection through AppEnvironment
/Environment
, so this kind of injection (passing into a function) is fine, it's just that the rest of our injection hasn't been done that way. I'm more opening this up for discussion than anything else, I am not particularly opinionated about it.
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.
Oh right...I'll see what I can do and try to inject this through AppEnvironment
instead
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.
lgtm!
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! Thanks for fixing this 🙏
📲 What
Fixes an issue that we've been seeing recently that caused
SFSafariViewController
to crash when passed a URL that doesn't havehttp
orhttps
scheme (i.e. FB live stream). The fallback solution should now be testing whether the url can be opened and opening it in that case.🤔 Why
This crash has recently escalated quite a bit during an update of Throw Throw burrito.
🛠 How
As much as this is simple
if
/else
condition...in order to test this we have to conform to a new protocolUIApplicationType
and use a mock object.✅ Acceptance criteria
Update
page and tap on any linkUpdate
page and tap on link to a live stream