Skip to content

Commit a7a2642

Browse files
committed
update twitter link
1 parent a488690 commit a7a2642

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+637
-116
lines changed

CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 2.0.3
1+
## 2.0.3
22
- Support for Appwrite 0.11
33
- Fix comments on `sum` attributes
44

@@ -120,7 +120,7 @@
120120

121121
## 0.2.2
122122

123-
- Fixed an error that happend when the OAuth session creation request was sent before any other API call
123+
- Fixed an error that happened when the OAuth session creation request was sent before any other API call
124124
- Fixed a bug in the Avatars service where location URL generation had syntax error
125125

126126
## 0.2.1
@@ -130,7 +130,7 @@
130130
## 0.2.0
131131

132132
- Updated flutter_web_auth plugin to version 0.2.4
133-
- Added per project unique callback for OAuth2 redirects to aviod conflicts between multiple Appwrite projects
133+
- Added per project unique callback for OAuth2 redirects to avoid conflicts between multiple Appwrite projects
134134

135135
## 0.1.1
136136

@@ -159,7 +159,7 @@
159159

160160
## 0.0.9
161161

162-
- Updated deafult params
162+
- Updated default params
163163

164164
## 0.0.8
165165

README.md

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
![License](https://img.shields.io/github/license/appwrite/sdk-for-flutter.svg?style=flat-square)
55
![Version](https://img.shields.io/badge/api%20version-0.11.0-blue.svg?style=flat-square)
66
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
7-
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite_io?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite_io)
7+
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
88
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
99

1010
**This SDK is compatible with Appwrite server version 0.11.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-flutter/releases).**
@@ -79,6 +79,23 @@ For **Mac OS** add your app name and Bundle ID, You can find your Bundle Identif
7979
### Web
8080
Appwrite 0.7, and the Appwrite Flutter SDK 0.3.0 have added support for Flutter Web. To build web apps that integrate with Appwrite successfully, all you have to do is add a web platform on your Appwrite project's dashboard and list the domain your website will use to allow communication to the Appwrite API.
8181

