-
Notifications
You must be signed in to change notification settings - Fork 46
Added webAuth cancel for ios to prevent active transaction errors #573
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Foundation | ||
import Auth0 | ||
|
||
#if os(iOS) | ||
import Flutter | ||
#else | ||
import FlutterMacOS | ||
#endif | ||
|
||
|
||
struct WebAuthCancelMethodHandler: MethodHandler { | ||
|
||
func handle(with arguments: [String: Any], callback: @escaping FlutterResult) { | ||
WebAuthentication.cancel() | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,13 @@ public class WebAuthHandler: NSObject, FlutterPlugin { | |
} | ||
|
||
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { | ||
|
||
if call.method == "webAuth#cancel" { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggest to have the call method name as part of string constants There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding this as part of the existing Method enum was failing the UTs as all the corresponding handlers expect arguments. Fixing that would require adding some explicit conditions in UTs and code which weren't looking good |
||
let methodHandler = WebAuthCancelMethodHandler() | ||
methodHandler.handle(with: [:], callback: result) | ||
return | ||
} | ||
|
||
guard let arguments = call.arguments as? [String: Any] else { | ||
return result(FlutterError(from: .argumentsMissing)) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../darwin/Classes/WebAuth/WebAuthCancelMethodHandler.swift |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../darwin/Classes/WebAuth/WebAuthCancelMethodHandler.swift | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need these changes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean the WebAuthCancelMethodHandler class ? |
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.
Please check the formatting of the code snippet. A code snippet that is not properly formatted hinders readability.
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.
done
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.
The
if
braces are at the same level as those from thecatch
, and the if block itself is not indented, whereas the contents of thetry
block are.