Updated Flutter SDK
This commit is contained in:
parent
4a6b860e7e
commit
ee9c5c92a7
|
@ -30,7 +30,7 @@ return [
|
|||
[
|
||||
'key' => 'flutter',
|
||||
'name' => 'Flutter',
|
||||
'version' => '0.2.3',
|
||||
'version' => '0.3.0-dev.1',
|
||||
'url' => 'https://github.com/appwrite/sdk-for-flutter',
|
||||
'enabled' => true,
|
||||
'beta' => true,
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
## 0.3.0-dev.1
|
||||
|
||||
- Updated package dependencies (@lohanidamodar)
|
||||
- Added Flutter for Web compatibility (@lohanidamodar)
|
||||
|
||||
## 0.2.3
|
||||
|
||||
- Fixed OAuth2 cookie bug, where a new session cookie couldn't overwrite an old cookie
|
||||
|
|
|
@ -20,7 +20,7 @@ Add this to your package's `pubspec.yaml` file:
|
|||
|
||||
```yml
|
||||
dependencies:
|
||||
appwrite: ^0.2.3
|
||||
appwrite: ^0.3.0-dev.1
|
||||
```
|
||||
|
||||
You can install packages from the command line:
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:dio/adapter.dart';
|
||||
import 'package:dio_cookie_manager/dio_cookie_manager.dart';
|
||||
import 'package:cookie_jar/cookie_jar.dart';
|
||||
|
@ -20,17 +21,21 @@ class Client {
|
|||
PersistCookieJar cookieJar;
|
||||
|
||||
Client({this.endPoint = 'https://appwrite.io/v1', this.selfSigned = false, Dio http}) : this.http = http ?? Dio() {
|
||||
|
||||
type = (Platform.isIOS) ? 'ios' : type;
|
||||
type = (Platform.isMacOS) ? 'macos' : type;
|
||||
type = (Platform.isAndroid) ? 'android' : type;
|
||||
type = (Platform.isLinux) ? 'linux' : type;
|
||||
type = (Platform.isWindows) ? 'windows' : type;
|
||||
type = (Platform.isFuchsia) ? 'fuchsia' : type;
|
||||
// Platform is not supported in web so if web, set type to web automatically and skip Platform check
|
||||
if(kIsWeb) {
|
||||
type = 'web';
|
||||
}else{
|
||||
type = (Platform.isIOS) ? 'ios' : type;
|
||||
type = (Platform.isMacOS) ? 'macos' : type;
|
||||
type = (Platform.isAndroid) ? 'android' : type;
|
||||
type = (Platform.isLinux) ? 'linux' : type;
|
||||
type = (Platform.isWindows) ? 'windows' : type;
|
||||
type = (Platform.isFuchsia) ? 'fuchsia' : type;
|
||||
}
|
||||
|
||||
this.headers = {
|
||||
'content-type': 'application/json',
|
||||
'x-sdk-version': 'appwrite:dart:0.2.3',
|
||||
'x-sdk-version': 'appwrite:flutter:0.3.0-dev.1',
|
||||
};
|
||||
|
||||
this.config = {};
|
||||
|
@ -78,17 +83,20 @@ class Client {
|
|||
|
||||
Future init() async {
|
||||
if(!initialized) {
|
||||
final Directory cookieDir = await _getCookiePath();
|
||||
|
||||
cookieJar = new PersistCookieJar(dir:cookieDir.path);
|
||||
// if web skip cookie implementation and origin header as those are automatically handled by browsers
|
||||
if(!kIsWeb) {
|
||||
final Directory cookieDir = await _getCookiePath();
|
||||
cookieJar = new PersistCookieJar(dir:cookieDir.path);
|
||||
this.http.interceptors.add(CookieManager(cookieJar));
|
||||
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
||||
addHeader('Origin', 'appwrite-' + type + '://' + packageInfo.packageName);
|
||||
}else{
|
||||
// if web set httpClientAdapter as BrowserHttpClientAdapter with withCredentials true to make cookies work
|
||||
this.http.options.extra['withCredentials'] = true;
|
||||
}
|
||||
|
||||
this.http.options.baseUrl = this.endPoint;
|
||||
this.http.options.validateStatus = (status) => status < 400;
|
||||
this.http.interceptors.add(CookieManager(cookieJar));
|
||||
|
||||
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
||||
|
||||
addHeader('Origin', 'appwrite-' + type + '://' + packageInfo.packageName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,6 +122,10 @@ class Client {
|
|||
}
|
||||
|
||||
if (method == HttpMethod.get) {
|
||||
params.keys.forEach((key) {if (params[key] is int || params[key] is double) {
|
||||
params[key] = params[key].toString();
|
||||
}});
|
||||
|
||||
return http.get(path, queryParameters: params, options: options);
|
||||
} else {
|
||||
return http.request(path, data: params, options: options);
|
||||
|
|
|
@ -27,6 +27,10 @@ class Avatars extends Service {
|
|||
'project': client.config['project'],
|
||||
};
|
||||
|
||||
params.keys.forEach((key) {if (params[key] is int || params[key] is double) {
|
||||
params[key] = params[key].toString();
|
||||
}});
|
||||
|
||||
Uri endpoint = Uri.parse(client.endPoint);
|
||||
Uri location = new Uri(scheme: endpoint.scheme,
|
||||
host: endpoint.host,
|
||||
|
@ -55,6 +59,10 @@ class Avatars extends Service {
|
|||
'project': client.config['project'],
|
||||
};
|
||||
|
||||
params.keys.forEach((key) {if (params[key] is int || params[key] is double) {
|
||||
params[key] = params[key].toString();
|
||||
}});
|
||||
|
||||
Uri endpoint = Uri.parse(client.endPoint);
|
||||
Uri location = new Uri(scheme: endpoint.scheme,
|
||||
host: endpoint.host,
|
||||
|
@ -79,6 +87,10 @@ class Avatars extends Service {
|
|||
'project': client.config['project'],
|
||||
};
|
||||
|
||||
params.keys.forEach((key) {if (params[key] is int || params[key] is double) {
|
||||
params[key] = params[key].toString();
|
||||
}});
|
||||
|
||||
Uri endpoint = Uri.parse(client.endPoint);
|
||||
Uri location = new Uri(scheme: endpoint.scheme,
|
||||
host: endpoint.host,
|
||||
|
@ -106,6 +118,10 @@ class Avatars extends Service {
|
|||
'project': client.config['project'],
|
||||
};
|
||||
|
||||
params.keys.forEach((key) {if (params[key] is int || params[key] is double) {
|
||||
params[key] = params[key].toString();
|
||||
}});
|
||||
|
||||
Uri endpoint = Uri.parse(client.endPoint);
|
||||
Uri location = new Uri(scheme: endpoint.scheme,
|
||||
host: endpoint.host,
|
||||
|
@ -134,6 +150,10 @@ class Avatars extends Service {
|
|||
'project': client.config['project'],
|
||||
};
|
||||
|
||||
params.keys.forEach((key) {if (params[key] is int || params[key] is double) {
|
||||
params[key] = params[key].toString();
|
||||
}});
|
||||
|
||||
Uri endpoint = Uri.parse(client.endPoint);
|
||||
Uri location = new Uri(scheme: endpoint.scheme,
|
||||
host: endpoint.host,
|
||||
|
@ -161,6 +181,10 @@ class Avatars extends Service {
|
|||
'project': client.config['project'],
|
||||
};
|
||||
|
||||
params.keys.forEach((key) {if (params[key] is int || params[key] is double) {
|
||||
params[key] = params[key].toString();
|
||||
}});
|
||||
|
||||
Uri endpoint = Uri.parse(client.endPoint);
|
||||
Uri location = new Uri(scheme: endpoint.scheme,
|
||||
host: endpoint.host,
|
||||
|
|
|
@ -124,6 +124,10 @@ class Storage extends Service {
|
|||
'project': client.config['project'],
|
||||
};
|
||||
|
||||
params.keys.forEach((key) {if (params[key] is int || params[key] is double) {
|
||||
params[key] = params[key].toString();
|
||||
}});
|
||||
|
||||
Uri endpoint = Uri.parse(client.endPoint);
|
||||
Uri location = new Uri(scheme: endpoint.scheme,
|
||||
host: endpoint.host,
|
||||
|
@ -154,6 +158,10 @@ class Storage extends Service {
|
|||
'project': client.config['project'],
|
||||
};
|
||||
|
||||
params.keys.forEach((key) {if (params[key] is int || params[key] is double) {
|
||||
params[key] = params[key].toString();
|
||||
}});
|
||||
|
||||
Uri endpoint = Uri.parse(client.endPoint);
|
||||
Uri location = new Uri(scheme: endpoint.scheme,
|
||||
host: endpoint.host,
|
||||
|
@ -178,6 +186,10 @@ class Storage extends Service {
|
|||
'project': client.config['project'],
|
||||
};
|
||||
|
||||
params.keys.forEach((key) {if (params[key] is int || params[key] is double) {
|
||||
params[key] = params[key].toString();
|
||||
}});
|
||||
|
||||
Uri endpoint = Uri.parse(client.endPoint);
|
||||
Uri location = new Uri(scheme: endpoint.scheme,
|
||||
host: endpoint.host,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: appwrite
|
||||
version: 0.2.3
|
||||
version: 0.3.0-dev.1
|
||||
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
|
||||
|
@ -9,30 +9,15 @@ environment:
|
|||
sdk: '>=2.6.0 <3.0.0'
|
||||
dependencies:
|
||||
meta: ^1.1.8
|
||||
path_provider: ^1.6.5
|
||||
package_info: ^0.4.0+16
|
||||
dio: ^3.0.0
|
||||
cookie_jar: ^1.0.0
|
||||
path_provider: ^1.6.14
|
||||
package_info: ^0.4.3
|
||||
dio: ^3.0.10
|
||||
cookie_jar: ^1.0.1
|
||||
dio_cookie_manager: ^1.0.0
|
||||
flutter_web_auth: ^0.2.4
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^0.1.2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
# The following section is specific to Flutter.
|
||||
flutter:
|
||||
|
||||
# The following line ensures that the Material Icons font is
|
||||
# included with your application, so that you can use the icons in
|
||||
# the material Icons class.
|
||||
uses-material-design: true
|
||||
sdk: flutter
|
|
@ -1,4 +1,4 @@
|
|||
## 0.3.0
|
||||
## 0.3.0-dev.1
|
||||
|
||||
- Updated package dependencies (@lohanidamodar)
|
||||
- Added Flutter for Web compatibility (@lohanidamodar)
|
||||
|
|
Loading…
Reference in a new issue