mirror of
https://github.com/immich-app/immich.git
synced 2026-04-18 15:02:06 -04:00
* refactor: yank old timeline # Conflicts: # mobile/lib/presentation/pages/editing/drift_edit.page.dart # mobile/lib/providers/websocket.provider.dart # mobile/lib/routing/router.dart * more cleanup * remove native code * chore: bump sqlite-data version * remove old background tasks from BGTaskSchedulerPermittedIdentifiers * rebase --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
47 lines
1.4 KiB
Dart
47 lines
1.4 KiB
Dart
import 'dart:convert';
|
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:immich_mobile/domain/models/store.model.dart';
|
|
import 'package:immich_mobile/entities/store.entity.dart';
|
|
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
|
import 'package:immich_mobile/infrastructure/repositories/sync_stream.repository.dart';
|
|
import 'package:immich_mobile/models/auth/auxilary_endpoint.model.dart';
|
|
import 'package:immich_mobile/providers/infrastructure/db.provider.dart';
|
|
|
|
final authRepositoryProvider = Provider<AuthRepository>((ref) => AuthRepository(ref.watch(driftProvider)));
|
|
|
|
class AuthRepository {
|
|
final Drift _drift;
|
|
|
|
const AuthRepository(this._drift);
|
|
|
|
Future<void> clearLocalData() async {
|
|
await SyncStreamRepository(_drift).reset();
|
|
}
|
|
|
|
bool getEndpointSwitchingFeature() {
|
|
return Store.tryGet(StoreKey.autoEndpointSwitching) ?? false;
|
|
}
|
|
|
|
String? getPreferredWifiName() {
|
|
return Store.tryGet(StoreKey.preferredWifiName);
|
|
}
|
|
|
|
String? getLocalEndpoint() {
|
|
return Store.tryGet(StoreKey.localEndpoint);
|
|
}
|
|
|
|
List<AuxilaryEndpoint> getExternalEndpointList() {
|
|
final jsonString = Store.tryGet(StoreKey.externalEndpointList);
|
|
|
|
if (jsonString == null) {
|
|
return [];
|
|
}
|
|
|
|
final List<dynamic> jsonList = jsonDecode(jsonString);
|
|
final endpointList = jsonList.map((e) => AuxilaryEndpoint.fromJson(e)).toList();
|
|
|
|
return endpointList;
|
|
}
|
|
}
|