add localized strings to custom widget view
edit save / use buttons for custom widget
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user