From 791dd0d0893885cfaa128190525b1ab10a9c7978 Mon Sep 17 00:00:00 2001 From: pavanpodila Date: Mon, 8 Apr 2024 20:14:06 +0530 Subject: [PATCH] change in signatures and testing with firebase auth --- .../plugin/auth/anonymous_auth_plugin.dart | 2 +- .../lib/plugin/auth/auth_plugin.dart | 68 +++++++++++++++---- .../vyuh_core/lib/plugin/auth/user.dart | 3 +- 3 files changed, 56 insertions(+), 17 deletions(-) diff --git a/packages/system/vyuh_core/lib/plugin/auth/anonymous_auth_plugin.dart b/packages/system/vyuh_core/lib/plugin/auth/anonymous_auth_plugin.dart index a476461a..d05a438c 100644 --- a/packages/system/vyuh_core/lib/plugin/auth/anonymous_auth_plugin.dart +++ b/packages/system/vyuh_core/lib/plugin/auth/anonymous_auth_plugin.dart @@ -35,7 +35,7 @@ final class AnonymousAuthPlugin extends AuthPlugin { @override Future loginWithEmailPassword( - {required String username, required String password}) async { + {required String email, required String password}) async { controller.add(User.anonymous); } diff --git a/packages/system/vyuh_core/lib/plugin/auth/auth_plugin.dart b/packages/system/vyuh_core/lib/plugin/auth/auth_plugin.dart index 8c6b6227..7c3dcbcd 100644 --- a/packages/system/vyuh_core/lib/plugin/auth/auth_plugin.dart +++ b/packages/system/vyuh_core/lib/plugin/auth/auth_plugin.dart @@ -13,7 +13,7 @@ abstract base class AuthPlugin extends Plugin { AuthPlugin({required super.name, required super.title}) : super(pluginType: PluginType.auth); - User? get currentUser; + User? get currentUser => throw UnimplementedError(); Stream get userChanges { if (!_initialized) { @@ -43,25 +43,63 @@ abstract base class AuthPlugin extends Plugin { _initialized = true; } - Future loginAnonymously(); + Future loginAnonymously() { + throw UnimplementedError(); + } Future loginWithPhoneOtp( - {required String phoneNumber, required String otp}); + {required String phoneNumber, required String otp}) { + throw UnimplementedError(); + } + Future loginWithEmailPassword( - {required String username, required String password}); - Future sendEmailLink({required String email, required String clientId}); + {required String email, required String password}) { + throw UnimplementedError(); + } + + Future sendEmailLink( + {required String email, required String clientId}) { + throw UnimplementedError(); + } + Future loginWithEmailLink( - {required String email, required String link}); + {required String email, required String link}) { + throw UnimplementedError(); + } + + Future loginWithGoogle() { + throw UnimplementedError(); + } - Future loginWithGoogle(); - Future loginWithMeta(); - Future loginWithApple(); - Future loginWithTwitter(); - Future loginWithGithub(); - Future loginWithLinkedin(); - Future loginWithMicrosoft(); + Future loginWithMeta() { + throw UnimplementedError(); + } - Future logout(); + Future loginWithApple() { + throw UnimplementedError(); + } - Future deleteAccount(); + Future loginWithTwitter() { + throw UnimplementedError(); + } + + Future loginWithGithub() { + throw UnimplementedError(); + } + + Future loginWithLinkedin() { + throw UnimplementedError(); + } + + Future loginWithMicrosoft() { + throw UnimplementedError(); + } + + Future logout() { + throw UnimplementedError(); + } + + Future deleteAccount() { + throw UnimplementedError(); + } } diff --git a/packages/system/vyuh_core/lib/plugin/auth/user.dart b/packages/system/vyuh_core/lib/plugin/auth/user.dart index 31374bd8..732c9069 100644 --- a/packages/system/vyuh_core/lib/plugin/auth/user.dart +++ b/packages/system/vyuh_core/lib/plugin/auth/user.dart @@ -7,18 +7,19 @@ class User { final LoginMethod loginMethod; const User({ + required this.loginMethod, required this.id, this.name, this.email, this.phoneNumber, this.photoUrl, - this.loginMethod = LoginMethod.anonymous, }); bool get isAnonymous => this == anonymous; static const anonymous = User( id: 'anonymous', + loginMethod: LoginMethod.anonymous, ); }