Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add API within Configuration to update the endpoint

vishnukvmd089be7968858
diff --git a/mobile/lib/core/configuration.dart b/mobile/lib/core/configuration.dart
index cd6b5156e3..cde766b1e0 100644
--- a/mobile/lib/core/configuration.dart
+++ b/mobile/lib/core/configuration.dart
@@ -16,6 +16,7 @@ import 'package:photos/db/files_db.dart';
import 'package:photos/db/memories_db.dart';
import 'package:photos/db/trash_db.dart';
import 'package:photos/db/upload_locks_db.dart';
+import "package:photos/events/endpoint_updated_event.dart";
import 'package:photos/events/signed_in_event.dart';
import 'package:photos/events/user_logged_out_event.dart';
import 'package:photos/models/key_attributes.dart';
@@ -69,6 +70,7 @@ class Configuration {
static const hasSelectedAllFoldersForBackupKey =
"has_selected_all_folders_for_backup";
static const anonymousUserIDKey = "anonymous_user_id";
+ static const endPointKey = "endpoint";
final kTempFolderDeletionTimeBuffer = const Duration(hours: 6).inMicroseconds;
@@ -390,7 +392,12 @@ class Configuration {
}
String getHttpEndpoint() {
- return endpoint;
+ return _preferences.getString(endPointKey) ?? endpoint;
+ }
+
+ Future<void> setHttpEndpoint(String endpoint) async {
+ await _preferences.setString(endPointKey, endpoint);
+ Bus.instance.fire(EndpointUpdatedEvent());
}
String? getToken() {
diff --git a/mobile/lib/events/endpoint_updated_event.dart b/mobile/lib/events/endpoint_updated_event.dart
new file mode 100644
index 0000000000..33b18f68e4
--- /dev/null
+++ b/mobile/lib/events/endpoint_updated_event.dart
@@ -0,0 +1,3 @@
+import "package:photos/events/event.dart";
+
+class EndpointUpdatedEvent extends Event {}