From e81c97ee3723ee1ac95e65b6fba0de9fc6b3a5ef Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 7 Mar 2023 06:07:00 +0000 Subject: [PATCH] fix oauth2 back navigation --- CHANGELOG.md | 5 +++++ README.md | 2 +- example/pubspec.yaml | 2 +- lib/src/client_browser.dart | 2 +- lib/src/client_io.dart | 3 ++- lib/src/input_file.dart | 35 +++++++++++++++++++++++++++++++++-- pubspec.yaml | 14 +++++++------- 7 files changed, 50 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c449c72..b633733 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 8.3.0 + +* Fix: back navigation bringing back web browser after OAuth session creation +* Update: Deprecated `InputFile` default constructor and introduced `InputFile.fromPath` and `InputFile.fromBytes` for consistency with other SDKs + ## 8.2.2 * Fix: notify callback when websocket closes [#604](https://github.com/appwrite/sdk-generator/pull/604) diff --git a/README.md b/README.md index c039e1b..d8f3629 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Add this to your package's `pubspec.yaml` file: ```yml dependencies: - appwrite: ^8.2.2 + appwrite: ^8.3.0 ``` You can install packages from the command line: diff --git a/example/pubspec.yaml b/example/pubspec.yaml index c3fc4bc..fc72308 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,3 +1,3 @@ name: appwrite_example environment: - sdk: '>=2.6.0 <3.0.0' \ No newline at end of file + sdk: '>=2.17.0 <3.0.0' \ No newline at end of file diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index b26cefd..709c9b7 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -43,7 +43,7 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-name': 'Flutter', 'x-sdk-platform': 'client', 'x-sdk-language': 'flutter', - 'x-sdk-version': '8.2.2', + 'x-sdk-version': '8.3.0', 'X-Appwrite-Response-Format' : '1.0.0', }; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index 9fc6744..7c45b2a 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -64,7 +64,7 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-name': 'Flutter', 'x-sdk-platform': 'client', 'x-sdk-language': 'flutter', - 'x-sdk-version': '8.2.2', + 'x-sdk-version': '8.3.0', 'X-Appwrite-Response-Format' : '1.0.0', }; @@ -317,6 +317,7 @@ class ClientIO extends ClientBase with ClientMixin { return FlutterWebAuth2.authenticate( url: url.toString(), callbackUrlScheme: callbackUrlScheme != null && Platform.isWindows ? callbackUrlScheme : "appwrite-callback-" + config['project']!, + preferEphemeral: true, ).then((value) async { Uri url = Uri.parse(value); final key = url.queryParameters['key']; diff --git a/lib/src/input_file.dart b/lib/src/input_file.dart index 5a32192..13c6e75 100644 --- a/lib/src/input_file.dart +++ b/lib/src/input_file.dart @@ -6,11 +6,42 @@ class InputFile { final String? filename; final String? contentType; - /// Provide a file, use `path` for IO platforms - /// and provide `bytes` for web platform + @Deprecated('Use `InputFile.fromPath` or `InputFile.fromBytes` instead.') InputFile({this.path, this.filename, this.contentType, this.bytes}) { if (path == null && bytes == null) { throw AppwriteException('One of `path` or `bytes` is required'); } } + + InputFile._({this.path, this.filename, this.contentType, this.bytes}) { + if (path == null && bytes == null) { + throw AppwriteException('One of `path` or `bytes` is required'); + } + } + + /// Provide a file using `path` + factory InputFile.fromPath({ + required String path, + String? filename, + String? contentType, + }) { + return InputFile._( + path: path, + filename: filename, + contentType: contentType, + ); + } + + /// Provide a file using `bytes` + factory InputFile.fromBytes({ + required List bytes, + required String filename, + String? contentType, + }) { + return InputFile._( + bytes: bytes, + filename: filename, + contentType: contentType, + ); + } } diff --git a/pubspec.yaml b/pubspec.yaml index 33ed470..98a6702 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: appwrite -version: 8.2.2 +version: 8.3.0 description: Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API homepage: https://appwrite.io repository: https://github.com/appwrite/sdk-for-flutter @@ -12,13 +12,13 @@ dependencies: flutter: sdk: flutter cookie_jar: ^3.0.1 - device_info_plus: ^8.0.0 - flutter_web_auth_2: ^2.0.2 + device_info_plus: ^8.1.0 + flutter_web_auth_2: ^2.0.4 http: ^0.13.5 - package_info_plus: ^3.0.2 - path_provider: ^2.0.12 - web_socket_channel: ^2.2.0 - universal_html: ^2.0.8 + package_info_plus: ^3.0.3 + path_provider: ^2.0.13 + web_socket_channel: ^2.3.0 + universal_html: ^2.0.9 dev_dependencies: path_provider_platform_interface: ^2.0.5