-
Notifications
You must be signed in to change notification settings - Fork 4
[LOOP-5405] Activity Presets Core #688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
let container = try decoder.container(keyedBy: CodingKeys.self) | ||
if let symbolTypeValue = try container.decodeIfPresent(SymbolType.self, forKey: .symbolType) { | ||
self.symbolType = symbolTypeValue | ||
if let container = try? decoder.container(keyedBy: CodingKeys.self) { | ||
self.symbolType = try container.decode(SymbolType.self, forKey: .symbolType) | ||
self.tint = try container.decodeIfPresent(SymbolTint.self, forKey: .tint) | ||
self.value = try container.decode(String.self, forKey: .value) | ||
} else { | ||
let container = try decoder.singleValueContainer() | ||
self.symbolType = .emoji | ||
self.tint = nil | ||
self.value = try container.decode(String.self, forKey: .symbolType) | ||
self.value = try container.decode(String.self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is to support migration from the old preset symbol type to the new one.
case "legacyWorkout": | ||
self = .custom |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a legacy workout is found when trying to decode, I just have it marked as custom here. I think ideally, this would decode into a .preset(TemporaryPreset), but I'm not sure what settings I'd provide it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ok as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
case "legacyWorkout": | ||
self = .custom |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ok as is.
https://tidepool.atlassian.net/browse/LOOP-5405