-
Notifications
You must be signed in to change notification settings - Fork 5
refactor: json [7] #97
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
base: refactor/data-access
Are you sure you want to change the base?
Conversation
| ], | ||
| dependencies: [ | ||
| .package(url: "https://github.com/WeTransfer/Mocker", from: "3.0.1"), | ||
| .package(url: "https://github.com/iwill/generic-json-swift", from: "2.0.2"), |
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.
Hey @eligutovsky , have we had any discussion about adding new dependencies to the SDK?
Some clients are a little sensitive to the size/dependency footprint, and dependencies can make integration more tricky if there are conflicting versions.
Just a thought, we should consider it carefully.
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 dependency was copy-pasted to the source code previously. I will remove this dependency and will keep it copy-pasted.
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.
Sorry not sure I understand, you mean we already depend on it? (if so, fair enough, might propose the inverse of dependency simplification in the future, but that's another topic 😅)
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.
Yes, we're already depend on it. See OptimoveSDK/Sources/Classes/JSON/JSON.swift -- in removed files of this PR.
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.
Ah, clear!
Next question: do you know why we 'vendored' this library code into the SDK in the past, does it matter?
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.
It was added previously because the SDK allows to get [String: Any] as a parameter of an event.
See #97 (comment)
It might worth to replace JSON with Data by using JSONSerialization.
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.
Ideally, we need to decode any internal json to a Codable model.
| private(set) var dismissedAt: Date? | ||
| private(set) var sentAt: Date | ||
| private(set) var data: NSDictionary? | ||
| private(set) var data: ObjcJSON? |
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.
Are these 'breaking' API changes / do we expose/leak the type from a library to the consumer app?
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.
The CoreData entity model is only meant for internal use and should not be accessed by consumer apps.
This change has been made to fix the issue of NSDictionary not conforming to the Codable protocol. It is important to ensure that values stored in the CoreData are Codable before they are stored. This will help ensure that the data is ready to be send through network.
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.
Great, all for these kind of things in general, Codable will be simpler, but I think this model InAppInboxItem is not the Core Data entity, it is the model we expose to consumers, so changing this field could be breaking/leaky.
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.
Hmm, this class cannot be exposed to a consumer -- it is not public
7c8ccb6 to
8fe602c
Compare
Description of Changes
Use
GenericJSONthat conforms toCodableBreaking Changes
Release Checklist
Prepare:
pod lib lintpassesBump versions in:
OptimoveCore.podspecOptimoveNotificationServiceExtension.podspecOptimoveSDK.podspecOptimoveCore/Sources/Classes/Constants/SDKVersion.swiftREADME.mdCHANGELOG.mdUpdate major version numbers in wiki (basic integration + push guides)
Integration tests
T&T Only
Mobile Only
Deferred Deep Links
Combined
Release:
pod trunk pushto publish to CocoaPodsPost Release: