Add updateSite method to Sites

This commit is contained in:
Caleb Jasik 2025-02-19 17:21:07 -06:00
parent f2dacff0f1
commit d3a7167036
No known key found for this signature in database
2 changed files with 18 additions and 4 deletions

View file

@ -88,7 +88,8 @@ func MissingArgumentError(message: String, details: Any?) -> FlutterError {
if err != nil {
return result(
CallFailedError(
message: "Error while parsing certificate(s)", details: err!.localizedDescription))
message: "Error while parsing certificate(s)", details: err!.localizedDescription
))
}
return result(json)
@ -110,7 +111,8 @@ func MissingArgumentError(message: String, details: Any?) -> FlutterError {
return result(
CallFailedError(
message: "Error while verifying certificate and private key",
details: err!.localizedDescription))
details: err!.localizedDescription
))
}
return result(valid)
@ -122,7 +124,8 @@ func MissingArgumentError(message: String, details: Any?) -> FlutterError {
if err != nil {
return result(
CallFailedError(
message: "Error while generating key pairs", details: err!.localizedDescription))
message: "Error while generating key pairs", details: err!.localizedDescription
))
}
return result(kp)
@ -240,7 +243,8 @@ func MissingArgumentError(message: String, details: Any?) -> FlutterError {
} catch {
return result(
CallFailedError(
message: "Could not start site", details: error.localizedDescription))
message: "Could not start site", details: error.localizedDescription
))
}
}
}

View file

@ -76,6 +76,16 @@ class Sites {
func getContainer(id: String) -> SiteContainer? {
return containers[id]
}
func updateSite(site: Site) {
// Signal the site has changed in case the current site details screen is active
let container = getContainer(id: site.id)
if container != nil {
// Update references to the site with the new site config
container!.site = site
container!.updater.update(connected: site.connected ?? false, replaceSite: site)
}
}
}
class SiteUpdater: NSObject, FlutterStreamHandler, @unchecked Sendable {