|
|
@@ -57,6 +57,20 @@ final class DesktopWidgetWindowManager: ObservableObject {
|
|
57
|
57
|
return removed.count
|
|
58
|
58
|
}
|
|
59
|
59
|
|
|
|
60
|
+ @discardableResult
|
|
|
61
|
+ func removeAllInstances() -> Int {
|
|
|
62
|
+ let instances = loadInstances()
|
|
|
63
|
+ guard !instances.isEmpty else { return 0 }
|
|
|
64
|
+ for instance in instances {
|
|
|
65
|
+ if let panel = windowsByInstanceID.removeValue(forKey: instance.id) {
|
|
|
66
|
+ panel.close()
|
|
|
67
|
+ }
|
|
|
68
|
+ }
|
|
|
69
|
+ saveInstances([])
|
|
|
70
|
+ instancesChangeToken += 1
|
|
|
71
|
+ return instances.count
|
|
|
72
|
+ }
|
|
|
73
|
+
|
|
60
|
74
|
func restore() {
|
|
61
|
75
|
for instance in loadInstances() where windowsByInstanceID[instance.id] == nil {
|
|
62
|
76
|
show(instance: instance)
|