-
Notifications
You must be signed in to change notification settings - Fork 61
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
feat: modernization use case example (DRAFT-DO NOT MERGE) #367
base: main
Are you sure you want to change the base?
Conversation
Adding changes to include suspend fun for internal usage with dispatchers and scope in mediator Adding repository Adding uploading component, strategies, types, etc.
…SDKS-5109-modernization-interfaces # Conflicts: # build.gradle
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.
Reviewed. Looks good overall and looking forward to getting started on this project!
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.
Left a couple comments and a question. Overall looks good though, I'll get a better feel for it once I port it to Swift.
@@ -0,0 +1,6 @@ | |||
package com.mparticle.modernization | |||
|
|||
class MpApiClientImpl { |
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 should have an ApiClient
interface which this extends right?
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.
Yup, just wanted to outline the idea of the data source itself. We might even have the ApiClient itself without interface if we don't intend to have multiple implementations of it (foe example multiple http clients as tools to resolve the implementation). In the future we could always create the abstraction and change this into an Impl.
@@ -0,0 +1,13 @@ | |||
package com.mparticle.modernization |
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.
Based on latest discussions, we should use the term "nextgen" instead of "modernization"
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.
Sure
@@ -0,0 +1,13 @@ | |||
package com.mparticle.modernization | |||
|
|||
class BatchManager(private val api : MpApiClientImpl) { |
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.
Same as other comment, this should take an ApiClient
interface of which MpApiClientImpl
extends right?
import com.mparticle.modernization.kit.MParticleKitManager | ||
import com.mparticle.modernization.datahandler.MParticleDataHandler | ||
|
||
internal class MParticle private constructor(private val options: MParticleOptions) { |
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 exactly does private val
do in this constructor parameter? Is it syntax sugar for creating a private instance property called options
and assigning it this value?
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 enables to use the dependency injection pattern, making the property accesible to be used in the class but restrict visibility from consumers. If options would have been public, MParticle.getInstance().options would have been valid.. Moreover by default properties have public setters/getters so, someone from the outside could eventually temper with the properties within MParticleOptions
5b12dbc
to
148681b
Compare
Instructions
development
Summary
This is obviously a WIP and is intendeed just to show high level interaction between the architecture components.
Testing Plan
Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)