-
Notifications
You must be signed in to change notification settings - Fork 218
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
Avoid WebAuth to retain UIApplication root ViewController #95
Conversation
Auth0/ControllerModalPresenter.swift
Outdated
func present(_ controller: UIViewController) { | ||
topViewController?.present(controller, animated: true, completion: nil) | ||
} | ||
|
||
var topViewController: UIViewController? { | ||
guard let root = rootViewController else { return nil } | ||
guard let root = UIApplication.shared.keyWindow?.rootViewController else { return nil } |
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'd keep the old behaviour of allowing it to pass a root controller and if its nil, default to the one from UIApplication
when there is the need to present a VC
Auth0/OAuth2Grant.swift
Outdated
@@ -144,7 +144,7 @@ private func decode(jwt: String) -> [String: Any]? { | |||
let paddingLength = requiredLength - length | |||
if paddingLength > 0 { | |||
let padding = "".padding(toLength: Int(paddingLength), withPad: "=", startingAt: 0) | |||
base64 = base64 + padding | |||
base64 += padding |
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 am not a big fan of this, I'd rather use string interpolation so its clearer
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.
Was really just to please a SwiftLint error, I'll make an exception. I was a bit surprised that this was an error
d30ed66
to
ae3476b
Compare
If initialised before
viewDidAppear
the rootView would be stored as nil and any subsequent request to present WebAuth will fail.Example