summaryrefslogtreecommitdiff
path: root/Sora
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-03-17 05:32:34 -0700
committerFuwn <[email protected]>2025-03-17 05:32:34 -0700
commit395b75206b51e75b1c93f95398d1274d83c7c78b (patch)
tree0c4753125f46f05eaf7e949fb40cd51db72944a3 /Sora
parentfeat: Development commit (diff)
downloadsora-testing-395b75206b51e75b1c93f95398d1274d83c7c78b.tar.xz
sora-testing-395b75206b51e75b1c93f95398d1274d83c7c78b.zip
feat: Development commit
Diffstat (limited to 'Sora')
-rw-r--r--Sora/Data/Settings/SettingsManager.swift34
-rw-r--r--Sora/Views/Generic/GenericListView.swift1
2 files changed, 20 insertions, 15 deletions
diff --git a/Sora/Data/Settings/SettingsManager.swift b/Sora/Data/Settings/SettingsManager.swift
index 63a6223..39317b4 100644
--- a/Sora/Data/Settings/SettingsManager.swift
+++ b/Sora/Data/Settings/SettingsManager.swift
@@ -147,21 +147,7 @@ class SettingsManager: ObservableObject { // swiftlint:disable:this type_body_l
object: NSUbiquitousKeyValueStore.default,
queue: .main
) { [weak self] _ in
- guard let localSelf = self, localSelf.enableICloudSync else { return } // swiftlint:disable:this self_binding
-
- if let data = NSUbiquitousKeyValueStore.default.data(forKey: "bookmarks") {
- localSelf.bookmarksData = data
- }
-
- if let data = NSUbiquitousKeyValueStore.default.data(forKey: "searchHistory") {
- localSelf.searchHistoryData = data
- }
-
- if let data = NSUbiquitousKeyValueStore.default.data(forKey: "customProviders") {
- localSelf.customProvidersData = data
- }
-
- localSelf.objectWillChange.send()
+ self?.pullSyncedSettings()
}
}
@@ -254,6 +240,24 @@ class SettingsManager: ObservableObject { // swiftlint:disable:this type_body_l
#endif
}
+ func pullSyncedSettings() {
+ if self.enableICloudSync {
+ if let data = NSUbiquitousKeyValueStore.default.data(forKey: "bookmarks") {
+ self.bookmarksData = data
+ }
+
+ if let data = NSUbiquitousKeyValueStore.default.data(forKey: "searchHistory") {
+ self.searchHistoryData = data
+ }
+
+ if let data = NSUbiquitousKeyValueStore.default.data(forKey: "customProviders") {
+ self.customProvidersData = data
+ }
+
+ self.objectWillChange.send()
+ }
+ }
+
func syncToICloud() {
if enableICloudSync {
// Merge bookmarks
diff --git a/Sora/Views/Generic/GenericListView.swift b/Sora/Views/Generic/GenericListView.swift
index ee0b09e..f6805ad 100644
--- a/Sora/Views/Generic/GenericListView.swift
+++ b/Sora/Views/Generic/GenericListView.swift
@@ -60,6 +60,7 @@ struct GenericListView<T: Identifiable & Hashable & GenericItem>: View {
}
.navigationTitle(title)
.searchable(text: $searchText)
+ .refreshable { settings.pullSyncedSettings() }
.toolbar {
ToolbarItem {
Button(action: {