mirror of
https://github.com/DefinedNet/mobile_nebula.git
synced 2025-02-22 19:15:27 +00:00
Add updateSite
method to Sites
This commit is contained in:
parent
f2dacff0f1
commit
d3a7167036
2 changed files with 18 additions and 4 deletions
|
@ -88,7 +88,8 @@ func MissingArgumentError(message: String, details: Any?) -> FlutterError {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return result(
|
return result(
|
||||||
CallFailedError(
|
CallFailedError(
|
||||||
message: "Error while parsing certificate(s)", details: err!.localizedDescription))
|
message: "Error while parsing certificate(s)", details: err!.localizedDescription
|
||||||
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
return result(json)
|
return result(json)
|
||||||
|
@ -110,7 +111,8 @@ func MissingArgumentError(message: String, details: Any?) -> FlutterError {
|
||||||
return result(
|
return result(
|
||||||
CallFailedError(
|
CallFailedError(
|
||||||
message: "Error while verifying certificate and private key",
|
message: "Error while verifying certificate and private key",
|
||||||
details: err!.localizedDescription))
|
details: err!.localizedDescription
|
||||||
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
return result(valid)
|
return result(valid)
|
||||||
|
@ -122,7 +124,8 @@ func MissingArgumentError(message: String, details: Any?) -> FlutterError {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return result(
|
return result(
|
||||||
CallFailedError(
|
CallFailedError(
|
||||||
message: "Error while generating key pairs", details: err!.localizedDescription))
|
message: "Error while generating key pairs", details: err!.localizedDescription
|
||||||
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
return result(kp)
|
return result(kp)
|
||||||
|
@ -240,7 +243,8 @@ func MissingArgumentError(message: String, details: Any?) -> FlutterError {
|
||||||
} catch {
|
} catch {
|
||||||
return result(
|
return result(
|
||||||
CallFailedError(
|
CallFailedError(
|
||||||
message: "Could not start site", details: error.localizedDescription))
|
message: "Could not start site", details: error.localizedDescription
|
||||||
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,16 @@ class Sites {
|
||||||
func getContainer(id: String) -> SiteContainer? {
|
func getContainer(id: String) -> SiteContainer? {
|
||||||
return containers[id]
|
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 {
|
class SiteUpdater: NSObject, FlutterStreamHandler, @unchecked Sendable {
|
||||||
|
|
Loading…
Reference in a new issue