add localized strings to custom widget view

edit save / use buttons for custom widget
This commit is contained in:
Trey t
2022-02-27 15:58:47 -06:00
parent 0ff2ef8fba
commit 2e92d89faf
3 changed files with 42 additions and 62 deletions

View File

@@ -173,36 +173,5 @@ class UserDefaultsStore {
fatalError("error saving")
}
}
@discardableResult
static func makeWidgetCurrent(withUUID uuid: String) -> [CustomWidgetModel] {
do {
let existingWidgets = getCustomWidgets()
if let foundWidget = existingWidgets.first(where: {
$0.uuid == uuid
}) {
existingWidgets.forEach({
$0.inUse = false
})
foundWidget.inUse = true
} else {
if let first = existingWidgets.first {
first.inUse = true
}
}
existingWidgets.forEach({
$0.isSaved = true
})
let data = try JSONEncoder().encode(existingWidgets)
GroupUserDefaults.groupDefaults.set(data, forKey: UserDefaultsStore.Keys.customWidget.rawValue)
return UserDefaultsStore.getCustomWidgets()
} catch {
fatalError("error saving")
}
}
}