diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b0cc80..00272bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [0.3.0] +* Upgrade to support Appwrite 0.15 +* More on Appwrite's [Flutter SDK Changelog](https://pub.dev/packages/appwrite/changelog#600) + ## [0.2.1] * Fix export issues diff --git a/example/lib/main.dart b/example/lib/main.dart index d508c3b..f9b569a 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -170,7 +170,7 @@ class _LoginPageState extends State { final password = _password.text; if (!await context.authNotifier - .createSession(email: email, password: password)) { + .createEmailSession(email: email, password: password)) { ScaffoldMessenger.of(context).showSnackBar(SnackBar( content: Text(context.authNotifier.error ?? "Unknown error"))); diff --git a/example/pubspec.lock b/example/pubspec.lock index e608b1e..7ebbe68 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,14 +7,14 @@ packages: name: appwrite url: "https://pub.dartlang.org" source: hosted - version: "5.0.0" + version: "6.0.0" appwrite_auth_kit: dependency: "direct main" description: path: ".." relative: true source: path - version: "0.2.1" + version: "0.3.0" async: dependency: transitive description: diff --git a/lib/src/accounts_provider.dart b/lib/src/accounts_provider.dart index 9b7b2e3..7e93d8f 100644 --- a/lib/src/accounts_provider.dart +++ b/lib/src/accounts_provider.dart @@ -101,7 +101,7 @@ class AuthNotifier extends ChangeNotifier { } } - Future createSession({ + Future createEmailSession({ required String email, required String password, bool notify = true, @@ -111,7 +111,7 @@ class AuthNotifier extends ChangeNotifier { notifyListeners(); } try { - await _account.createSession(email: email, password: password); + await _account.createEmailSession(email: email, password: password); _getUser(notify: notify); return true; } on AppwriteException catch (e) { @@ -124,6 +124,41 @@ class AuthNotifier extends ChangeNotifier { } } + Future createPhoneSession({ + required String userId, + required String number, + }) async { + _status = AuthStatus.authenticating; + notifyListeners(); + try { + await _account.createPhoneSession(userId: userId, number: number); + return true; + } on AppwriteException catch (e) { + _error = e.message; + _status = AuthStatus.unauthenticated; + notifyListeners(); + return false; + } + } + + Future updatePhoneSession({ + required String userId, + required String secret, + }) async { + _status = AuthStatus.authenticating; + notifyListeners(); + try { + await _account.updatePhoneSession(userId: userId, secret: secret); + await _getUser(); + return true; + } on AppwriteException catch (e) { + _error = e.message; + _status = AuthStatus.unauthenticated; + notifyListeners(); + return false; + } + } + Future createAnonymousSession() async { _status = AuthStatus.authenticating; notifyListeners(); @@ -205,7 +240,7 @@ class AuthNotifier extends ChangeNotifier { userId: userId, name: name, email: email, password: password); _error = ''; if (newSession) { - await createSession(email: email, password: password); + await createEmailSession(email: email, password: password); } return user; } on AppwriteException catch (e) { @@ -307,6 +342,21 @@ class AuthNotifier extends ChangeNotifier { } } + Future updatePhone({ + required String number, + required String password, + }) async { + try { + _user = await _account.updatePhone(number: number, password: password); + notifyListeners(); + return _user; + } on AppwriteException catch (e) { + _error = e.message; + notifyListeners(); + return null; + } + } + Future updateEmail({ required String email, required String password, diff --git a/pubspec.lock b/pubspec.lock index 7841181..15df704 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,7 +7,7 @@ packages: name: appwrite url: "https://pub.dartlang.org" source: hosted - version: "5.0.0" + version: "6.0.0" async: dependency: transitive description: @@ -63,14 +63,14 @@ packages: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "3.0.2" device_info_plus: dependency: transitive description: name: device_info_plus url: "https://pub.dartlang.org" source: hosted - version: "3.2.3" + version: "3.2.4" device_info_plus_linux: dependency: transitive description: @@ -91,7 +91,7 @@ packages: name: device_info_plus_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.3.0" + version: "2.3.0+1" device_info_plus_web: dependency: transitive description: @@ -119,14 +119,14 @@ packages: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.2.1" file: dependency: transitive description: name: file url: "https://pub.dartlang.org" source: hosted - version: "6.1.0" + version: "6.1.2" flutter: dependency: "direct main" description: flutter @@ -138,7 +138,7 @@ packages: name: flutter_lints url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.0.1" flutter_test: dependency: "direct dev" description: flutter @@ -169,7 +169,7 @@ packages: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "4.0.0" + version: "4.0.1" js: dependency: transitive description: @@ -183,7 +183,7 @@ packages: name: lints url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "2.0.0" matcher: dependency: transitive description: @@ -260,70 +260,70 @@ packages: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "2.0.9" + version: "2.0.11" path_provider_android: dependency: transitive description: name: path_provider_android url: "https://pub.dartlang.org" source: hosted - version: "2.0.11" + version: "2.0.16" path_provider_ios: dependency: transitive description: name: path_provider_ios url: "https://pub.dartlang.org" source: hosted - version: "2.0.7" + version: "2.0.10" path_provider_linux: dependency: transitive description: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.7" path_provider_macos: dependency: transitive description: name: path_provider_macos url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.0.6" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.1" + version: "2.0.4" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.4" + version: "2.0.7" platform: dependency: transitive description: name: platform url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.1.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.2" process: dependency: transitive description: name: process url: "https://pub.dartlang.org" source: hosted - version: "4.2.1" + version: "4.2.4" sky_engine: dependency: transitive description: flutter @@ -377,7 +377,7 @@ packages: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.3.1" vector_math: dependency: transitive description: @@ -398,14 +398,14 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.6.1" xdg_directories: dependency: transitive description: name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "0.2.0+1" sdks: - dart: ">=2.17.0-0 <3.0.0" - flutter: ">=2.5.0" + dart: ">=2.17.0 <3.0.0" + flutter: ">=3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 2f57612..17930cf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,6 @@ name: appwrite_auth_kit -description: A wrapper for Appwrite's Accounts service, makes it easy to use - Accounts service, manage authentication and account features. -version: 0.2.1 +description: A wrapper for Appwrite's Accounts service, makes it easy to manage authentication and account features. +version: 0.3.0 homepage: https://github.com/lohanidamodar/appwrite_auth_kit environment: @@ -9,12 +8,12 @@ environment: flutter: ">=2.0.0" dependencies: - appwrite: ^5.0.0 + appwrite: ^6.0.0 flutter: sdk: flutter dev_dependencies: - flutter_lints: ^1.0.4 + flutter_lints: ^2.0.1 flutter_test: sdk: flutter