diff --git a/build.gradle.kts b/build.gradle.kts index f80c94a03..392868056 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ plugins { alias(libs.plugins.ksp).apply(false) alias(libs.plugins.test).apply(false) alias(libs.plugins.spotless).apply(false) - alias(libs.plugins.dokka).apply(false) + alias(libs.plugins.dokka) } val Project.composeMetricsDir get() = layout.buildDirectory.asFile.get().absolutePath + "/compose_metrics" diff --git a/common/src/main/java/com/funkymuse/common/InMemoryCache.kt b/common/src/main/java/com/funkymuse/common/InMemoryCache.kt index 4a53137f1..3f7b98524 100644 --- a/common/src/main/java/com/funkymuse/common/InMemoryCache.kt +++ b/common/src/main/java/com/funkymuse/common/InMemoryCache.kt @@ -20,17 +20,12 @@ object InMemoryCache { /** * get the saved value addressed by the key */ - fun get(key: String): Any? = map[key] + operator fun get(key: String): Any? = map[key] /** * check if have the value on the Given Key */ - fun have(key: String) = map.containsKey(key) - - /** - * check if have the value on the Given Key - */ - fun contains(key: String) = have(key) + fun contains(key: String) = map.containsKey(key) /** * Clear all the InMemoryCache @@ -55,7 +50,7 @@ object InMemoryCache { /** * get Saved Data from memory, null if it os not exists */ -fun getFromMemory(key: String): T? = InMemoryCache.get(key) as? T +fun getFromMemory(key: String): T? = InMemoryCache[key] as? T /** diff --git a/common/src/main/java/com/funkymuse/common/device/DefaultUserAgent.kt b/common/src/main/java/com/funkymuse/common/device/DefaultUserAgent.kt index db1d5cf92..6b422096f 100644 --- a/common/src/main/java/com/funkymuse/common/device/DefaultUserAgent.kt +++ b/common/src/main/java/com/funkymuse/common/device/DefaultUserAgent.kt @@ -14,7 +14,8 @@ object DefaultUserAgent { var ua: String try { val constructor = WebSettings::class.java.getDeclaredConstructor( - Context::class.java, WebView::class.java) + Context::class.java, WebView::class.java + ) constructor.isAccessible = true try { val settings = constructor.newInstance(context, null) @@ -29,18 +30,18 @@ object DefaultUserAgent { } @SuppressLint("NewApi") - private fun getWebSettingsDefaultUserAgent(context: Context): String { - return WebSettings.getDefaultUserAgent(context) - } + fun getWebSettingsDefaultUserAgent(context: Context): String = + WebSettings.getDefaultUserAgent(context) @SuppressLint("PrivateApi") - private fun getUserAgent(context: Context): String { + fun getUserAgent(context: Context): String { var userAgent: String try { @Suppress("UNCHECKED_CAST") val clz = Class.forName("android.webkit.WebSettingsClassic") as Class val constructor = clz.getDeclaredConstructor( - Context::class.java, Class.forName("android.webkit.WebViewClassic")) + Context::class.java, Class.forName("android.webkit.WebViewClassic") + ) constructor.isAccessible = true try { val settings = constructor.newInstance(context, null)