82+
For web in order to capture the OAuth2 callback URL and send it to the application using JavaScript `postMessage()`, you need to create an html file inside `./web` folder of your Flutter project. For example `auth.html` with the following content.
83+
84+
```html
85+
<!DOCTYPE html>
86+
<title>Authentication complete</title>
87+
<p>Authentication is complete. If this does not happen automatically, please
88+
close the window.
89+
<script>
90+
window.opener.postMessage({
91+
flutter-web-auth: window.location.href
92+
}, window.location.origin);
93+
window.close();
94+
</script>
95+
```
96+
97+
Redirection URL passed to the authentication service must be the same as the URL on which the application is running (schema, host, port if necessary) and the path must point to created HTML file, /auth.html in this case. The callbackUrlScheme parameter of the authenticate() method does not take into account, so it is possible to use a schema for native platforms in the code.
98+
8299
#### Flutter Web Cross-Domain Communication & Cookies
83100
While running Flutter Web, make sure your Appwrite server and your Flutter client are using the same top-level domain and the same protocol (HTTP or HTTPS) to communicate. When trying to communicate between different domains or protocols, you may receive HTTP status error 401 because some modern browsers block cross-site or insecure cookies for enhanced privacy. In production, Appwrite allows you set multiple [custom-domains](https://appwrite.io/docs/custom-domains) for each project.
84101

@@ -91,14 +108,16 @@ For **Windows** add your app <u>name</u> and <u>package name</u>, Your package n
91108

92109
```dart
93110
import 'package:appwrite/appwrite.dart';
94-
Client client = Client();
95111
112+
void main() {
113+
Client client = Client();
96114
97-
client
98-
.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint
99-
.setProject('5e8cf4f46b5e8') // Your project ID
100-
.setSelfSigned() // Use only on dev mode with a self-signed SSL cert
101-
;
115+
client
116+
.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint
117+
.setProject('5e8cf4f46b5e8') // Your project ID
118+
.setSelfSigned() // Use only on dev mode with a self-signed SSL cert
119+
;
120+
}
102121
```
103122

104123
Before starting to send any API calls to your new Appwrite instance, make sure your Android or iOS emulators has network access to the Appwrite server hostname or IP address.
@@ -124,25 +143,28 @@ Response user = await account
124143

125144
```dart
126145
import 'package:appwrite/appwrite.dart';
127-
Client client = Client();
128146
147+
void main() {
148+
Client client = Client();
129149
130-
client
131-
.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint
132-
.setProject('5e8cf4f46b5e8') // Your project ID
133-
.setSelfSigned() // Use only on dev mode with a self-signed SSL cert
134-
;
135150
151+
client
152+
.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint
153+
.setProject('5e8cf4f46b5e8') // Your project ID
154+
.setSelfSigned() // Use only on dev mode with a self-signed SSL cert
155+
;
136156
137-
// Register User
138-
Account account = Account(client);
139157
140-
Response user = await account
141-
.create(
142-
email: 'me@appwrite.io',
143-
password: 'password',
144-
name: 'My Name'
145-
);
158+
// Register User
159+
Account account = Account(client);
160+
161+
Response user = await account
162+
.create(
163+
email: 'me@appwrite.io',
164+
password: 'password',
165+
name: 'My Name'
166+
);
167+
}
146168
```
147169

148170
### Error Handling
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"configVersion": 2,
3+
"packages": [
4+
{
5+
"name": "appwrite_example",
6+
"rootUri": "../",
7+
"packageUri": "lib/",
8+
"languageVersion": "2.6"
9+
}
10+
],
11+
"generated": "2021-12-17T06:39:50.946207Z",
12+
"generator": "pub",
13+
"generatorVersion": "2.15.0"
14+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
appwrite_example
2+
2.6
3+
file:///home/dlohani/Documents/projects/appwrite/appwrite_src/app/sdks/client-flutter/example/
4+
file:///home/dlohani/Documents/projects/appwrite/appwrite_src/app/sdks/client-flutter/example/lib/
5+
2

example/.dart_tool/version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.8.0

example/.packages

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file is deprecated. Tools should instead consume
2+
# `.dart_tool/package_config.json`.
3+
#
4+
# For more info see: https://dart.dev/go/dot-packages-deprecation
5+
#
6+
# Generated by pub on 2021-12-17 12:24:50.942674.
7+
appwrite_example:lib/

example/pubspec.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Generated by pub
2+
# See https://dart.dev/tools/pub/glossary#lockfile
3+
packages: {}
4+
sdks:
5+
dart: ">=2.6.0 <3.0.0"

lib/models.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
library appwrite.models;
22

3+
part 'src/models/model.dart';
34
part 'src/models/document_list.dart';
45
part 'src/models/session_list.dart';
56
part 'src/models/log_list.dart';

lib/services/account.dart

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -451,19 +451,14 @@ class Account extends Service {
451451
});
452452

453453
Uri endpoint = Uri.parse(client.endPoint);
454-
Uri url = new Uri(scheme: endpoint.scheme,
454+
Uri url = Uri(scheme: endpoint.scheme,
455455
host: endpoint.host,
456456
port: endpoint.port,
457457
path: endpoint.path + path,
458458
query: query.join('&')
459459
);
460460

461-
if(kIsWeb) {
462-
redirect(url.toString());
463-
return Future.value();
464-
}else{
465-
return client.webAuth(url);
466-
}
461+
return client.webAuth(url);
467462

468463
}
469464

lib/src/client_base.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,27 @@ import 'enums.dart';
44

55
abstract class ClientBase implements Client {
66
/// Your project ID
7+
@override
78
ClientBase setProject(value);
89
/// Your secret JSON Web Token
10+
@override
911
ClientBase setJWT(value);
12+
@override
1013
ClientBase setLocale(value);
1114

15+
@override
1216
ClientBase setSelfSigned({bool status = true});
1317

18+
@override
1419
ClientBase setEndpoint(String endPoint);
1520

21+
@override
1622
Client setEndPointRealtime(String endPoint);
1723

24+
@override
1825
ClientBase addHeader(String key, String value);
1926

27+
@override
2028
Future<Response> call(
2129
HttpMethod method, {
2230
String path = '',

0 commit comments

Comments
 (0)