From 03c3b2480d682870603af19bfb1c4f55953f4488 Mon Sep 17 00:00:00 2001 From: Sasikanth Miriyampalli Date: Thu, 12 Oct 2023 13:12:38 +0530 Subject: [PATCH] Update Dagger to v2.47 (#4811) --- app/src/main/java/org/simple/clinic/util/Optional.kt | 2 +- .../clinic/util/preference/MoshiObjectPreferenceConverter.kt | 4 ++-- .../clinic/util/preference/OptionalRxPreferencesConverter.kt | 4 ++-- .../org/simple/clinic/util/preference/RxPreferencesFoo.kt | 2 +- gradle/libs.versions.toml | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/simple/clinic/util/Optional.kt b/app/src/main/java/org/simple/clinic/util/Optional.kt index 249738b9ed0..26658f3c394 100644 --- a/app/src/main/java/org/simple/clinic/util/Optional.kt +++ b/app/src/main/java/org/simple/clinic/util/Optional.kt @@ -16,7 +16,7 @@ import java.util.Optional * This is the preferred method of obtaining an instance of [Optional] in Kotlin. In Java, prefer * using the static [Optional.ofNullable] method. */ -fun T?.toOptional(): Optional = Optional.ofNullable(this) +fun T?.toOptional(): Optional = Optional.ofNullable(this) as Optional /** * Converts [Optional] to either its non-null value if it's non-empty or `null` if it's empty. diff --git a/app/src/main/java/org/simple/clinic/util/preference/MoshiObjectPreferenceConverter.kt b/app/src/main/java/org/simple/clinic/util/preference/MoshiObjectPreferenceConverter.kt index 754922991b3..5c0101b5ace 100644 --- a/app/src/main/java/org/simple/clinic/util/preference/MoshiObjectPreferenceConverter.kt +++ b/app/src/main/java/org/simple/clinic/util/preference/MoshiObjectPreferenceConverter.kt @@ -10,11 +10,11 @@ class MoshiObjectPreferenceConverter( private val adapter = moshi.adapter(clazz) - override fun deserialize(serialized: String): T { + override fun deserialize(serialized: String): T & Any { return adapter.fromJson(serialized)!! } - override fun serialize(value: T): String { + override fun serialize(value: T & Any): String { return adapter.toJson(value) } } diff --git a/app/src/main/java/org/simple/clinic/util/preference/OptionalRxPreferencesConverter.kt b/app/src/main/java/org/simple/clinic/util/preference/OptionalRxPreferencesConverter.kt index f448ed4475a..4e1f5b16567 100644 --- a/app/src/main/java/org/simple/clinic/util/preference/OptionalRxPreferencesConverter.kt +++ b/app/src/main/java/org/simple/clinic/util/preference/OptionalRxPreferencesConverter.kt @@ -7,8 +7,8 @@ class OptionalRxPreferencesConverter(private val valueConverter: Preference.C override fun deserialize(serialized: String): Optional { return when { - serialized.isEmpty() -> Optional.empty() - else -> Optional.of(valueConverter.deserialize(serialized)) + serialized.isEmpty() -> Optional.empty() as Optional + else -> Optional.of(valueConverter.deserialize(serialized)) as Optional } } diff --git a/app/src/main/java/org/simple/clinic/util/preference/RxPreferencesFoo.kt b/app/src/main/java/org/simple/clinic/util/preference/RxPreferencesFoo.kt index 923fd68f0cd..b2d02eede97 100644 --- a/app/src/main/java/org/simple/clinic/util/preference/RxPreferencesFoo.kt +++ b/app/src/main/java/org/simple/clinic/util/preference/RxPreferencesFoo.kt @@ -7,7 +7,7 @@ import java.util.Optional fun RxSharedPreferences.getOptional( key: String, converter: Preference.Converter, - defaultValue: Optional = Optional.empty() + defaultValue: Optional = Optional.empty() as Optional ): Preference> { return getObject(key, defaultValue, OptionalRxPreferencesConverter(converter)) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 96920664b61..47fd52af2cb 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,7 @@ androidx-room = "2.4.3" androidx-work = "2.7.1" androidx-security-crypto = "1.1.0-alpha06" -dagger = "2.44.2" +dagger = "2.47" flipper = "0.176.0"