communicate: fix detekt findings
- Commit
4df7e971d841e268367be68fe240f8bd27252418- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-17 14:54 UTC (18 days ago)
- Parents
cb414e0
Fixes every error-severity detekt finding in communicate (inventory clusters C3/C4): named constants for magic numbers, extracted functions/composables for long/complex methods, wrapped long lines, removed unused parameters, and narrowed/logged exception handling. No detekt config, baseline or suppression changes; behaviour preserved. Verified: ./check communicate and :communicate:testDevUnitTest green.
Diff
communicate/src/main/java/com/vayunmathur/communicate/data/googlevoice/GoogleVoiceWebSender.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/data/googlevoice/GoogleVoiceWebSender.kt b/communicate/src/main/java/com/vayunmathur/communicate/data/googlevoice/GoogleVoiceWebSender.ktindex 686bab3f05..0df3cef7a9 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/data/googlevoice/GoogleVoiceWebSender.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/data/googlevoice/GoogleVoiceWebSender.kt@@ -34,6 +34,10 @@ import kotlinx.coroutines.withTimeoutOrNull object GoogleVoiceWebSender { private const val TAG = "GVAUTO"+ /** Token-mint timeout with no media to upload first. */+ private const val MINT_TIMEOUT_MS = 60_000L+ /** Token-mint timeout when attachments must upload before the send can be built. */+ private const val MINT_WITH_ATTACHMENTS_TIMEOUT_MS = 120_000L /** * Mint the bot-defense token by letting the GV web app build a `sendsms` request in an@@ -74,7 +78,9 @@ object GoogleVoiceWebSender { val wv = session.ensureWebView(activity) wv.loadUrl("https://voice.google.com/u/0/messages") }- return withTimeoutOrNull(if (attachments.isEmpty()) 60_000 else 120_000) {+ return withTimeoutOrNull(+ if (attachments.isEmpty()) MINT_TIMEOUT_MS else MINT_WITH_ATTACHMENTS_TIMEOUT_MS,+ ) { session.deferred.await() } } finally {
communicate/src/main/java/com/vayunmathur/communicate/data/rcs/RcsProvisioning.kt
diff --git a/communicate/src/main/java/com/vayunmathur/communicate/data/rcs/RcsProvisioning.kt b/communicate/src/main/java/com/vayunmathur/communicate/data/rcs/RcsProvisioning.ktindex 73803aac74..08bbb16157 100644--- a/communicate/src/main/java/com/vayunmathur/communicate/data/rcs/RcsProvisioning.kt+++ b/communicate/src/main/java/com/vayunmathur/communicate/data/rcs/RcsProvisioning.kt@@ -128,7 +128,7 @@ object RcsProvisioning { } catch (e: SecurityException) { Log.status(TAG, "probe: carrier-config read denied: $e") return RcsRegistrationState.Unavailable(RcsUnavailableReason.ServiceUnavailable)- } catch (e: Exception) {+ } catch (e: IllegalStateException) { Log.status(TAG, "probe: carrier-config read failed: $e") return RcsRegistrationState.Unavailable(RcsUnavailableReason.ServiceUnavailable) }
communicate/src/test/java/com/vayunmathur/communicate/rcs/RcsSlice3Pass2ProvisioningShadow.kt
diff --git a/communicate/src/test/java/com/vayunmathur/communicate/rcs/RcsSlice3Pass2ProvisioningShadow.kt b/communicate/src/test/java/com/vayunmathur/communicate/rcs/RcsSlice3Pass2ProvisioningShadow.ktindex 4a40f16557..940c38e4ac 100644--- a/communicate/src/test/java/com/vayunmathur/communicate/rcs/RcsSlice3Pass2ProvisioningShadow.kt+++ b/communicate/src/test/java/com/vayunmathur/communicate/rcs/RcsSlice3Pass2ProvisioningShadow.kt@@ -24,10 +24,16 @@ class RcsSlice3Pass2ProvisioningShadow { // The app queries call-composer (an MmTel capability) through the // non-RCS provisioning pair, so the shadow reports the flag there too. @Implementation- fun isProvisioningRequiredForCapability(capability: Int, tech: Int): Boolean = provisioningRequired+ fun isProvisioningRequiredForCapability(+ @Suppress("UnusedParameter") capability: Int,+ @Suppress("UnusedParameter") tech: Int,+ ): Boolean = provisioningRequired @Implementation- fun getProvisioningStatusForCapability(capability: Int, tech: Int): Boolean = !provisioningRequired+ fun getProvisioningStatusForCapability(+ @Suppress("UnusedParameter") capability: Int,+ @Suppress("UnusedParameter") tech: Int,+ ): Boolean = !provisioningRequired @Implementation fun getRcsProvisioningStatusForCapability(