|
|
|
|
@ -1,5 +1,4 @@
|
|
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
|
|
|
import 'package:immich_mobile/interfaces/auth_api.interface.dart';
|
|
|
|
|
import 'package:immich_mobile/models/auth/login_response.model.dart';
|
|
|
|
|
import 'package:immich_mobile/providers/api.provider.dart';
|
|
|
|
|
import 'package:immich_mobile/repositories/api.repository.dart';
|
|
|
|
|
@ -9,12 +8,11 @@ import 'package:openapi/api.dart';
|
|
|
|
|
final authApiRepositoryProvider =
|
|
|
|
|
Provider((ref) => AuthApiRepository(ref.watch(apiServiceProvider)));
|
|
|
|
|
|
|
|
|
|
class AuthApiRepository extends ApiRepository implements IAuthApiRepository {
|
|
|
|
|
class AuthApiRepository extends ApiRepository {
|
|
|
|
|
final ApiService _apiService;
|
|
|
|
|
|
|
|
|
|
AuthApiRepository(this._apiService);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<void> changePassword(String newPassword) async {
|
|
|
|
|
await _apiService.usersApi.updateMyUser(
|
|
|
|
|
UserUpdateMeDto(
|
|
|
|
|
@ -23,7 +21,6 @@ class AuthApiRepository extends ApiRepository implements IAuthApiRepository {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<LoginResponse> login(String email, String password) async {
|
|
|
|
|
final loginResponseDto = await checkNull(
|
|
|
|
|
_apiService.authenticationApi.login(
|
|
|
|
|
@ -37,7 +34,6 @@ class AuthApiRepository extends ApiRepository implements IAuthApiRepository {
|
|
|
|
|
return _mapLoginReponse(loginResponseDto);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<void> logout() async {
|
|
|
|
|
await _apiService.authenticationApi
|
|
|
|
|
.logout()
|
|
|
|
|
@ -56,7 +52,6 @@ class AuthApiRepository extends ApiRepository implements IAuthApiRepository {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<bool> unlockPinCode(String pinCode) async {
|
|
|
|
|
try {
|
|
|
|
|
await _apiService.authenticationApi
|
|
|
|
|
@ -67,13 +62,11 @@ class AuthApiRepository extends ApiRepository implements IAuthApiRepository {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<void> setupPinCode(String pinCode) {
|
|
|
|
|
return _apiService.authenticationApi
|
|
|
|
|
.setupPinCode(PinCodeSetupDto(pinCode: pinCode));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<void> lockPinCode() {
|
|
|
|
|
return _apiService.authenticationApi.lockAuthSession();
|
|
|
|
|
}
|
|
|
|
|
|