From 9a1c4a61518968450ec0d4020314c5ac14895ddf Mon Sep 17 00:00:00 2001 From: Banghua Zhao Date: Thu, 28 Nov 2024 10:32:50 +1300 Subject: [PATCH] Create interface for AuthUseCase --- android/version.properties | 4 ++-- lib/app/injection_container.dart | 2 +- .../api_env_repository.dart | 1 - packages/domain/lib/usecases/auth_usecase.dart | 18 ++++++++++++++++-- pubspec.yaml | 2 +- 5 files changed, 20 insertions(+), 7 deletions(-) delete mode 100644 packages/domain/lib/repositories_abstract/api_env_repository.dart diff --git a/android/version.properties b/android/version.properties index 1eba413..ee11822 100644 --- a/android/version.properties +++ b/android/version.properties @@ -1,2 +1,2 @@ -versionName=6.2.1 -versionCode=2024091518 +versionName=6.2.3 +versionCode=2024091519 diff --git a/lib/app/injection_container.dart b/lib/app/injection_container.dart index 5fa01ed..d4e4196 100644 --- a/lib/app/injection_container.dart +++ b/lib/app/injection_container.dart @@ -61,7 +61,7 @@ void initInjection() { sl.registerLazySingleton(() => FunctionToolsUseCase()); sl.registerLazySingleton( - () => AuthUseCase(repository: sl(), tokenProvider: sl())); + () => AuthUseCaseImpl(repository: sl(), tokenProvider: sl())); sl.registerLazySingleton( () => UserUseCase(repository: sl(), tokenProvider: sl())); diff --git a/packages/domain/lib/repositories_abstract/api_env_repository.dart b/packages/domain/lib/repositories_abstract/api_env_repository.dart deleted file mode 100644 index b9f78bb..0000000 --- a/packages/domain/lib/repositories_abstract/api_env_repository.dart +++ /dev/null @@ -1 +0,0 @@ -// TODO Implement this library. \ No newline at end of file diff --git a/packages/domain/lib/usecases/auth_usecase.dart b/packages/domain/lib/usecases/auth_usecase.dart index 3b9d384..4e957aa 100644 --- a/packages/domain/lib/usecases/auth_usecase.dart +++ b/packages/domain/lib/usecases/auth_usecase.dart @@ -6,11 +6,25 @@ import 'package:infrastructure/token_provider.dart'; import '../entities/user.dart'; import '../repositories_abstract/auth_repository.dart'; -class AuthUseCase { +abstract class AuthUseCase { + Future signup(String email, String password, String verificationCode,{String? name}); + Future login(String email, String password); + Future logout(); + Future forgetPassword(String email); + Future resetPassword(String email, String newPassword, String confirmationCode); + Future sendSignupVerificationCode(String email); + Future updatePassword(String newPassword); + Future syncUser(String? displayName, String email, String? photoUrl); + Future validateAppleToken(String identityToken); + Future validateGoogleToken(String idToken); + Future isLoggedIn(); +} + +class AuthUseCaseImpl implements AuthUseCase { final AuthRepository repository; final TokenProvider tokenProvider; - AuthUseCase({required this.repository, required this.tokenProvider}); + AuthUseCaseImpl({required this.repository, required this.tokenProvider}); Future signup(String email, String password, String verificationCode, {String? name}) async { diff --git a/pubspec.yaml b/pubspec.yaml index 32b262e..aa1d3e7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: swiftcomp description: A cross-platform composite calculator developed with Flutter, based on SwiftComp, designed for engineers and researchers. Available on iOS, Android, and Web. publish_to: none -version: 6.2.2+2024091518 +version: 6.2.3+2024111519 environment: sdk: ">=2.15.0 <3.0.0"