Reload service on current profile update
This commit is contained in:
@@ -166,6 +166,7 @@ public struct EditProfileView: View {
|
|||||||
#else
|
#else
|
||||||
try await ProfileUpdateTask.configure()
|
try await ProfileUpdateTask.configure()
|
||||||
#endif
|
#endif
|
||||||
|
try await profile.onProfileUpdated()
|
||||||
} catch {
|
} catch {
|
||||||
alert = Alert(error)
|
alert = Alert(error)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -13,8 +13,26 @@ public extension Profile {
|
|||||||
if let error {
|
if let error {
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
try write(remoteContent)
|
|
||||||
lastUpdated = Date()
|
lastUpdated = Date()
|
||||||
try await ProfileManager.update(self)
|
try await ProfileManager.update(self)
|
||||||
|
do {
|
||||||
|
let oldContent = try read()
|
||||||
|
if oldContent == remoteContent {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
try write(remoteContent)
|
||||||
|
try await onProfileUpdated()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nonisolated func onProfileUpdated() async throws {
|
||||||
|
if await SharedPreferences.selectedProfileID.get() == id {
|
||||||
|
if let profile = try? await ExtensionProfile.load() {
|
||||||
|
if profile.status == .connected {
|
||||||
|
try LibboxNewStandaloneCommandClient()!.serviceReload()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user