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
[CIS-1273] Ensure optional Core Data attributes map to optional Swift types #1646
Conversation
@tbarbugli I looked into automatically comparing the model definitions in the core data model against the managed object definitions. I was unsuccessful. The one thing I kept running into is the lack of information on the managed objects at runtime. I have no way to request the nullability of properties defined on te class level. Getting the same info from Core Data is easy. |
Generated by 🚫 Danger |
Codecov Report
@@ Coverage Diff @@
## develop #1646 +/- ##
===========================================
- Coverage 85.24% 85.18% -0.06%
===========================================
Files 231 230 -1
Lines 11071 11066 -5
===========================================
- Hits 9437 9427 -10
- Misses 1634 1639 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
Looks pretty solid, I just left a couple comments
bc29d67
to
3de57c3
Compare
d065943
to
8222d9f
Compare
8222d9f
to
38af61b
Compare
e277ffd
to
f985f5c
Compare
f985f5c
to
207d74a
Compare
@NSManaged private var localProgress: Double | ||
var localState: LocalAttachmentState? { | ||
get { | ||
localStateRaw.flatMap { LocalAttachmentState(rawValue: $0, progress: localProgress) } | ||
LocalAttachmentState(rawValue: localStateRaw, progress: localProgress) |
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.
What about LocalAttachmentState(rawValue: localStateRaw, progress: localProgress) ?? .unknown
so we don't expose an optional?
58edc61
to
9237c13
Compare
9237c13
to
d858e5e
Compare
- Uses sensible defaults when possible - Unit tests are also adjusted - Populate `ownReactions` and `latestReactions` on MessageDTO when creating a new object, they are non-optinal on the Core Data Model - Mark `MessageReactionDTO.id` and `MessageDTO.quotedMessage` and `ChannelDto.typeRawValue as non-optional - Make localStateRaw non optional on both the MessageReactionDTO and the AttachmentDTO.
d858e5e
to
bb70a8a
Compare
🔗 Issue Link
CIS-1273
🎯 Goal
A number of differences between the Core Data model and the ManagedObjects were present. This pull request removes those issues. When applicable a sensible default is chosen for what Core Data describes as primitive types.
🛠 Implementation
Several model definitions were changed, several managed object classes were changed, several sensible default values were chosen.
🧪 Testing
Run through the app. No crashes should occur.
🎨 Changes
Add relevant screenshots or videos showcasing the changes.
☑️ Checklist