Migration to 2.x.x
Changes
App build.gradle
Make sure the app's build.gradle file contains the following code snippet within the android section
buildFeatures.compose = true
composeOptions {
kotlinCompilerExtensionVersion = "1.5.15"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
SDK Initialization
Legacy code:
MeetingLawyersClient.newInstance(
application,
meetingLawyersApiKey,
CustomerSdkBuildMode.PROD,
locale
)
New code:
val mlClient: MeetingLawyersClient = new MeetingLawyersSDK(
application,
meetingLawyersApiKey,
CustomerSdkBuildMode.PROD,
locale
).build()
Retrieve MeetingLawyersClient instance
Legacy code:
MeetingLawyersClient.getInstance()
New code:
MeetingLawyersSDK.getClientInstance()
Note: You can retrieve the client instance using the getClientInstance() method, but we recommend obtaining a client instance using the build() method of MeetingLawyersSDK. After obtaining the instance, you should add it to your Dependency Injection (DI) container or setup. This ensures that the instance is properly managed throughout the application's lifecycle, promoting easier code maintenance, testing, and scalability.
Authenticate
Legacy code:
MeetingLawyersClient.getInstance().authenticate(
"userId",
new MeetingLawyersClient.AuthenticationListener() {
override fun onAuthenticated() {
//your code
}
override fun onAuthenticationError(throwable: Throwable) {
//your code
}
}
)
New code:
MeetingLawyersSDK.getClientInstance().authenticate(
"userId",
object : SDKCallbackWithoutData {
override fun onSuccess() {
//your code
}
override fun onError(message: String?) {
//your code
}
}
)
SDK Callbacks interfaces
Now, all the listeners in the SDK are one of these two:
interface SDKCallbackWithoutData {
fun onSuccess()
fun onError(message: String?)
}
interface SDKCallback<D> {
fun onSuccess(data: D)
fun onError(message: String?)
}