1
0
mirror of https://github.com/immich-app/immich.git synced 2025-08-08 23:07:06 +02:00

refactor(mobile): auth.interface.dart (#19349)

This commit is contained in:
Alex
2025-06-21 17:09:12 -05:00
committed by GitHub
parent 9b047d30e4
commit af30d97668
4 changed files with 7 additions and 27 deletions

View File

@ -10,23 +10,20 @@ import 'package:immich_mobile/entities/store.entity.dart';
import 'package:immich_mobile/infrastructure/entities/exif.entity.dart';
import 'package:immich_mobile/infrastructure/entities/user.entity.dart';
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
import 'package:immich_mobile/interfaces/auth.interface.dart';
import 'package:immich_mobile/models/auth/auxilary_endpoint.model.dart';
import 'package:immich_mobile/providers/db.provider.dart';
import 'package:immich_mobile/providers/infrastructure/db.provider.dart';
import 'package:immich_mobile/repositories/database.repository.dart';
final authRepositoryProvider = Provider<IAuthRepository>(
(ref) =>
AuthRepository(ref.watch(dbProvider), drift: ref.watch(driftProvider)),
final authRepositoryProvider = Provider<AuthRepository>(
(ref) => AuthRepository(ref.watch(dbProvider), ref.watch(driftProvider)),
);
class AuthRepository extends DatabaseRepository implements IAuthRepository {
class AuthRepository extends DatabaseRepository {
final Drift _drift;
AuthRepository(super.db, {required Drift drift}) : _drift = drift;
AuthRepository(super.db, this._drift);
@override
Future<void> clearLocalData() {
return db.writeTxn(() {
return Future.wait([
@ -41,27 +38,22 @@ class AuthRepository extends DatabaseRepository implements IAuthRepository {
});
}
@override
String getAccessToken() {
return Store.get(StoreKey.accessToken);
}
@override
bool getEndpointSwitchingFeature() {
return Store.tryGet(StoreKey.autoEndpointSwitching) ?? false;
}
@override
String? getPreferredWifiName() {
return Store.tryGet(StoreKey.preferredWifiName);
}
@override
String? getLocalEndpoint() {
return Store.tryGet(StoreKey.localEndpoint);
}
@override
List<AuxilaryEndpoint> getExternalEndpointList() {
final jsonString = Store.tryGet(StoreKey.externalEndpointList);