iterable-android-sdk
iterable-android-sdk copied to clipboard
Complete Java to Kotlin migration for SDK
The session focused on migrating Java files to Kotlin, converting 26 files across the iterableapi/ module.
Key patterns applied include:
- Java enums were converted to Kotlin
enum class(e.g.,AuthFailureReason.java,IterableDataRegion.java). - Data classes were refactored to use primary constructors and
valproperties, maintaining immutability (e.g.,AuthFailure.java,CommerceItem.java). - Interfaces were translated to Kotlin interfaces (e.g.,
IterableAuthHandler.java,IterableCustomActionHandler.java). - Utility classes with static methods were converted to Kotlin
objectdeclarations (e.g.,IOUtils.java,DeviceInfoUtils.java). - Classes with static members and nested classes now utilize
companion object(e.g.,DeviceInfo.java,IterableDatabaseManager.java). - Null safety was introduced using nullable types (
%3F) and safe calls. - Complex builder patterns, notably in
IterableConfig.java, were preserved, ensuring API compatibility. - Annotations like
@RestrictToand@Deprecatedwere retained.
The conversion of IterableConfig.java was a significant milestone, validating the approach for complex classes while maintaining API compatibility. Compilation checks confirmed no Kotlin-related errors, demonstrating successful migration of the selected files.