From 5434dc88ef128ea0934ba43e72a506d000a768de Mon Sep 17 00:00:00 2001 From: Denys Bondarenko Date: Fri, 13 Nov 2026 15:09:32 +0200 Subject: [PATCH 1/7] refactor: resolve Kotlin compiler warnings in app code --- .../api/retrofit/okhttp/LoggingInFileInterceptor.kt | 10 +++++----- .../flowcrypt/email/database/dao/AccountAliasesDao.kt | 2 +- .../com/google/api/services/gmail/model/SendAsExt.kt | 5 ++--- .../email/jetpack/viewmodel/AccountAliasesViewModel.kt | 2 +- .../email/jetpack/viewmodel/MessagesViewModel.kt | 4 +--- .../viewmodel/RefreshPrivateKeysFromEkmViewModel.kt | 4 ++-- .../email/jetpack/viewmodel/ThreadDetailsViewModel.kt | 4 ++-- .../email/providers/EmbeddedAttachmentsProvider.kt | 6 +++--- .../ui/activity/fragment/CreateMessageFragment.kt | 6 +++--- .../ui/activity/fragment/ThreadDetailsFragment.kt | 6 +++--- .../ui/activity/fragment/dialog/InfoDialogFragment.kt | 2 +- .../flowcrypt/email/ui/adapter/MsgsPagedListAdapter.kt | 3 --- .../com/flowcrypt/email/util/ProgressOutputStream.kt | 2 +- 13 files changed, 25 insertions(+), 31 deletions(-) diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/api/retrofit/okhttp/LoggingInFileInterceptor.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/api/retrofit/okhttp/LoggingInFileInterceptor.kt index 5a3d297015..9b4bc75774 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/api/retrofit/okhttp/LoggingInFileInterceptor.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/api/retrofit/okhttp/LoggingInFileInterceptor.kt @@ -73,7 +73,7 @@ class LoggingInFileInterceptor constructor(context: Context, fileName: String) : var requestStartMsg = "--> " + request.method + ' '.toString() + request.url + ' '.toString() + protocol if (!logHeaders && hasRequestBody) { - requestStartMsg += " (" + requestBody!!.contentLength() + "-byte body)" + requestStartMsg += " (" + requestBody.contentLength() + "-byte body)" } logger.log(requestStartMsg) @@ -82,7 +82,7 @@ class LoggingInFileInterceptor constructor(context: Context, fileName: String) : // Request body headers are only present when installed as a network interceptor. // Force // them to be included (when available) so there values are known. - if (requestBody!!.contentType() != null) { + if (requestBody.contentType() != null) { logger.log("Content-Type: " + requestBody.contentType()!!) } if (requestBody.contentLength() != (-1).toLong()) { @@ -110,7 +110,7 @@ class LoggingInFileInterceptor constructor(context: Context, fileName: String) : logger.log("--> END " + request.method + " (encoded body omitted)") } else { val buffer = Buffer() - requestBody!!.writeTo(buffer) + requestBody.writeTo(buffer) var charset: Charset? = UTF8 val contentType = requestBody.contentType() @@ -146,7 +146,7 @@ class LoggingInFileInterceptor constructor(context: Context, fileName: String) : val tookMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNs) val responseBody = response.body - val contentLength = responseBody?.contentLength() ?: 0 + val contentLength = responseBody.contentLength() val bodySize = if (contentLength != (-1).toLong()) "$contentLength-byte" else "unknown-length" logger.log( "<-- " + response.code + ' '.toString() + response.message @@ -168,7 +168,7 @@ class LoggingInFileInterceptor constructor(context: Context, fileName: String) : } else if (isBodyEncoded(response.headers)) { logger.log("<-- END HTTP (encoded body omitted)") } else { - val source = responseBody!!.source() + val source = responseBody.source() source.request(java.lang.Long.MAX_VALUE) // Buffer the entire body. val buffer = source.buffer diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/database/dao/AccountAliasesDao.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/database/dao/AccountAliasesDao.kt index 759a6b9f47..3149d60436 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/database/dao/AccountAliasesDao.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/database/dao/AccountAliasesDao.kt @@ -39,7 +39,7 @@ interface AccountAliasesDao : BaseDao { }.toSet() val existingAliases = getAliases( account = accountEntity.email, - accountType = accountEntity.accountType ?: "" + accountType = accountEntity.accountType ) val existingUniqueSendAsSet = existingAliases.map { entity -> entity.sendAsEmail?.lowercase() diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/extensions/com/google/api/services/gmail/model/SendAsExt.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/extensions/com/google/api/services/gmail/model/SendAsExt.kt index f945c4130f..c05dc76b8d 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/extensions/com/google/api/services/gmail/model/SendAsExt.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/extensions/com/google/api/services/gmail/model/SendAsExt.kt @@ -7,7 +7,6 @@ package com.flowcrypt.email.extensions.com.google.api.services.gmail.model import android.accounts.Account import com.flowcrypt.email.database.entity.AccountAliasesEntity -import com.flowcrypt.email.database.entity.AccountEntity import com.google.api.services.gmail.model.SendAs /** @@ -16,7 +15,7 @@ import com.google.api.services.gmail.model.SendAs fun SendAs.toAccountAliasesEntity(account: Account): AccountAliasesEntity { return AccountAliasesEntity( email = account.name.lowercase(), - accountType = account.type ?: AccountEntity.ACCOUNT_TYPE_GOOGLE, + accountType = account.type, sendAsEmail = sendAsEmail?.lowercase(), displayName = displayName, replyToAddress = replyToAddress, @@ -26,4 +25,4 @@ fun SendAs.toAccountAliasesEntity(account: Account): AccountAliasesEntity { treatAsAlias = treatAsAlias, verificationStatus = verificationStatus ) -} \ No newline at end of file +} diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/AccountAliasesViewModel.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/AccountAliasesViewModel.kt index 0c8fefbba7..a23281ac27 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/AccountAliasesViewModel.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/AccountAliasesViewModel.kt @@ -51,7 +51,7 @@ class AccountAliasesViewModel(application: Application) : AccountViewModel(appli val hasAliasesSignature = roomDatabase.accountAliasesDao().getAliases( account = accountEntity.email, - accountType = accountEntity.accountType ?: "" + accountType = accountEntity.accountType ).any { it.signature?.isNotEmpty() == true } if (!hasAliasesSignature) { diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/MessagesViewModel.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/MessagesViewModel.kt index 9bad8f7342..b22a0e42c4 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/MessagesViewModel.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/MessagesViewModel.kt @@ -398,9 +398,7 @@ class MessagesViewModel(application: Application) : AccountViewModel(application if (isOnlyPgpModeEnabled == true) { foundMsgs = imapFolder.search(EmailUtil.genPgpThingsSearchTerm(accountEntity)) - foundMsgs?.let { - msgsCount = foundMsgs.size - } + msgsCount = foundMsgs.size } else { msgsCount = imapFolder.messageCount } diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/RefreshPrivateKeysFromEkmViewModel.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/RefreshPrivateKeysFromEkmViewModel.kt index 2090370cd5..25b84232f2 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/RefreshPrivateKeysFromEkmViewModel.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/RefreshPrivateKeysFromEkmViewModel.kt @@ -96,10 +96,10 @@ class RefreshPrivateKeysFromEkmViewModel(application: Application) : AccountView } } - requireNotNull(ekmPrivateResult.data?.privateKeys) + val privateKeys = requireNotNull(ekmPrivateResult.data?.privateKeys) val pgpKeyRingDetailsList = mutableListOf() - ekmPrivateResult.data?.privateKeys?.forEach { key -> + privateKeys.forEach { key -> val parsedList = PgpKey.parsePrivateKeys(requireNotNull(key.decryptedPrivateKey)) .map { it.copy( diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/ThreadDetailsViewModel.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/ThreadDetailsViewModel.kt index bc98354ae6..5e7eae6a0a 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/ThreadDetailsViewModel.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/ThreadDetailsViewModel.kt @@ -608,7 +608,7 @@ class ThreadDetailsViewModel( return@collectLatest } else { loadMessagesManuallyMutableStateFlow.update { - val existingValue = existingResult.data ?: Data(false, emptyList()) + val existingValue = existingResult.data val updatedList = existingValue.list.toMutableList().apply { replaceAll { item -> if (item.type == MessagesInThreadListAdapter.Type.HEADER) { @@ -732,4 +732,4 @@ class ThreadDetailsViewModel( companion object { val FROM = FROM() } -} \ No newline at end of file +} diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/providers/EmbeddedAttachmentsProvider.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/providers/EmbeddedAttachmentsProvider.kt index 35af0ac35d..786ad9a7e9 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/providers/EmbeddedAttachmentsProvider.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/providers/EmbeddedAttachmentsProvider.kt @@ -111,8 +111,8 @@ class EmbeddedAttachmentsProvider : DocumentsProvider() { val maxMemory = Runtime.getRuntime().maxMemory() val cacheSize = max(maxMemory / 4, FileUtils.ONE_MB * 25).toInt() lruCache = object : LruCache(cacheSize) { - override fun sizeOf(key: String, attachmentInfo: AttachmentInfo): Int { - return attachmentInfo.rawData?.size ?: attachmentInfo.encodedSize.toInt() + override fun sizeOf(key: String, value: AttachmentInfo): Int { + return value.rawData?.size ?: value.encodedSize.toInt() } } } @@ -177,4 +177,4 @@ class EmbeddedAttachmentsProvider : DocumentsProvider() { } } } -} \ No newline at end of file +} diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/CreateMessageFragment.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/CreateMessageFragment.kt index 9b3927197c..32e0d9e2c8 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/CreateMessageFragment.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/CreateMessageFragment.kt @@ -1984,7 +1984,7 @@ class CreateMessageFragment : BaseFragment(), "unknown RecipientType: ${autoCompleteResults?.recipientType}" ) } - val pattern = it.data?.pattern?.lowercase() ?: "" + val pattern = autoCompleteResults.pattern.lowercase() val autoCompleteList = results.map { recipientWithPubKeys -> AutoCompleteResultRecyclerViewAdapter.AutoCompleteItem( @@ -2017,12 +2017,12 @@ class CreateMessageFragment : BaseFragment(), } } - val adapter = when (autoCompleteResults?.recipientType) { + val adapter = when (autoCompleteResults.recipientType) { Message.RecipientType.TO -> toAutoCompleteResultRecyclerViewAdapter Message.RecipientType.CC -> ccAutoCompleteResultRecyclerViewAdapter Message.RecipientType.BCC -> bccAutoCompleteResultRecyclerViewAdapter else -> throw InvalidObjectException( - "unknown RecipientType: ${autoCompleteResults?.recipientType}" + "unknown RecipientType: ${autoCompleteResults.recipientType}" ) } adapter.submitList(finalList) diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/ThreadDetailsFragment.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/ThreadDetailsFragment.kt index 674954e964..86498e7f9a 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/ThreadDetailsFragment.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/ThreadDetailsFragment.kt @@ -638,9 +638,9 @@ class ThreadDetailsFragment : BaseFragment(), Prog val hasUnverifiedSignatures = message.incomingMessageInfo?.verificationResult?.hasUnverifiedSignatures == true val hasActiveSignatureVerification = if (hasUnverifiedSignatures) { - val messageFromAddresses = message.incomingMessageInfo?.getFrom()?.map { + val messageFromAddresses = message.incomingMessageInfo.getFrom().map { it.address.lowercase() - } ?: emptyList() + } val alreadyCheckedFromAddresses = threadDetailsViewModel.sessionFromRecipientsStateFlow.value.filter { @@ -1592,4 +1592,4 @@ class ThreadDetailsFragment : BaseFragment(), Prog private const val CONTENT_MAX_ALLOWED_LENGTH = 50000 } -} \ No newline at end of file +} diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/dialog/InfoDialogFragment.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/dialog/InfoDialogFragment.kt index 1dfa7ee158..1e7e58c5e7 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/dialog/InfoDialogFragment.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/dialog/InfoDialogFragment.kt @@ -83,7 +83,7 @@ class InfoDialogFragment : BaseDialogFragment() { override fun onResume() { super.onResume() if (!args.useWebViewToRender) { - val textView = dialog?.window?.decorView?.findViewById(android.R.id.message) as? TextView + val textView = dialog?.window?.decorView?.findViewById(android.R.id.message) textView?.setTextIsSelectable(true) } } diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/ui/adapter/MsgsPagedListAdapter.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/ui/adapter/MsgsPagedListAdapter.kt index 4b33a6080e..3771d2f154 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/ui/adapter/MsgsPagedListAdapter.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/ui/adapter/MsgsPagedListAdapter.kt @@ -443,9 +443,6 @@ class MsgsPagedListAdapter(private val onMessageClickListener: OnMessageClickLis MessageState.ERROR_PASSWORD_PROTECTED -> state = context.getString(R.string.can_not_send_password_protected) - - else -> { - } } } diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/util/ProgressOutputStream.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/util/ProgressOutputStream.kt index 706bcf439d..d2887ff671 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/util/ProgressOutputStream.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/util/ProgressOutputStream.kt @@ -15,7 +15,7 @@ import java.io.OutputStream * * @author Denys Bondarenko */ -class ProgressOutputStream(val out: OutputStream) : BufferedOutputStream(out) { +class ProgressOutputStream(out: OutputStream) : BufferedOutputStream(out) { override fun write(b: ByteArray) { if (Thread.interrupted()) { throw SyncTaskTerminatedException() From 73788b67ac36a5f845162b9080583feae7ca1fbe Mon Sep 17 00:00:00 2001 From: Denys Bondarenko Date: Fri, 13 Nov 2026 15:09:44 +0200 Subject: [PATCH 2/7] test: remove redundant null checks in UI tests --- .../com/flowcrypt/email/ui/ComposeScreenReplyAllFlowTest.kt | 2 +- .../java/com/flowcrypt/email/ui/base/BaseGmailApiTest.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/ComposeScreenReplyAllFlowTest.kt b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/ComposeScreenReplyAllFlowTest.kt index 709b2f9be3..238cf4ec6e 100644 --- a/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/ComposeScreenReplyAllFlowTest.kt +++ b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/ComposeScreenReplyAllFlowTest.kt @@ -48,7 +48,7 @@ class ComposeScreenReplyAllFlowTest : BaseTest() { private val account = AccountDaoManager.getDefaultAccountDao() private val accountAliasesEntity = AccountAliasesEntity( email = account.email, - accountType = account.accountType ?: "", + accountType = account.accountType, sendAsEmail = "alias@flowcrypt.test", displayName = "Alias", isDefault = true, diff --git a/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/base/BaseGmailApiTest.kt b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/base/BaseGmailApiTest.kt index e6961557ec..c20a180f4f 100644 --- a/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/base/BaseGmailApiTest.kt +++ b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/base/BaseGmailApiTest.kt @@ -448,7 +448,7 @@ abstract class BaseGmailApiTest(val accountEntity: AccountEntity = BASE_ACCOUNT_ append(it.first + ": " + it.second + "\n") } append("\n") - append(response.body?.string()) + append(response.body.string()) } responseMimeMultipart.addBodyPart( From f952e84d8d037735148ac0600892de1ac878f448 Mon Sep 17 00:00:00 2001 From: Denys Bondarenko Date: Fri, 13 Nov 2026 15:09:44 +0200 Subject: [PATCH 3/7] test: verify stored revoked key after recipient lookup Read the key from the recipient queried after lookup instead of reusing the pre-lookup record, so the assertion checks that the stored key remains revoked. --- .../email/ui/ComposeScreenDisallowUpdateRevokedKeyFlowTest.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/ComposeScreenDisallowUpdateRevokedKeyFlowTest.kt b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/ComposeScreenDisallowUpdateRevokedKeyFlowTest.kt index 4aa4e36b00..46231dd872 100644 --- a/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/ComposeScreenDisallowUpdateRevokedKeyFlowTest.kt +++ b/FlowCrypt/src/androidTest/java/com/flowcrypt/email/ui/ComposeScreenDisallowUpdateRevokedKeyFlowTest.kt @@ -127,7 +127,7 @@ class ComposeScreenDisallowUpdateRevokedKeyFlowTest : BaseComposeScreenTest() { val existingRecipientAfter = roomDatabase.recipientDao() .getRecipientWithPubKeysByEmail(userWithRevokedKey) assertNotNull(existingRecipientAfter) - val pubKeyAfter = requireNotNull(existingRecipientBefore?.publicKeys?.first()?.publicKey) + val pubKeyAfter = requireNotNull(existingRecipientAfter).publicKeys.first().publicKey val pgpKeyDetailsAfter = PgpKey.parseKeys(pubKeyAfter) .pgpKeyRingCollection.pgpPublicKeyRingCollection.first().toPgpKeyRingDetails() assertTrue(pgpKeyDetailsAfter.isRevoked) From bd76347ff778ca1e487b846ef46f6088baba615a Mon Sep 17 00:00:00 2001 From: Denys Bondarenko Date: Fri, 13 Nov 2026 15:09:45 +0200 Subject: [PATCH 4/7] build: replace grgit with Gradle Git providers Read the commit hash and branch through providers.exec to avoid deprecated process execution during configuration while preserving the debug version suffix and release branch check. --- FlowCrypt/build.gradle.kts | 15 ++++++++++++--- build.gradle.kts | 1 - 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/FlowCrypt/build.gradle.kts b/FlowCrypt/build.gradle.kts index 68b2be294e..7a1348ca0e 100644 --- a/FlowCrypt/build.gradle.kts +++ b/FlowCrypt/build.gradle.kts @@ -21,9 +21,18 @@ plugins { id("com.starter.easylauncher") id("kotlin-parcelize") id("com.google.devtools.ksp") - id("org.ajoberstar.grgit") } +val gitCommitId = providers.exec { + workingDir(rootProject.rootDir) + commandLine("git", "rev-parse", "HEAD") +}.standardOutput.asText.map { it.trim().take(7) } + +val gitBranchName = providers.exec { + workingDir(rootProject.rootDir) + commandLine("git", "rev-parse", "--abbrev-ref", "HEAD") +}.standardOutput.asText.map { it.trim() } + val keystoreProperties = Properties() val propertiesFile = project.file("keystore.properties") if (propertiesFile.exists()) { @@ -111,7 +120,7 @@ android { versionNameSuffix = "_" + defaultConfig.versionCode + "__" + SimpleDateFormat("yyyy_MM_dd").format(Date()) + - "__" + grgit.head().id.substring(0, 7) + "__" + gitCommitId.get() applicationIdSuffix = ".debug" signingConfig = signingConfigs.getByName("debug") @@ -420,7 +429,7 @@ easylauncher { } tasks.register("checkCorrectBranch") { - if (!grgit.branch.current().name.equals("master")) { + if (gitBranchName.get() != "master") { throw GradleException("Please use 'master' branch to generate a release build") } } diff --git a/build.gradle.kts b/build.gradle.kts index 35c9b55cdd..bf312d100c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,5 +12,4 @@ plugins { id("com.starter.easylauncher") version "6.4.1" apply false id("org.jetbrains.kotlin.plugin.parcelize") version "2.4.21" apply false id("com.google.devtools.ksp") version "2.3.12" apply false - id("org.ajoberstar.grgit") version "5.3.3" apply false } From 897c2715b776da37bbd73eae036cffad89e936c7 Mon Sep 17 00:00:00 2001 From: Denys Bondarenko Date: Fri, 13 Nov 2026 15:09:45 +0200 Subject: [PATCH 5/7] build: document remaining Safe Args and KSP warnings --- build.gradle.kts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index bf312d100c..2169ac571e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,8 +8,12 @@ apply(from = "$rootDir/ext.gradle.kts") plugins { id("com.android.application") version "9.5.1" apply false + // Safe Args still emits casts suppressed as CAST_NEVER_SUCCEEDS; Kotlin reports them as + // UNSAFE_CAST_RELYING_ON_NULL. Keep these warnings visible until the generator is fixed. id("androidx.navigation.safeargs.kotlin") version "2.10.2" apply false id("com.starter.easylauncher") version "6.4.1" apply false id("org.jetbrains.kotlin.plugin.parcelize") version "2.4.21" apply false + // 2.3.13 removes deprecated Configuration.setVisible calls, but has a concurrency regression: + // https://github.com/google/ksp/issues/3286 id("com.google.devtools.ksp") version "2.3.12" apply false } From 77610b0a2afa0c4d4251d47ea4546645fae0d3b1 Mon Sep 17 00:00:00 2001 From: Denys Bondarenko Date: Fri, 13 Nov 2026 20:06:07 +0200 Subject: [PATCH 6/7] build: fix remaining Gradle deprecations --- FlowCrypt/build.gradle.kts | 47 ++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/FlowCrypt/build.gradle.kts b/FlowCrypt/build.gradle.kts index 7a1348ca0e..988f2dcf51 100644 --- a/FlowCrypt/build.gradle.kts +++ b/FlowCrypt/build.gradle.kts @@ -5,6 +5,7 @@ import com.android.build.api.artifact.SingleArtifact +import com.android.build.api.dsl.ApplicationBuildType import com.android.build.api.variant.ResValue import com.android.ddmlib.DdmPreferences import java.io.FileInputStream @@ -67,7 +68,6 @@ android { versionName = rootProject.extra["appVersionName"] as String testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" buildConfigField("int", "MIN_SDK_VERSION", "$minSdk") - multiDexEnabled = true } signingConfigs { @@ -115,25 +115,33 @@ android { signingConfig = signingConfigs.getByName("release") } - getByName("debug") { + // Shared by debug and uiTests. uiTests doesn't use initWith(debug) because overriding + // inherited resValues triggers the AGP RES_VALUE_REPLACED warning. + fun ApplicationBuildType.configureDebuggable(isHttpLogEnabled: Boolean) { isDebuggable = true - versionNameSuffix = "_" + - defaultConfig.versionCode + - "__" + SimpleDateFormat("yyyy_MM_dd").format(Date()) + - "__" + gitCommitId.get() + isCrunchPngs = false applicationIdSuffix = ".debug" signingConfig = signingConfigs.getByName("debug") + val httpLogLevel = if (isHttpLogEnabled) "BODY" else "NONE" buildConfigField("boolean", "IS_ACRA_ENABLED", "false") - buildConfigField("boolean", "IS_HTTP_LOG_ENABLED", "true") - buildConfigField("String", "HTTP_LOG_LEVEL", "\"BODY\"") + buildConfigField("boolean", "IS_HTTP_LOG_ENABLED", isHttpLogEnabled.toString()) + buildConfigField("String", "HTTP_LOG_LEVEL", "\"$httpLogLevel\"") resValue("string", "gradle_is_acra_enabled", "false") - resValue("string", "gradle_is_http_log_enabled", "true") - resValue("string", "gradle_http_log_level", "BODY") + resValue("string", "gradle_is_http_log_enabled", isHttpLogEnabled.toString()) + resValue("string", "gradle_http_log_level", httpLogLevel) + } + + getByName("debug") { + configureDebuggable(isHttpLogEnabled = true) + versionNameSuffix = "_" + + defaultConfig.versionCode + + "__" + SimpleDateFormat("yyyy_MM_dd").format(Date()) + + "__" + gitCommitId.get() } create("uiTests") { - initWith(getByName("debug")) + configureDebuggable(isHttpLogEnabled = false) versionNameSuffix = "_test_" + defaultConfig.versionCode + "__" + SimpleDateFormat("yyyy_MM_dd").format(Date()) buildConfigField("String", "ATTESTER_URL", "\"https://flowcrypt.test/attester/\"") @@ -142,17 +150,13 @@ android { "SHARED_TENANT_FES_URL", "\"https://flowcrypt.test/shared-tenant-fes/\"" ) - buildConfigField("boolean", "IS_HTTP_LOG_ENABLED", "false") - buildConfigField("String", "HTTP_LOG_LEVEL", "\"NONE\"") - resValue("string", "gradle_is_http_log_enabled", "false") - resValue("string", "gradle_http_log_level", "NONE") } } testBuildType = "uiTests" sourceSets { - getByName("androidTest").assets.srcDir("$projectDir/schemas") + getByName("androidTest").assets.directories += "$projectDir/schemas" } flavorDimensions += "standard" @@ -429,8 +433,11 @@ easylauncher { } tasks.register("checkCorrectBranch") { - if (gitBranchName.get() != "master") { - throw GradleException("Please use 'master' branch to generate a release build") + val branchName = gitBranchName + doLast { + if (branchName.get() != "master") { + throw GradleException("Please use 'master' branch to generate a release build") + } } } @@ -458,8 +465,8 @@ tasks.register("copyReleaseApks") { } } -val devDebugImplementation: Configuration by configurations.creating -val uiTestsImplementation by configurations.named("uiTestsImplementation") +val devDebugImplementation = configurations.create("devDebugImplementation") +val uiTestsImplementation = configurations.named("uiTestsImplementation") dependencies { ksp("com.github.bumptech.glide:ksp:5.0.9") From 2f23855aee1f751d4f81ed378adc10d2c7ffe9e9 Mon Sep 17 00:00:00 2001 From: Denys Bondarenko Date: Tue, 17 Nov 2026 15:29:12 +0200 Subject: [PATCH 7/7] build: bump KSP to 2.3.14 --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index ab6defc899..f262decbd2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,5 +13,5 @@ plugins { id("androidx.navigation.safeargs.kotlin") version "2.10.2" apply false id("com.starter.easylauncher") version "6.4.1" apply false id("org.jetbrains.kotlin.plugin.parcelize") version "2.4.21" apply false - id("com.google.devtools.ksp") version "2.3.13" apply false + id("com.google.devtools.ksp") version "2.3.14" apply false }