Skip to content

Commit 26b07d9

Browse files
authored
Merge pull request #253 from appwrite/dev
chore: (breaking) update flutter_web_auth_2 docs to match 4.x
2 parents c1cbb36 + be26232 commit 26b07d9

File tree

5 files changed

+36
-13
lines changed

5 files changed

+36
-13
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Change Log
22

3-
## 16.0.1
3+
## 17.0.0
4+
5+
* Update `flutter_web_auth_2` dependency to version 4.1.0
6+
* Update `auth.html` example in README.md to align with `flutter_web_auth_2` documentation
7+
* Breaking changes:
8+
* Minimum iOS version supported is now 17.4 due to the updated requirements of `flutter_web_auth_2` version 4.1.0
9+
10+
## 16.1.0
411

512
* Add `setDevKey` method to Client service
613
* Add `upsertDocument` method to Databases service

README.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Add this to your package's `pubspec.yaml` file:
2121

2222
```yml
2323
dependencies:
24-
appwrite: ^16.1.0
24+
appwrite: ^17.0.0
2525
```
2626
2727
You can install packages from the command line:
@@ -89,13 +89,25 @@ For web in order to capture the OAuth2 callback URL and send it to the applicati
8989
```html
9090
<!DOCTYPE html>
9191
<title>Authentication complete</title>
92-
<p>Authentication is complete. If this does not happen automatically, please
93-
close the window.
92+
<p>Authentication is complete. If this does not happen automatically, please close the window.</p>
9493
<script>
95-
window.opener.postMessage({
96-
'flutter-web-auth-2': window.location.href
97-
}, window.location.origin);
98-
window.close();
94+
function postAuthenticationMessage() {
95+
const message = {
96+
'flutter-web-auth-2': window.location.href
97+
};
98+
99+
if (window.opener) {
100+
window.opener.postMessage(message, window.location.origin);
101+
window.close();
102+
} else if (window.parent && window.parent !== window) {
103+
window.parent.postMessage(message, window.location.origin);
104+
} else {
105+
localStorage.setItem('flutter-web-auth-2', window.location.href);
106+
window.close();
107+
}
108+
}
109+
110+
postAuthenticationMessage();
99111
</script>
100112
```
101113

lib/src/client_browser.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class ClientBrowser extends ClientBase with ClientMixin {
4040
'x-sdk-name': 'Flutter',
4141
'x-sdk-platform': 'client',
4242
'x-sdk-language': 'flutter',
43-
'x-sdk-version': '16.1.0',
43+
'x-sdk-version': '17.0.0',
4444
'X-Appwrite-Response-Format': '1.7.0',
4545
};
4646

@@ -260,6 +260,7 @@ class ClientBrowser extends ClientBase with ClientMixin {
260260
return FlutterWebAuth2.authenticate(
261261
url: url.toString(),
262262
callbackUrlScheme: "appwrite-callback-" + config['project']!,
263+
options: const FlutterWebAuth2Options(useWebview: false),
263264
);
264265
}
265266
}

lib/src/client_io.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ClientIO extends ClientBase with ClientMixin {
5858
'x-sdk-name': 'Flutter',
5959
'x-sdk-platform': 'client',
6060
'x-sdk-language': 'flutter',
61-
'x-sdk-version': '16.1.0',
61+
'x-sdk-version': '17.0.0',
6262
'X-Appwrite-Response-Format': '1.7.0',
6363
};
6464

@@ -359,7 +359,10 @@ class ClientIO extends ClientBase with ClientMixin {
359359
callbackUrlScheme: callbackUrlScheme != null && _customSchemeAllowed
360360
? callbackUrlScheme
361361
: "appwrite-callback-" + config['project']!,
362-
options: const FlutterWebAuth2Options(intentFlags: ephemeralIntentFlags),
362+
options: const FlutterWebAuth2Options(
363+
intentFlags: ephemeralIntentFlags,
364+
useWebview: false,
365+
),
363366
).then((value) async {
364367
Uri url = Uri.parse(value);
365368
final key = url.queryParameters['key'];

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: appwrite
2-
version: 16.1.0
2+
version: 17.0.0
33
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
44
homepage: https://appwrite.io
55
repository: https://github.com/appwrite/sdk-for-flutter
@@ -20,7 +20,7 @@ dependencies:
2020
sdk: flutter
2121
cookie_jar: ^4.0.8
2222
device_info_plus: ^10.1.2
23-
flutter_web_auth_2: ^3.1.2
23+
flutter_web_auth_2: ^4.1.0
2424
http: '>=0.13.6 <2.0.0'
2525
package_info_plus: ^8.0.2
2626
path_provider: ^2.1.4

0 commit comments

Comments
 (0)