Skip to content

High performance self-hosted photo and video management solution.

fix: auto route rebuild on settings change (#28717)

shenlong2382894fa2d7
diff --git a/mobile/lib/repositories/auth.repository.dart b/mobile/lib/repositories/auth.repository.dart
index 866d587328..dd9aed3a03 100644
--- a/mobile/lib/repositories/auth.repository.dart
+++ b/mobile/lib/repositories/auth.repository.dart
@@ -1,38 +1,40 @@
import 'package:hooks_riverpod/hooks_riverpod.dart';
-import 'package:immich_mobile/domain/models/config/app_config.dart';
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
+import 'package:immich_mobile/infrastructure/repositories/settings.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';
import 'package:immich_mobile/providers/infrastructure/settings.provider.dart';
final authRepositoryProvider = Provider<AuthRepository>(
- (ref) => AuthRepository(ref.watch(driftProvider), ref.watch(appConfigProvider)),
+ (ref) => AuthRepository(ref.watch(driftProvider), ref.watch(settingsProvider)),
);
class AuthRepository {
final Drift _drift;
- final AppConfig _config;
+ final SettingsRepository _settings;
- const AuthRepository(this._drift, this._config);
+ const AuthRepository(this._drift, this._settings);
Future<void> clearLocalData() async {
await SyncStreamRepository(_drift).reset();
}
bool getEndpointSwitchingFeature() {
- return _config.network.autoEndpointSwitching;
+ return _settings.appConfig.network.autoEndpointSwitching;
}
String? getPreferredWifiName() {
- return _config.network.preferredWifiName;
+ return _settings.appConfig.network.preferredWifiName;
}
String? getLocalEndpoint() {
- return _config.network.localEndpoint;
+ return _settings.appConfig.network.localEndpoint;
}
List<AuxilaryEndpoint> getExternalEndpointList() {
- return _config.network.externalEndpointList.map((url) => AuxilaryEndpoint(url: url, status: .valid)).toList();
+ return _settings.appConfig.network.externalEndpointList
+ .map((url) => AuxilaryEndpoint(url: url, status: .valid))
+ .toList();
}
}