Skip to content

Commit

Permalink
Hopefully fix iOS implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
ThexXTURBOXx committed Sep 30, 2023
1 parent 004f041 commit 8a0ec5b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions flutter_web_auth_2/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 3.0.0-alpha.5

- 🌹 Fix iOS "screenshot"
- 🐛 Trying a few attempts to fix iOS and MacOS implementations

## 3.0.0-alpha.4

- 🐛 Trying a few attempts to fix iOS and MacOS implementations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ public class SwiftFlutterWebAuth2Plugin: NSObject, FlutterPlugin {
registrar.addApplicationDelegate(instance)
}

var completionHandler: ((URL?, Error?) -> Void)?

public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
if call.method == "authenticate",
let arguments = call.arguments as? [String: AnyObject],
let urlString = arguments["url"] as? String,
let url = URL(string: urlString),
let callbackURLScheme = arguments["callbackUrlScheme"] as? String,
let options = arguments["options"] as? Dictionary<String, AnyObject>
let options = arguments["options"] as? [String: AnyObject]
{
var sessionToKeepAlive: Any? // if we do not keep the session alive, it will get closed immediately while showing the dialog
let completionHandler = { (url: URL?, err: Error?) in
completionHandler = { (url: URL?, err: Error?) in
self.completionHandler = nil

if (sessionToKeepAlive != nil) {
if #available(iOS 12, *) {
Expand Down Expand Up @@ -92,7 +95,7 @@ public class SwiftFlutterWebAuth2Plugin: NSObject, FlutterPlugin {
return
}
session.presentationContextProvider = contextProvider
session.prefersEphemeralWebBrowserSession = options["preferEphemeral"]
session.prefersEphemeralWebBrowserSession = options["preferEphemeral"]!
}

session.start()
Expand Down
2 changes: 1 addition & 1 deletion flutter_web_auth_2/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_web_auth_2
description: Flutter plugin for authenticating a user with a web service.
version: 3.0.0-alpha.4
version: 3.0.0-alpha.5
homepage: https://github.com/ThexXTURBOXx/flutter_web_auth_2
repository: https://github.com/ThexXTURBOXx/flutter_web_auth_2
issue_tracker: https://github.com/ThexXTURBOXx/flutter_web_auth_2/issues
Expand Down

0 comments on commit 8a0ec5b

Please sign in to comment.