diff --git a/app/build.gradle b/app/build.gradle index 68537ee2..44734271 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,13 +3,14 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { - compileSdkVersion 31 - buildToolsVersion "30.0.3" + compileSdk 34 + + namespace = "com.gojek.courier.app" defaultConfig { applicationId "com.gojek.courier.app" minSdkVersion 21 - targetSdkVersion 31 + targetSdkVersion 34 versionCode 1 versionName "1.0" multiDexEnabled true diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 14b0f7c3..dedf0152 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -34,8 +34,8 @@ plugins { } dependencies { - implementation("com.android.tools.build:gradle:7.0.3") - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31") + implementation("com.android.tools.build:gradle:7.4.2") + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21") implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.18.0") implementation("com.diffplug.spotless:spotless-plugin-gradle:6.5.0") } diff --git a/buildSrc/src/main/kotlin/deps.kt b/buildSrc/src/main/kotlin/deps.kt index fa26f2b9..6f2a86bd 100644 --- a/buildSrc/src/main/kotlin/deps.kt +++ b/buildSrc/src/main/kotlin/deps.kt @@ -4,8 +4,8 @@ object versions { const val jacoco = "0.8.6" const val detekt = "1.18.0" - const val kotlin = "1.4.30" - const val agp = "7.0.3" + const val kotlin = "1.6.21" + const val agp = "7.4.2" const val jetifierProcessor = "1.0.0-beta10" const val jfrogBuildInfoExtractor = "4.11.0" const val navigation = "2.1.0-rc01" @@ -30,7 +30,7 @@ object versions { const val materialVersion = "1.3.0" const val annotationVersion = "1.2.0" const val coreKtxVersion = "1.3.0" - const val apiValidator = "0.6.0" + const val apiValidator = "0.14.0" const val workManager = "2.7.0" } @@ -45,11 +45,11 @@ object deps { const val protobuf = "com.google.protobuf:protobuf-lite:3.0.0" object build { - const val buildToolsVersion = "31.0.0" - const val compileSdkVersion = 31 + const val buildToolsVersion = "33.0.1" + const val compileSdkVersion = 34 const val minSdkVersion = 21 const val sampleMinSdkVersion = 21 - const val targetSdkVersion = 31 + const val targetSdkVersion = 34 } object test { diff --git a/courier-core-android/api/courier-core-android.api b/courier-core-android/api/courier-core-android.api index 540edd8d..e69de29b 100644 --- a/courier-core-android/api/courier-core-android.api +++ b/courier-core-android/api/courier-core-android.api @@ -1,3 +0,0 @@ -public final class com/gojek/courier/utils/extensions/PendingIntentExtensionsKt { -} - diff --git a/courier-core/api/courier-core.api b/courier-core/api/courier-core.api index 21f4bfd6..3b438791 100644 --- a/courier-core/api/courier-core.api +++ b/courier-core/api/courier-core.api @@ -72,12 +72,6 @@ public final class com/gojek/courier/extensions/CollectionExtensionsKt { public static final fun toImmutableSet (Ljava/util/Set;)Ljava/util/Set; } -public final class com/gojek/courier/extensions/StringExtensionsKt { -} - -public final class com/gojek/courier/extensions/TimeUnitExtensionsKt { -} - public abstract interface class com/gojek/courier/logging/ILogger { public abstract fun d (Ljava/lang/String;Ljava/lang/String;)V public abstract fun d (Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V @@ -92,6 +86,3 @@ public abstract interface class com/gojek/courier/logging/ILogger { public abstract fun w (Ljava/lang/String;Ljava/lang/Throwable;)V } -public final class com/gojek/courier/utils/TypeUtils { -} - diff --git a/docs/docs/Installation.md b/docs/docs/Installation.md index 447acb62..951a8426 100644 --- a/docs/docs/Installation.md +++ b/docs/docs/Installation.md @@ -3,8 +3,8 @@ ## Supported SDK versions - minSdkVersion: 21 -- targetSdkVersion: 31 -- compileSdkVersion: 31 +- targetSdkVersion: 34 +- compileSdkVersion: 34 ## Download [![Maven Central](https://img.shields.io/maven-central/v/com.gojek.courier/courier.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.gojek.courier%22%20AND%20a:%courier%22) diff --git a/gradle/ci-configs/gradle-wrapper.properties b/gradle/ci-configs/gradle-wrapper.properties index ab716dda..53d86592 100644 --- a/gradle/ci-configs/gradle-wrapper.properties +++ b/gradle/ci-configs/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip \ No newline at end of file +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index db449532..49ac158f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.4-bin.zip diff --git a/pingsender/alarm-pingsender/src/main/java/com/gojek/alarm/pingsender/AdaptiveAlarmPingSender.kt b/pingsender/alarm-pingsender/src/main/java/com/gojek/alarm/pingsender/AdaptiveAlarmPingSender.kt index 41789f13..77c8bb49 100644 --- a/pingsender/alarm-pingsender/src/main/java/com/gojek/alarm/pingsender/AdaptiveAlarmPingSender.kt +++ b/pingsender/alarm-pingsender/src/main/java/com/gojek/alarm/pingsender/AdaptiveAlarmPingSender.kt @@ -103,8 +103,8 @@ internal class AdaptiveAlarmPingSender( applicationContext.getSystemService(Service.ALARM_SERVICE) as AlarmManager // pending intent can be null if we get a security exception in onstart-->defensive check - if (pendingIntent != null) { - alarmManager.cancel(pendingIntent) + pendingIntent?.let { + alarmManager.cancel(it) } } catch (ex: Exception) { logger.d(TAG, "Unregister alarmreceiver to MqttService$ex") @@ -147,21 +147,23 @@ internal class AdaptiveAlarmPingSender( applicationContext.getSystemService(Service.ALARM_SERVICE) as AlarmManager val alarmType = getAlarmType() val isMqttAllowWhileIdle = pingSenderConfig.isMqttAllowWhileIdle - if (isMqttAllowWhileIdle && buildInfoProvider.isMarshmallowOrHigher) { - alarmManager.setExactAndAllowWhileIdle( - alarmType, - nextAlarmInMilliseconds, - pendingIntent - ) - } else if (buildInfoProvider.isKitkatOrHigher) { - alarmManager.setExact( - alarmType, - nextAlarmInMilliseconds, - pendingIntent - ) - } else { - alarmManager[alarmType, nextAlarmInMilliseconds] = - pendingIntent + pendingIntent?.let { pendingIntent -> + if (isMqttAllowWhileIdle && buildInfoProvider.isMarshmallowOrHigher) { + alarmManager.setExactAndAllowWhileIdle( + alarmType, + nextAlarmInMilliseconds, + pendingIntent + ) + } else if (buildInfoProvider.isKitkatOrHigher) { + alarmManager.setExact( + alarmType, + nextAlarmInMilliseconds, + pendingIntent + ) + } else { + alarmManager[alarmType, nextAlarmInMilliseconds] = + pendingIntent + } } } catch (ex: Exception) { logger.d( diff --git a/pingsender/alarm-pingsender/src/main/java/com/gojek/alarm/pingsender/AlarmPingSender.kt b/pingsender/alarm-pingsender/src/main/java/com/gojek/alarm/pingsender/AlarmPingSender.kt index 86cedbd4..07d11ce7 100644 --- a/pingsender/alarm-pingsender/src/main/java/com/gojek/alarm/pingsender/AlarmPingSender.kt +++ b/pingsender/alarm-pingsender/src/main/java/com/gojek/alarm/pingsender/AlarmPingSender.kt @@ -92,8 +92,8 @@ internal class AlarmPingSender( applicationContext.getSystemService(Service.ALARM_SERVICE) as AlarmManager // pending intent can be null if we get a security exception in onstart-->defensive check - if (pendingIntent != null) { - alarmManager.cancel(pendingIntent) + pendingIntent?.let { + alarmManager.cancel(it) } } catch (ex: Exception) { logger.d(TAG, "Unregister alarmreceiver to MqttService$ex") @@ -133,23 +133,25 @@ internal class AlarmPingSender( applicationContext.getSystemService(Service.ALARM_SERVICE) as AlarmManager val alarmType = getAlarmType() val isMqttAllowWhileIdle = alarmPingSenderConfig.isMqttAllowWhileIdle - if (isMqttAllowWhileIdle && buildInfoProvider.isMarshmallowOrHigher) { - alarmManager.setExactAndAllowWhileIdle( - alarmType, - nextAlarmInMilliseconds, - pendingIntent - ) - } else if (buildInfoProvider.isKitkatOrHigher) { - alarmManager.setExact( - alarmType, - nextAlarmInMilliseconds, - pendingIntent - ) - } else { - alarmManager[alarmType, nextAlarmInMilliseconds] = - pendingIntent + pendingIntent?.let { pendingIntent -> + if (isMqttAllowWhileIdle && buildInfoProvider.isMarshmallowOrHigher) { + alarmManager.setExactAndAllowWhileIdle( + alarmType, + nextAlarmInMilliseconds, + pendingIntent + ) + } else if (buildInfoProvider.isKitkatOrHigher) { + alarmManager.setExact( + alarmType, + nextAlarmInMilliseconds, + pendingIntent + ) + } else { + alarmManager[alarmType, nextAlarmInMilliseconds] = + pendingIntent + } + pingSenderEvents.mqttPingScheduled(delayInMilliseconds.fromMillisToSeconds(), comms.keepAlive.fromMillisToSeconds()) } - pingSenderEvents.mqttPingScheduled(delayInMilliseconds.fromMillisToSeconds(), comms.keepAlive.fromMillisToSeconds()) } catch (ex: Exception) { logger.d( TAG, diff --git a/pingsender/mqtt-pingsender/api/mqtt-pingsender.api b/pingsender/mqtt-pingsender/api/mqtt-pingsender.api index 7debc9dc..b486295d 100644 --- a/pingsender/mqtt-pingsender/api/mqtt-pingsender.api +++ b/pingsender/mqtt-pingsender/api/mqtt-pingsender.api @@ -1,9 +1,6 @@ public abstract interface class com/gojek/mqtt/pingsender/AdaptiveMqttPingSender : com/gojek/mqtt/pingsender/MqttPingSender { } -public final class com/gojek/mqtt/pingsender/KeepAliveKt { -} - public abstract interface class com/gojek/mqtt/pingsender/MqttPingSender { public abstract fun init (Lorg/eclipse/paho/client/mqttv3/internal/ClientComms;Lorg/eclipse/paho/client/mqttv3/ILogger;)V public abstract fun schedule (J)V @@ -11,6 +8,3 @@ public abstract interface class com/gojek/mqtt/pingsender/MqttPingSender { public abstract fun stop ()V } -public final class com/gojek/mqtt/pingsender/MqttPingSenderKt { -} -