1.16 -> 1.17
Breaking Changes
In 1.17 release, listed are the breaking changes
Removed
interface Callback<T>in favour of Kotlin lambda functions.Removed
interface ResultCallback<T>in favour of Kotlin lambda functions.Migrated
interface MonitorCallbacksto Kotlin which changes the way to access below members while inheriting/implementing the interface.CONFIDENCE_LOW, CONFIDENCE_MID, CONFIDENCE_HIGH
Migrating Your Code
Updating Callback interface with a lambda function
Remove the following imports
import com.intellimec.mobile.android.common.CallbackUpdate the code to lambda
// SDK 1.16 Callback<T> // SDK 1.17 (T) -> Unit)
The following shows typical code from SDK 1.16
Instead of Callback<Status> we will pass a lambda function((Status) -> Unit)
The following is the migrated version of above code to SDK 1.17
Basically swap Callback<Status> with a lambda which takes a Status type parameter and returns Unit and remove the .execute call and directly call the lambda.
You could also call the lambda like tripStatusCallback?.invoke(Status.from(tdStatus)) in case if callback is nullable. Below is the example for the same.
Updating ResultCallback interface with a lambda function
Remove the following imports
Update the code to lambda
The following shows typical code from SDK 1.16
Instead of ResultCallback<String> we will pass a lambda (Result<T>) -> Unit)
The following is the migrated version of above code to SDK 1.17
Basically swap ResultCallback<String> with a lambda which takes a Result<String> type parameter and returns Unit and remove the .execute call and directly call the lambda.
You could also call the lambda like callback?.invoke(Result.Success(signedToken)) in case if callback is nullable. Below is the example for the same.
Accessing members from MonitorCallbacks
This only affects you, if you’re inheriting/implementing the MonitorCallbacks interface.
If you are inheriting/implementing the interface MonitorCallbacks , you won't be able to access the following members directly in the child class.
Solution:
import the reference directly
OR
Access using
The following shows typical code from SDK 1.16
The following is the migrated version of above code to SDK 1.17
Last updated