forked from LinusU/flutter_web_auth
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve webview approach and introduce Linows class
- Loading branch information
1 parent
25cfa23
commit 31e9074
Showing
12 changed files
with
95 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
# | ||
|
||
list(APPEND FLUTTER_PLUGIN_LIST | ||
desktop_webview_window | ||
url_launcher_linux | ||
window_to_front | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
# | ||
|
||
list(APPEND FLUTTER_PLUGIN_LIST | ||
desktop_webview_window | ||
url_launcher_windows | ||
window_to_front | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:flutter_web_auth_2/flutter_web_auth_2.dart'; | ||
import 'package:flutter_web_auth_2/src/server.dart'; | ||
import 'package:flutter_web_auth_2/src/webview.dart'; | ||
import 'package:flutter_web_auth_2_platform_interface/flutter_web_auth_2_platform_interface.dart'; | ||
|
||
/// Implements the plugin interface for Linux and Windows (Linows) | ||
class FlutterWebAuth2LinowsPlugin extends FlutterWebAuth2Platform { | ||
final FlutterWebAuth2Platform _webviewImpl = FlutterWebAuth2WebViewPlugin(); | ||
final FlutterWebAuth2Platform _serverImpl = FlutterWebAuth2ServerPlugin(); | ||
|
||
/// Registers the Linows super-implementation. | ||
static void registerWith() { | ||
FlutterWebAuth2Platform.instance = FlutterWebAuth2LinowsPlugin(); | ||
} | ||
|
||
@override | ||
Future<String> authenticate({ | ||
required String url, | ||
required String callbackUrlScheme, | ||
required Map<String, dynamic> options, | ||
}) async { | ||
final parsedOptions = FlutterWebAuth2Options.fromJson(options); | ||
if (parsedOptions.useWebview) { | ||
return _webviewImpl.authenticate( | ||
url: url, | ||
callbackUrlScheme: callbackUrlScheme, | ||
options: options, | ||
); | ||
} | ||
return _serverImpl.authenticate( | ||
url: url, | ||
callbackUrlScheme: callbackUrlScheme, | ||
options: options, | ||
); | ||
} | ||
|
||
@override | ||
Future clearAllDanglingCalls() async { | ||
await _serverImpl.clearAllDanglingCalls(); | ||
await _webviewImpl.clearAllDanglingCalls(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters