From a4914ff5278557fbbc9f34a7b7c6835a97ff8633 Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 12:14:45 +0100 Subject: [PATCH 01/37] Prepare for version 6.503 --- app/k9mail/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/k9mail/build.gradle b/app/k9mail/build.gradle index c41b5fec58..ec5a9581da 100644 --- a/app/k9mail/build.gradle +++ b/app/k9mail/build.gradle @@ -50,7 +50,7 @@ android { testApplicationId "com.fsck.k9.tests" versionCode 35002 - versionName '6.502' + versionName '6.503-SNAPSHOT' // Keep in sync with the resource string array 'supported_languages' resConfigs "in", "br", "ca", "cs", "cy", "da", "de", "et", "en", "en_GB", "es", "eo", "eu", "fr", "gd", "gl", -- GitLab From a3f6995a2e9d5df62cd52f6ed1c410bba13a97a8 Mon Sep 17 00:00:00 2001 From: Bastian Wilhelm Date: Sun, 8 Jan 2023 03:14:00 +0100 Subject: [PATCH 02/37] Migrate to Gradle's version catalog --- app/autodiscovery/api/build.gradle | 8 +- app/autodiscovery/providersxml/build.gradle | 24 ++-- app/autodiscovery/srvrecords/build.gradle | 18 +-- app/autodiscovery/thunderbird/build.gradle | 22 +-- app/core/build.gradle | 54 +++---- app/crypto-openpgp/build.gradle | 10 +- app/html-cleaner/build.gradle | 14 +- app/k9mail/build.gradle | 38 ++--- app/storage/build.gradle | 34 ++--- app/testing/build.gradle | 16 ++- app/ui/base/build.gradle | 26 ++-- app/ui/legacy/build.gradle | 94 ++++++------ app/ui/message-list-widget/build.gradle | 8 +- app/ui/setup/build.gradle | 34 ++--- backend/api/build.gradle | 8 +- backend/demo/build.gradle | 22 +-- backend/imap/build.gradle | 20 +-- backend/jmap/build.gradle | 22 +-- backend/pop3/build.gradle | 12 +- backend/testing/build.gradle | 12 +- backend/webdav/build.gradle | 12 +- build.gradle | 125 +++++----------- cli/html-cleaner-cli/build.gradle | 10 +- mail/common/build.gradle | 32 +++-- mail/protocols/imap/build.gradle | 28 ++-- mail/protocols/pop3/build.gradle | 22 +-- mail/protocols/smtp/build.gradle | 22 +-- mail/protocols/webdav/build.gradle | 18 +-- mail/testing/build.gradle | 12 +- .../openpgp-api-lib/openpgp-api/build.gradle | 10 +- settings.gradle | 135 ++++++++++++++++++ ui-utils/ItemTouchHelper/build.gradle | 6 +- ui-utils/LinearLayoutManager/build.gradle | 6 +- 33 files changed, 535 insertions(+), 399 deletions(-) diff --git a/app/autodiscovery/api/build.gradle b/app/autodiscovery/api/build.gradle index 13eabe22f4..aa86ea20a9 100644 --- a/app/autodiscovery/api/build.gradle +++ b/app/autodiscovery/api/build.gradle @@ -1,6 +1,8 @@ -apply plugin: 'java-library' -apply plugin: 'kotlin' -apply plugin: 'com.android.lint' +plugins { + id 'java-library' + id 'kotlin' + alias(libs.plugins.android.lint) +} dependencies { api project(":mail:common") diff --git a/app/autodiscovery/providersxml/build.gradle b/app/autodiscovery/providersxml/build.gradle index 1ac5253462..65ba3c5878 100644 --- a/app/autodiscovery/providersxml/build.gradle +++ b/app/autodiscovery/providersxml/build.gradle @@ -1,23 +1,25 @@ -apply plugin: 'com.android.library' -apply plugin: 'org.jetbrains.kotlin.android' +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) +} dependencies { implementation project(":app:core") implementation project(":mail:common") implementation project(":app:autodiscovery:api") - implementation "com.jakewharton.timber:timber:${versions.timber}" + implementation libs.timber testImplementation project(':app:testing') testImplementation project(":backend:imap") - testImplementation "org.robolectric:robolectric:${versions.robolectric}" - testImplementation "androidx.test:core:${versions.androidxTestCore}" - testImplementation "junit:junit:${versions.junit}" - testImplementation "com.google.truth:truth:${versions.truth}" - testImplementation "org.mockito:mockito-inline:${versions.mockito}" - testImplementation "org.mockito.kotlin:mockito-kotlin:${versions.mockitoKotlin}" - testImplementation "io.insert-koin:koin-test:${versions.koin}" - testImplementation "io.insert-koin:koin-test-junit4:${versions.koin}" + testImplementation libs.robolectric + testImplementation libs.androidx.test.core + testImplementation libs.junit + testImplementation libs.truth + testImplementation libs.mockito.inline + testImplementation libs.mockito.kotlin + testImplementation libs.koin.test + testImplementation libs.koin.test.junit4 } android { diff --git a/app/autodiscovery/srvrecords/build.gradle b/app/autodiscovery/srvrecords/build.gradle index 6ef976c06f..70202b62f9 100644 --- a/app/autodiscovery/srvrecords/build.gradle +++ b/app/autodiscovery/srvrecords/build.gradle @@ -1,14 +1,16 @@ -apply plugin: 'java-library' -apply plugin: 'kotlin' -apply plugin: 'com.android.lint' +plugins { + id 'java-library' + id 'kotlin' + alias(libs.plugins.android.lint) +} dependencies { api project(":app:autodiscovery:api") - implementation "org.minidns:minidns-hla:${versions.minidns}" + implementation libs.minidns.hla - testImplementation "junit:junit:${versions.junit}" - testImplementation "com.google.truth:truth:${versions.truth}" - testImplementation "org.mockito:mockito-inline:${versions.mockito}" - testImplementation "org.mockito.kotlin:mockito-kotlin:${versions.mockitoKotlin}" + testImplementation libs.junit + testImplementation libs.truth + testImplementation libs.mockito.inline + testImplementation libs.mockito.kotlin } diff --git a/app/autodiscovery/thunderbird/build.gradle b/app/autodiscovery/thunderbird/build.gradle index 6f76f4e1ec..5c0d62966d 100644 --- a/app/autodiscovery/thunderbird/build.gradle +++ b/app/autodiscovery/thunderbird/build.gradle @@ -1,16 +1,18 @@ -apply plugin: 'java-library' -apply plugin: 'kotlin' -apply plugin: 'com.android.lint' +plugins { + id 'java-library' + id 'kotlin' + alias(libs.plugins.android.lint) +} dependencies { api project(":app:autodiscovery:api") - compileOnly 'com.github.cketti:xmlpull-extracted-from-android:1.0' - implementation "com.squareup.okhttp3:okhttp:${versions.okhttp}" + compileOnly libs.xmlpull.extracted.from.android + implementation libs.okhttp - testImplementation "junit:junit:${versions.junit}" - testImplementation "com.google.truth:truth:${versions.truth}" - testImplementation "org.mockito:mockito-inline:${versions.mockito}" - testImplementation "org.mockito.kotlin:mockito-kotlin:${versions.mockitoKotlin}" - testImplementation 'com.github.cketti:kxml2-extracted-from-android:1.0' + testImplementation libs.junit + testImplementation libs.truth + testImplementation libs.mockito.inline + testImplementation libs.mockito.kotlin + testImplementation libs.kxml2.extracted.from.android } diff --git a/app/core/build.gradle b/app/core/build.gradle index b9f479ea79..e688309ebb 100644 --- a/app/core/build.gradle +++ b/app/core/build.gradle @@ -1,6 +1,8 @@ -apply plugin: 'com.android.library' -apply plugin: 'org.jetbrains.kotlin.android' -apply plugin: 'org.jetbrains.kotlin.plugin.parcelize' +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.parcelize) +} dependencies { api project(":mail:common") @@ -9,37 +11,37 @@ dependencies { implementation project(':plugins:openpgp-api-lib:openpgp-api') - api "io.insert-koin:koin-android:${versions.koin}" + api libs.koin.android - api "androidx.annotation:annotation:${versions.androidxAnnotation}" + api libs.androidx.annotation - implementation "com.squareup.okio:okio:${versions.okio}" - implementation "commons-io:commons-io:${versions.commonsIo}" - implementation "androidx.core:core-ktx:${versions.androidxCore}" - implementation "androidx.work:work-runtime-ktx:${versions.androidxWorkManager}" - implementation "androidx.fragment:fragment:${versions.androidxFragment}" - implementation "androidx.localbroadcastmanager:localbroadcastmanager:${versions.androidxLocalBroadcastManager}" - implementation "org.jsoup:jsoup:${versions.jsoup}" - implementation "com.squareup.moshi:moshi:${versions.moshi}" - implementation "com.jakewharton.timber:timber:${versions.timber}" - implementation "org.apache.james:apache-mime4j-core:${versions.mime4j}" + implementation libs.okio + implementation libs.commons.io + implementation libs.androidx.core.ktx + implementation libs.androidx.work.ktx + implementation libs.androidx.fragment + implementation libs.androidx.localbroadcastmanager + implementation libs.jsoup + implementation libs.moshi + implementation libs.timber + implementation libs.apache.mime4j.core testImplementation project(':mail:testing') testImplementation project(":backend:imap") testImplementation project(":mail:protocols:smtp") testImplementation project(":app:storage") testImplementation project(":app:testing") - testImplementation "org.jetbrains.kotlin:kotlin-test:${versions.kotlin}" - testImplementation "org.jetbrains.kotlin:kotlin-reflect:${versions.kotlin}" - testImplementation "org.robolectric:robolectric:${versions.robolectric}" - testImplementation "androidx.test:core:${versions.androidxTestCore}" - testImplementation "junit:junit:${versions.junit}" - testImplementation "com.google.truth:truth:${versions.truth}" - testImplementation "org.mockito:mockito-inline:${versions.mockito}" - testImplementation "org.mockito.kotlin:mockito-kotlin:${versions.mockitoKotlin}" - testImplementation "org.jdom:jdom2:2.0.6" - testImplementation "io.insert-koin:koin-test:${versions.koin}" - testImplementation "io.insert-koin:koin-test-junit4:${versions.koin}" + testImplementation libs.kotlin.test + testImplementation libs.kotlin.reflect + testImplementation libs.robolectric + testImplementation libs.androidx.test.core + testImplementation libs.junit + testImplementation libs.truth + testImplementation libs.mockito.inline + testImplementation libs.mockito.kotlin + testImplementation libs.jdom2 + testImplementation libs.koin.test + testImplementation libs.koin.test.junit4 } android { diff --git a/app/crypto-openpgp/build.gradle b/app/crypto-openpgp/build.gradle index 671aa64390..ad360744f3 100644 --- a/app/crypto-openpgp/build.gradle +++ b/app/crypto-openpgp/build.gradle @@ -1,11 +1,13 @@ -apply plugin: 'com.android.library' -apply plugin: 'org.jetbrains.kotlin.android' +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) +} dependencies { implementation project(":app:core") - testImplementation "junit:junit:${versions.junit}" - testImplementation "org.mockito:mockito-core:${versions.mockito}" + testImplementation libs.junit + testImplementation libs.mockito.core } android { diff --git a/app/html-cleaner/build.gradle b/app/html-cleaner/build.gradle index e9d5a13e0d..6e423bf30e 100644 --- a/app/html-cleaner/build.gradle +++ b/app/html-cleaner/build.gradle @@ -1,10 +1,12 @@ -apply plugin: 'java-library' -apply plugin: 'kotlin' -apply plugin: 'com.android.lint' +plugins { + id 'java-library' + id 'kotlin' + alias(libs.plugins.android.lint) +} dependencies { - implementation "org.jsoup:jsoup:${versions.jsoup}" + implementation libs.jsoup - testImplementation "junit:junit:${versions.junit}" - testImplementation "com.google.truth:truth:${versions.truth}" + testImplementation libs.junit + testImplementation libs.truth } diff --git a/app/k9mail/build.gradle b/app/k9mail/build.gradle index ec5a9581da..592897eb00 100644 --- a/app/k9mail/build.gradle +++ b/app/k9mail/build.gradle @@ -1,5 +1,7 @@ -apply plugin: 'com.android.application' -apply plugin: 'org.jetbrains.kotlin.android' +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.android) +} if (rootProject.testCoverage) { apply plugin: 'jacoco' @@ -16,30 +18,30 @@ dependencies { implementation project(":backend:webdav") debugImplementation project(":backend:demo") - implementation "androidx.appcompat:appcompat:${versions.androidxAppCompat}" - implementation "androidx.core:core-ktx:${versions.androidxCore}" - implementation "androidx.work:work-runtime-ktx:${versions.androidxWorkManager}" - implementation "com.takisoft.preferencex:preferencex:${versions.preferencesFix}" - implementation "com.jakewharton.timber:timber:${versions.timber}" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.kotlinCoroutines}" + implementation libs.androidx.appcompat + implementation libs.androidx.core.ktx + implementation libs.androidx.work.ktx + implementation libs.preferencex + implementation libs.timber + implementation libs.kotlinx.coroutines.core - implementation "com.github.bumptech.glide:glide:${versions.glide}" - annotationProcessor "com.github.bumptech.glide:compiler:${versions.glide}" + implementation libs.glide + annotationProcessor libs.glide.compiler if (project.hasProperty('k9mail.enableLeakCanary') && project.property('k9mail.enableLeakCanary') == "true") { - debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.9.1' + debugImplementation libs.leakcanary.android } // Required for DependencyInjectionTest to be able to resolve OpenPgpApiManager testImplementation project(':plugins:openpgp-api-lib:openpgp-api') - testImplementation "org.robolectric:robolectric:${versions.robolectric}" - testImplementation "junit:junit:${versions.junit}" - testImplementation "com.google.truth:truth:${versions.truth}" - testImplementation "org.mockito:mockito-inline:${versions.mockito}" - testImplementation "org.mockito.kotlin:mockito-kotlin:${versions.mockitoKotlin}" - testImplementation "io.insert-koin:koin-test:${versions.koin}" - testImplementation "io.insert-koin:koin-test-junit4:${versions.koin}" + testImplementation libs.robolectric + testImplementation libs.junit + testImplementation libs.truth + testImplementation libs.mockito.inline + testImplementation libs.mockito.kotlin + testImplementation libs.koin.test + testImplementation libs.koin.test.junit4 } android { diff --git a/app/storage/build.gradle b/app/storage/build.gradle index 7f270f394f..d25a949270 100644 --- a/app/storage/build.gradle +++ b/app/storage/build.gradle @@ -1,26 +1,28 @@ -apply plugin: 'com.android.library' -apply plugin: 'org.jetbrains.kotlin.android' +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) +} dependencies { - api "io.insert-koin:koin-core:${versions.koin}" + api libs.koin.core implementation project(":app:core") - implementation "androidx.core:core-ktx:${versions.androidxCore}" - implementation "com.jakewharton.timber:timber:${versions.timber}" - implementation "org.apache.james:apache-mime4j-core:${versions.mime4j}" - implementation "commons-io:commons-io:${versions.commonsIo}" - implementation "com.squareup.moshi:moshi:${versions.moshi}" + implementation libs.androidx.core.ktx + implementation libs.timber + implementation libs.apache.mime4j.core + implementation libs.commons.io + implementation libs.moshi testImplementation project(':mail:testing') testImplementation project(':app:testing') - testImplementation "org.robolectric:robolectric:${versions.robolectric}" - testImplementation "junit:junit:${versions.junit}" - testImplementation "com.google.truth:truth:${versions.truth}" - testImplementation "org.mockito:mockito-inline:${versions.mockito}" - testImplementation "org.mockito.kotlin:mockito-kotlin:${versions.mockitoKotlin}" - testImplementation "io.insert-koin:koin-test:${versions.koin}" - testImplementation "io.insert-koin:koin-test-junit4:${versions.koin}" - testImplementation "commons-io:commons-io:${versions.commonsIo}" + testImplementation libs.robolectric + testImplementation libs.junit + testImplementation libs.truth + testImplementation libs.mockito.inline + testImplementation libs.mockito.kotlin + testImplementation libs.koin.test + testImplementation libs.koin.test.junit4 + testImplementation libs.commons.io } android { diff --git a/app/testing/build.gradle b/app/testing/build.gradle index 181203c2ab..51ee7fd260 100644 --- a/app/testing/build.gradle +++ b/app/testing/build.gradle @@ -1,14 +1,16 @@ -apply plugin: 'com.android.library' -apply plugin: 'org.jetbrains.kotlin.android' +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) +} dependencies { implementation project(':app:core') - api "junit:junit:${versions.junit}" - api "org.robolectric:robolectric:${versions.robolectric}" - api "io.insert-koin:koin-core:${versions.koin}" - api "org.mockito:mockito-core:${versions.mockito}" - api "org.mockito.kotlin:mockito-kotlin:${versions.mockitoKotlin}" + api libs.junit + api libs.robolectric + api libs.koin.core + api libs.mockito.core + api libs.mockito.kotlin } android { diff --git a/app/ui/base/build.gradle b/app/ui/base/build.gradle index da4e97904f..f939899728 100644 --- a/app/ui/base/build.gradle +++ b/app/ui/base/build.gradle @@ -1,20 +1,22 @@ -apply plugin: 'com.android.library' -apply plugin: 'org.jetbrains.kotlin.android' +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) +} dependencies { implementation project(":app:core") - api "androidx.appcompat:appcompat:${versions.androidxAppCompat}" - api "androidx.activity:activity:${versions.androidxActivity}" - api "com.google.android.material:material:${versions.materialComponents}" - api "androidx.navigation:navigation-fragment:${versions.androidxNavigation}" - api "androidx.navigation:navigation-ui:${versions.androidxNavigation}" - api "androidx.lifecycle:lifecycle-livedata-ktx:${versions.androidxLifecycle}" + api libs.androidx.appcompat + api libs.androidx.activity + api libs.android.material + api libs.androidx.navigation.fragment + api libs.androidx.navigation.ui + api libs.androidx.lifecycle.livedata.ktx - implementation "androidx.core:core-ktx:${versions.androidxCore}" - implementation "androidx.biometric:biometric:${versions.androidxBiometric}" - implementation "com.jakewharton.timber:timber:${versions.timber}" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.kotlinCoroutines}" + implementation libs.androidx.core.ktx + implementation libs.androidx.biometric + implementation libs.timber + implementation libs.kotlinx.coroutines.core } android { diff --git a/app/ui/legacy/build.gradle b/app/ui/legacy/build.gradle index fabf940942..dd3575c98c 100644 --- a/app/ui/legacy/build.gradle +++ b/app/ui/legacy/build.gradle @@ -1,6 +1,8 @@ -apply plugin: 'com.android.library' -apply plugin: 'org.jetbrains.kotlin.android' -apply plugin: 'org.jetbrains.kotlin.plugin.parcelize' +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.kotlin.parcelize) +} dependencies { api project(":app:ui:base") @@ -16,57 +18,57 @@ dependencies { implementation project(':plugins:openpgp-api-lib:openpgp-api') - implementation "androidx.appcompat:appcompat:${versions.androidxAppCompat}" - implementation "androidx.preference:preference:${versions.androidxPreference}" - implementation "com.takisoft.preferencex:preferencex:${versions.preferencesFix}" - implementation "com.takisoft.preferencex:preferencex-datetimepicker:${versions.preferencesFix}" - implementation "com.takisoft.preferencex:preferencex-colorpicker:${versions.preferencesFix}" - implementation "androidx.recyclerview:recyclerview:${versions.androidxRecyclerView}" + implementation libs.androidx.appcompat + implementation libs.androidx.preference + implementation libs.preferencex + implementation libs.preferencex.datetimepicker + implementation libs.preferencex.colorpicker + implementation libs.androidx.recyclerview implementation project(':ui-utils:LinearLayoutManager') implementation project(':ui-utils:ItemTouchHelper') - implementation "androidx.lifecycle:lifecycle-runtime-ktx:${versions.androidxLifecycle}" - implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:${versions.androidxLifecycle}" - implementation "androidx.lifecycle:lifecycle-livedata-ktx:${versions.androidxLifecycle}" - implementation "androidx.constraintlayout:constraintlayout:${versions.androidxConstraintLayout}" - implementation "androidx.cardview:cardview:${versions.androidxCardView}" - implementation "androidx.localbroadcastmanager:localbroadcastmanager:${versions.androidxLocalBroadcastManager}" - implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" - implementation "de.cketti.library.changelog:ckchangelog-core:2.0.0-beta02" - implementation "com.splitwise:tokenautocomplete:4.0.0-beta01" - implementation "de.cketti.safecontentresolver:safe-content-resolver-v21:1.0.0" - implementation 'com.mikepenz:materialdrawer:8.4.5' - implementation 'com.github.ByteHamster:SearchPreference:v2.3.0' - implementation "com.mikepenz:fastadapter:${versions.fastAdapter}" - implementation "com.mikepenz:fastadapter-extensions-drag:${versions.fastAdapter}" - implementation "com.mikepenz:fastadapter-extensions-utils:${versions.fastAdapter}" - implementation 'de.hdodenhof:circleimageview:3.1.0' - api 'net.openid:appauth:0.11.1' + implementation libs.androidx.lifecycle.runtime.ktx + implementation libs.androidx.lifecycle.viewmodel.ktx + implementation libs.androidx.lifecycle.livedata.ktx + implementation libs.androidx.constraintlayout + implementation libs.androidx.cardview + implementation libs.androidx.localbroadcastmanager + implementation libs.androidx.swiperefreshlayout + implementation libs.ckchangelog.core + implementation libs.tokenautocomplete + implementation libs.safe.content.resolver.v21 + implementation libs.materialdrawer + implementation libs.search.preference + implementation libs.fastadapter + implementation libs.fastadapter.extensions.drag + implementation libs.fastadapter.extensions.utils + implementation libs.circleimageview + api libs.appauth - implementation "commons-io:commons-io:${versions.commonsIo}" - implementation "androidx.core:core-ktx:${versions.androidxCore}" - implementation "net.jcip:jcip-annotations:1.0" - implementation "com.jakewharton.timber:timber:${versions.timber}" - implementation "org.apache.james:apache-mime4j-core:${versions.mime4j}" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.kotlinCoroutines}" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.kotlinCoroutines}" + implementation libs.commons.io + implementation libs.androidx.core.ktx + implementation libs.jcip.annotations + implementation libs.timber + implementation libs.apache.mime4j.core + implementation libs.kotlinx.coroutines.core + implementation libs.kotlinx.coroutines.android - implementation "com.github.bumptech.glide:glide:${versions.glide}" - annotationProcessor "com.github.bumptech.glide:compiler:${versions.glide}" + implementation libs.glide + annotationProcessor libs.glide.compiler testImplementation project(':mail:testing') testImplementation project(':app:storage') testImplementation project(':app:testing') - testImplementation "org.robolectric:robolectric:${versions.robolectric}" - testImplementation "androidx.test:core:${versions.androidxTestCore}" - testImplementation "junit:junit:${versions.junit}" - testImplementation "org.jetbrains.kotlin:kotlin-test:${versions.kotlin}" - testImplementation "com.google.truth:truth:${versions.truth}" - testImplementation "org.mockito:mockito-inline:${versions.mockito}" - testImplementation "org.mockito.kotlin:mockito-kotlin:${versions.mockitoKotlin}" - testImplementation "io.insert-koin:koin-test:${versions.koin}" - testImplementation "io.insert-koin:koin-test-junit4:${versions.koin}" - testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:${versions.kotlinCoroutines}" - testImplementation "app.cash.turbine:turbine:${versions.turbine}" + testImplementation libs.robolectric + testImplementation libs.androidx.test.core + testImplementation libs.junit + testImplementation libs.kotlin.test + testImplementation libs.truth + testImplementation libs.mockito.inline + testImplementation libs.mockito.kotlin + testImplementation libs.koin.test + testImplementation libs.koin.test.junit4 + testImplementation libs.kotlinx.coroutines.test + testImplementation libs.turbine } android { diff --git a/app/ui/message-list-widget/build.gradle b/app/ui/message-list-widget/build.gradle index cf43f30db7..ef62929f41 100644 --- a/app/ui/message-list-widget/build.gradle +++ b/app/ui/message-list-widget/build.gradle @@ -1,11 +1,13 @@ -apply plugin: 'com.android.library' -apply plugin: 'org.jetbrains.kotlin.android' +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) +} dependencies { implementation project(":app:ui:legacy") implementation project(":app:core") - implementation "com.jakewharton.timber:timber:${versions.timber}" + implementation libs.timber } android { diff --git a/app/ui/setup/build.gradle b/app/ui/setup/build.gradle index 092bc160b7..3585042da5 100644 --- a/app/ui/setup/build.gradle +++ b/app/ui/setup/build.gradle @@ -1,5 +1,7 @@ -apply plugin: 'com.android.library' -apply plugin: 'org.jetbrains.kotlin.android' +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) +} dependencies { api project(":app:ui:base") @@ -7,23 +9,23 @@ dependencies { implementation project(":app:autodiscovery:api") implementation project(":mail:common") - implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:${versions.androidxLifecycle}" - implementation "androidx.lifecycle:lifecycle-livedata-ktx:${versions.androidxLifecycle}" - implementation "androidx.constraintlayout:constraintlayout:${versions.androidxConstraintLayout}" - implementation "androidx.core:core-ktx:${versions.androidxCore}" - implementation "com.jakewharton.timber:timber:${versions.timber}" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.kotlinCoroutines}" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.kotlinCoroutines}" + implementation libs.androidx.lifecycle.viewmodel.ktx + implementation libs.androidx.lifecycle.livedata.ktx + implementation libs.androidx.constraintlayout + implementation libs.androidx.core.ktx + implementation libs.timber + implementation libs.kotlinx.coroutines.core + implementation libs.kotlinx.coroutines.android testImplementation project(':mail:testing') testImplementation project(':app:testing') - testImplementation "org.robolectric:robolectric:${versions.robolectric}" - testImplementation "junit:junit:${versions.junit}" - testImplementation "com.google.truth:truth:${versions.truth}" - testImplementation "org.mockito:mockito-core:${versions.mockito}" - testImplementation "org.mockito.kotlin:mockito-kotlin:${versions.mockitoKotlin}" - testImplementation "io.insert-koin:koin-test:${versions.koin}" - testImplementation "io.insert-koin:koin-test-junit4:${versions.koin}" + testImplementation libs.robolectric + testImplementation libs.junit + testImplementation libs.truth + testImplementation libs.mockito.core + testImplementation libs.mockito.kotlin + testImplementation libs.koin.test + testImplementation libs.koin.test.junit4 } android { diff --git a/backend/api/build.gradle b/backend/api/build.gradle index 13eabe22f4..aa86ea20a9 100644 --- a/backend/api/build.gradle +++ b/backend/api/build.gradle @@ -1,6 +1,8 @@ -apply plugin: 'java-library' -apply plugin: 'kotlin' -apply plugin: 'com.android.lint' +plugins { + id 'java-library' + id 'kotlin' + alias(libs.plugins.android.lint) +} dependencies { api project(":mail:common") diff --git a/backend/demo/build.gradle b/backend/demo/build.gradle index 00031f89e2..21fa15d57c 100644 --- a/backend/demo/build.gradle +++ b/backend/demo/build.gradle @@ -1,17 +1,19 @@ -apply plugin: 'java-library' -apply plugin: 'kotlin' -apply plugin: 'com.google.devtools.ksp' -apply plugin: 'com.android.lint' +plugins { + id 'java-library' + id 'kotlin' + alias(libs.plugins.ksp) + alias(libs.plugins.android.lint) +} dependencies { api project(":backend:api") - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.kotlinCoroutines}" - implementation "com.squareup.moshi:moshi:${versions.moshi}" - ksp "com.squareup.moshi:moshi-kotlin-codegen:${versions.moshi}" + implementation libs.kotlinx.coroutines.core + implementation libs.moshi + ksp libs.moshi.kotlin.kotgen testImplementation project(":mail:testing") - testImplementation "junit:junit:${versions.junit}" - testImplementation "org.mockito:mockito-core:${versions.mockito}" - testImplementation "com.google.truth:truth:${versions.truth}" + testImplementation libs.junit + testImplementation libs.mockito.core + testImplementation libs.truth } diff --git a/backend/imap/build.gradle b/backend/imap/build.gradle index 013afae0f0..14c4223e9c 100644 --- a/backend/imap/build.gradle +++ b/backend/imap/build.gradle @@ -1,19 +1,21 @@ -apply plugin: 'java-library' -apply plugin: 'kotlin' -apply plugin: 'com.android.lint' +plugins { + id 'java-library' + id 'kotlin' + alias(libs.plugins.android.lint) +} dependencies { api project(":backend:api") api project(":mail:protocols:imap") api project(":mail:protocols:smtp") - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.kotlinCoroutines}" + implementation libs.kotlinx.coroutines.core testImplementation project(":mail:testing") testImplementation project(":backend:testing") - testImplementation "junit:junit:${versions.junit}" - testImplementation "org.mockito:mockito-inline:${versions.mockito}" - testImplementation "org.mockito.kotlin:mockito-kotlin:${versions.mockitoKotlin}" - testImplementation "com.google.truth:truth:${versions.truth}" - testImplementation "org.apache.james:apache-mime4j-dom:${versions.mime4j}" + testImplementation libs.junit + testImplementation libs.mockito.inline + testImplementation libs.mockito.kotlin + testImplementation libs.truth + testImplementation libs.apache.mime4j.dom } diff --git a/backend/jmap/build.gradle b/backend/jmap/build.gradle index 318691869a..b27c1b82d8 100644 --- a/backend/jmap/build.gradle +++ b/backend/jmap/build.gradle @@ -1,18 +1,20 @@ -apply plugin: 'java-library' -apply plugin: 'kotlin' -apply plugin: 'com.google.devtools.ksp' -apply plugin: 'com.android.lint' +plugins { + id 'java-library' + id 'kotlin' + alias(libs.plugins.ksp) + alias(libs.plugins.android.lint) +} dependencies { api project(":backend:api") - api "com.squareup.okhttp3:okhttp:${versions.okhttp}" - implementation "rs.ltt.jmap:jmap-client:0.3.1" - implementation "com.squareup.moshi:moshi:${versions.moshi}" - ksp "com.squareup.moshi:moshi-kotlin-codegen:${versions.moshi}" + api libs.okhttp + implementation libs.jmap.client + implementation libs.moshi + ksp libs.moshi.kotlin.kotgen testImplementation project(":mail:testing") testImplementation project(':backend:testing') - testImplementation "org.mockito:mockito-core:${versions.mockito}" - testImplementation("com.squareup.okhttp3:mockwebserver:${versions.okhttp}") + testImplementation libs.mockito.core + testImplementation libs.okhttp.mockwebserver } diff --git a/backend/pop3/build.gradle b/backend/pop3/build.gradle index 40731fbf71..dfd503ead6 100644 --- a/backend/pop3/build.gradle +++ b/backend/pop3/build.gradle @@ -1,6 +1,8 @@ -apply plugin: 'java-library' -apply plugin: 'kotlin' -apply plugin: 'com.android.lint' +plugins { + id 'java-library' + id 'kotlin' + alias(libs.plugins.android.lint) +} dependencies { api project(":backend:api") @@ -8,6 +10,6 @@ dependencies { api project(":mail:protocols:smtp") testImplementation project(":mail:testing") - testImplementation "junit:junit:${versions.junit}" - testImplementation "org.mockito:mockito-core:${versions.mockito}" + testImplementation libs.junit + testImplementation libs.mockito.core } diff --git a/backend/testing/build.gradle b/backend/testing/build.gradle index f805834824..b1a4dddf5f 100644 --- a/backend/testing/build.gradle +++ b/backend/testing/build.gradle @@ -1,10 +1,12 @@ -apply plugin: 'java-library' -apply plugin: 'kotlin' -apply plugin: 'com.android.lint' +plugins { + id 'java-library' + id 'kotlin' + alias(libs.plugins.android.lint) +} dependencies { implementation project(":backend:api") - implementation "com.squareup.okio:okio:${versions.okio}" - implementation "junit:junit:${versions.junit}" + implementation libs.okio + implementation libs.junit } diff --git a/backend/webdav/build.gradle b/backend/webdav/build.gradle index 18c1f091cc..706ab2b7fd 100644 --- a/backend/webdav/build.gradle +++ b/backend/webdav/build.gradle @@ -1,12 +1,14 @@ -apply plugin: 'java-library' -apply plugin: 'kotlin' -apply plugin: 'com.android.lint' +plugins { + id 'java-library' + id 'kotlin' + alias(libs.plugins.android.lint) +} dependencies { api project(":backend:api") api project(":mail:protocols:webdav") testImplementation project(":mail:testing") - testImplementation "junit:junit:${versions.junit}" - testImplementation "org.mockito:mockito-core:${versions.mockito}" + testImplementation libs.junit + testImplementation libs.mockito.core } diff --git a/build.gradle b/build.gradle index befe8547da..963ccaa32d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,76 +1,15 @@ import com.android.build.gradle.BasePlugin -import org.gradle.api.plugins.JavaPlugin import org.jetbrains.kotlin.gradle.dsl.KotlinCompile -buildscript { - ext { - // Judging the impact of newer library versions on the app requires being intimately familiar with the code - // base. Please don't open pull requests upgrading dependencies if you're a new contributor. - versions = [ - 'kotlin': '1.7.22', - 'kotlinCoroutines': '1.6.4', - 'jetbrainsAnnotations': '23.0.0', - 'androidxAppCompat': '1.5.1', - 'androidxActivity': '1.6.0', - 'androidxRecyclerView': '1.2.1', - 'androidxLifecycle': '2.5.1', - 'androidxAnnotation': '1.5.0', - 'androidxBiometric': '1.1.0', - 'androidxNavigation': '2.5.2', - 'androidxConstraintLayout': '2.1.4', - 'androidxWorkManager': '2.7.1', - 'androidxFragment': '1.5.3', - 'androidxLocalBroadcastManager': '1.1.0', - 'androidxCore': '1.9.0', - 'androidxCardView': '1.0.0', - 'androidxPreference': '1.2.0', - 'androidxDrawerLayout': '1.1.1', - 'androidxTransition': '1.4.1', - 'androidxTestCore': '1.4.0', - 'materialComponents': '1.6.1', - 'fastAdapter': '5.7.0', - 'preferencesFix': '1.1.0', - 'okio': '3.2.0', - 'moshi': '1.14.0', - 'timber': '5.0.1', - 'koin': '3.2.2', - // We can't upgrade Commons IO beyond this version because starting with 2.7 it is using Java 8 API - // that is not available until Android API 26 (even with desugaring enabled). - // See https://issuetracker.google.com/issues/160484830 - 'commonsIo': '2.6', - 'mime4j': '0.8.6', - 'okhttp': '4.10.0', - 'minidns': '1.0.4', - 'glide': '4.14.2', - 'jsoup': '1.15.3', - 'httpClient': '4.5.13', - - 'androidxTestRunner': '1.4.0', - 'junit': '4.13.2', - 'robolectric': '4.9', - 'mockito': '4.8.0', - 'mockitoKotlin': '4.0.0', - 'truth': '1.1.3', - 'turbine': '0.11.0', - - 'ktlint': '0.44.0' - ] - - javaVersion = JavaVersion.VERSION_1_8 - } - - repositories { - mavenCentral() - google() - gradlePluginPortal() - } - - dependencies { - classpath 'com.android.tools.build:gradle:7.3.1' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}" - classpath "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:1.7.22-1.0.8" - classpath "org.jlleitschuh.gradle:ktlint-gradle:11.0.0" - } +plugins { + alias(libs.plugins.android.application) apply false + alias(libs.plugins.android.library) apply false + alias(libs.plugins.android.lint) apply false + alias(libs.plugins.ksp) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.kotlin.parcelize) apply false + alias(libs.plugins.kotlin.jvm) apply false + alias(libs.plugins.ktlint) apply false } project.ext { @@ -80,23 +19,23 @@ project.ext { allprojects { configurations.all { resolutionStrategy.dependencySubstitution { - substitute module("androidx.core:core") using module("androidx.core:core:${versions.androidxCore}") - substitute module("androidx.activity:activity") using module("androidx.activity:activity:${versions.androidxActivity}") - substitute module("androidx.activity:activity-ktx") using module("androidx.activity:activity-ktx:${versions.androidxActivity}") - substitute module("androidx.fragment:fragment") using module("androidx.fragment:fragment:${versions.androidxFragment}") - substitute module("androidx.fragment:fragment-ktx") using module("androidx.fragment:fragment-ktx:${versions.androidxFragment}") - substitute module("androidx.appcompat:appcompat") using module("androidx.appcompat:appcompat:${versions.androidxAppCompat}") - substitute module("androidx.preference:preference") using module("androidx.preference:preference:${versions.androidxPreference}") - substitute module("androidx.recyclerview:recyclerview") using module("androidx.recyclerview:recyclerview:${versions.androidxRecyclerView}") - substitute module("androidx.constraintlayout:constraintlayout") using module("androidx.constraintlayout:constraintlayout:${versions.androidxConstraintLayout}") - substitute module("androidx.drawerlayout:drawerlayout") using module("androidx.drawerlayout:drawerlayout:${versions.androidxDrawerLayout}") - substitute module("androidx.lifecycle:lifecycle-livedata") using module("androidx.lifecycle:lifecycle-livedata:${versions.androidxLifecycle}") - substitute module("androidx.transition:transition") using module("androidx.transition:transition:${versions.androidxTransition}") - substitute module("org.jetbrains:annotations") using module("org.jetbrains:annotations:${versions.jetbrainsAnnotations}") - substitute module("org.jetbrains.kotlin:kotlin-stdlib") using module("org.jetbrains.kotlin:kotlin-stdlib:${versions.kotlin}") - substitute module("org.jetbrains.kotlin:kotlin-stdlib-jdk7") using module("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}") - substitute module("org.jetbrains.kotlin:kotlin-stdlib-jdk8") using module("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${versions.kotlin}") - substitute module("org.jetbrains.kotlinx:kotlinx-coroutines-android") using module("org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.kotlinCoroutines}") + substitute module("androidx.core:core") using module("androidx.core:core:${libs.versions.androidxCore.get()}") + substitute module("androidx.activity:activity") using module("androidx.activity:activity:${libs.versions.androidxActivity.get()}") + substitute module("androidx.activity:activity-ktx") using module("androidx.activity:activity-ktx:${libs.versions.androidxActivity.get()}") + substitute module("androidx.fragment:fragment") using module("androidx.fragment:fragment:${libs.versions.androidxFragment.get()}") + substitute module("androidx.fragment:fragment-ktx") using module("androidx.fragment:fragment-ktx:${libs.versions.androidxFragment.get()}") + substitute module("androidx.appcompat:appcompat") using module("androidx.appcompat:appcompat:${libs.versions.androidxAppCompat.get()}") + substitute module("androidx.preference:preference") using module("androidx.preference:preference:${libs.versions.androidxPreference.get()}") + substitute module("androidx.recyclerview:recyclerview") using module("androidx.recyclerview:recyclerview:${libs.versions.androidxRecyclerView.get()}") + substitute module("androidx.constraintlayout:constraintlayout") using module("androidx.constraintlayout:constraintlayout:${libs.versions.androidxConstraintLayout.get()}") + substitute module("androidx.drawerlayout:drawerlayout") using module("androidx.drawerlayout:drawerlayout:${libs.versions.androidxDrawerLayout.get()}") + substitute module("androidx.lifecycle:lifecycle-livedata") using module("androidx.lifecycle:lifecycle-livedata:${libs.versions.androidxLifecycle.get()}") + substitute module("androidx.transition:transition") using module("androidx.transition:transition:${libs.versions.androidxTransition.get()}") + substitute module("org.jetbrains:annotations") using module("org.jetbrains:annotations:${libs.versions.jetbrainsAnnotations.get()}") + substitute module("org.jetbrains.kotlin:kotlin-stdlib") using module("org.jetbrains.kotlin:kotlin-stdlib:${libs.versions.kotlin.get()}") + substitute module("org.jetbrains.kotlin:kotlin-stdlib-jdk7") using module("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${libs.versions.kotlin.get()}") + substitute module("org.jetbrains.kotlin:kotlin-stdlib-jdk8") using module("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${libs.versions.kotlin.get()}") + substitute module("org.jetbrains.kotlinx:kotlinx-coroutines-android") using module("org.jetbrains.kotlinx:kotlinx-coroutines-android:${libs.versions.kotlinCoroutines.get()}") } } @@ -113,8 +52,8 @@ allprojects { } compileOptions { - sourceCompatibility javaVersion - targetCompatibility javaVersion + sourceCompatibility libs.versions.java.get() + targetCompatibility libs.versions.java.get() } lintOptions { @@ -132,8 +71,8 @@ allprojects { plugins.withType(JavaPlugin).configureEach { project.java { - sourceCompatibility = javaVersion - targetCompatibility = javaVersion + sourceCompatibility = libs.versions.java.get() + targetCompatibility = libs.versions.java.get() } } @@ -148,13 +87,13 @@ allprojects { tasks.withType(KotlinCompile) { kotlinOptions { - jvmTarget = javaVersion + jvmTarget = libs.versions.java.get() } } apply plugin: 'org.jlleitschuh.gradle.ktlint' ktlint { - version = versions.ktlint + version = libs.versions.ktlint.get() } } diff --git a/cli/html-cleaner-cli/build.gradle b/cli/html-cleaner-cli/build.gradle index 5d06b5f7ec..26f2c9d593 100644 --- a/cli/html-cleaner-cli/build.gradle +++ b/cli/html-cleaner-cli/build.gradle @@ -1,5 +1,7 @@ -apply plugin: 'org.jetbrains.kotlin.jvm' -apply plugin: 'application' +plugins { + alias(libs.plugins.kotlin.jvm) + id 'application' +} version 'unspecified' @@ -10,6 +12,6 @@ application { dependencies { implementation project(':app:html-cleaner') - implementation "com.github.ajalt.clikt:clikt:3.4.0" - implementation "com.squareup.okio:okio:${versions.okio}" + implementation libs.clikt + implementation libs.okio } diff --git a/mail/common/build.gradle b/mail/common/build.gradle index 4681b3d0dd..437a21b3ec 100644 --- a/mail/common/build.gradle +++ b/mail/common/build.gradle @@ -1,27 +1,29 @@ -apply plugin: 'java-library' -apply plugin: 'kotlin' -apply plugin: 'com.android.lint' +plugins { + id 'java-library' + id 'kotlin' + alias(libs.plugins.android.lint) +} if (rootProject.testCoverage) { apply plugin: 'jacoco' } dependencies { - api "org.jetbrains:annotations:${versions.jetbrainsAnnotations}" + api libs.jetbrains.annotations - implementation "org.apache.james:apache-mime4j-core:${versions.mime4j}" - implementation "org.apache.james:apache-mime4j-dom:${versions.mime4j}" - implementation "com.squareup.okio:okio:${versions.okio}" - implementation "commons-io:commons-io:${versions.commonsIo}" - implementation "com.squareup.moshi:moshi:${versions.moshi}" + implementation libs.apache.mime4j.core + implementation libs.apache.mime4j.dom + implementation libs.okio + implementation libs.commons.io + implementation libs.moshi // We're only using this for its DefaultHostnameVerifier - implementation "org.apache.httpcomponents.client5:httpclient5:5.1.3" + implementation libs.apache.httpclient5 testImplementation project(":mail:testing") - testImplementation "junit:junit:${versions.junit}" - testImplementation "com.google.truth:truth:${versions.truth}" - testImplementation "org.mockito:mockito-inline:${versions.mockito}" - testImplementation "org.mockito.kotlin:mockito-kotlin:${versions.mockitoKotlin}" - testImplementation "com.ibm.icu:icu4j-charset:70.1" + testImplementation libs.junit + testImplementation libs.truth + testImplementation libs.mockito.inline + testImplementation libs.mockito.kotlin + testImplementation libs.icu4j.charset } diff --git a/mail/protocols/imap/build.gradle b/mail/protocols/imap/build.gradle index ee26ab9a6b..721593e91e 100644 --- a/mail/protocols/imap/build.gradle +++ b/mail/protocols/imap/build.gradle @@ -1,6 +1,8 @@ -apply plugin: 'java-library' -apply plugin: 'kotlin' -apply plugin: 'com.android.lint' +plugins { + id 'java-library' + id 'kotlin' + alias(libs.plugins.android.lint) +} if (rootProject.testCoverage) { apply plugin: 'jacoco' @@ -9,16 +11,16 @@ if (rootProject.testCoverage) { dependencies { api project(":mail:common") - implementation "com.jcraft:jzlib:1.0.7" - implementation "com.beetstra.jutf7:jutf7:1.0.0" - implementation "commons-io:commons-io:${versions.commonsIo}" - implementation "com.squareup.okio:okio:${versions.okio}" + implementation libs.jzlib + implementation libs.jutf7 + implementation libs.commons.io + implementation libs.okio testImplementation project(":mail:testing") - testImplementation "junit:junit:${versions.junit}" - testImplementation "com.google.truth:truth:${versions.truth}" - testImplementation "org.mockito:mockito-core:${versions.mockito}" - testImplementation "org.mockito.kotlin:mockito-kotlin:${versions.mockitoKotlin}" - testImplementation "com.squareup.okio:okio:${versions.okio}" - testImplementation "org.apache.james:apache-mime4j-core:${versions.mime4j}" + testImplementation libs.junit + testImplementation libs.truth + testImplementation libs.mockito.core + testImplementation libs.mockito.kotlin + testImplementation libs.okio + testImplementation libs.apache.mime4j.core } diff --git a/mail/protocols/pop3/build.gradle b/mail/protocols/pop3/build.gradle index 67ef9f6cde..8ff2e742c3 100644 --- a/mail/protocols/pop3/build.gradle +++ b/mail/protocols/pop3/build.gradle @@ -1,6 +1,8 @@ -apply plugin: 'java-library' -apply plugin: 'kotlin' -apply plugin: 'com.android.lint' +plugins { + id 'java-library' + id 'kotlin' + alias(libs.plugins.android.lint) +} if (rootProject.testCoverage) { apply plugin: 'jacoco' @@ -10,11 +12,11 @@ dependencies { api project(":mail:common") testImplementation project(":mail:testing") - testImplementation "junit:junit:${versions.junit}" - testImplementation "com.google.truth:truth:${versions.truth}" - testImplementation "org.mockito:mockito-core:${versions.mockito}" - testImplementation "org.mockito.kotlin:mockito-kotlin:${versions.mockitoKotlin}" - testImplementation "com.squareup.okio:okio:${versions.okio}" - testImplementation "com.jcraft:jzlib:1.0.7" - testImplementation "commons-io:commons-io:${versions.commonsIo}" + testImplementation libs.junit + testImplementation libs.truth + testImplementation libs.mockito.core + testImplementation libs.mockito.kotlin + testImplementation libs.okio + testImplementation libs.jzlib + testImplementation libs.commons.io } diff --git a/mail/protocols/smtp/build.gradle b/mail/protocols/smtp/build.gradle index 8e8adb3123..b4f19fab0f 100644 --- a/mail/protocols/smtp/build.gradle +++ b/mail/protocols/smtp/build.gradle @@ -1,6 +1,8 @@ -apply plugin: 'java-library' -apply plugin: 'kotlin' -apply plugin: 'com.android.lint' +plugins { + id 'java-library' + id 'kotlin' + alias(libs.plugins.android.lint) +} if (rootProject.testCoverage) { apply plugin: 'jacoco' @@ -9,13 +11,13 @@ if (rootProject.testCoverage) { dependencies { api project(":mail:common") - implementation "commons-io:commons-io:${versions.commonsIo}" - implementation "com.squareup.okio:okio:${versions.okio}" + implementation libs.commons.io + implementation libs.okio testImplementation project(":mail:testing") - testImplementation "junit:junit:${versions.junit}" - testImplementation "com.google.truth:truth:${versions.truth}" - testImplementation "org.mockito.kotlin:mockito-kotlin:${versions.mockitoKotlin}" - testImplementation "com.squareup.okio:okio:${versions.okio}" - testImplementation "com.jcraft:jzlib:1.0.7" + testImplementation libs.junit + testImplementation libs.truth + testImplementation libs.mockito.kotlin + testImplementation libs.okio + testImplementation libs.jzlib } diff --git a/mail/protocols/webdav/build.gradle b/mail/protocols/webdav/build.gradle index be69d3a646..24eaada2dc 100644 --- a/mail/protocols/webdav/build.gradle +++ b/mail/protocols/webdav/build.gradle @@ -1,5 +1,7 @@ -apply plugin: 'java-library' -apply plugin: 'com.android.lint' +plugins { + id 'java-library' + alias(libs.plugins.android.lint) +} if (rootProject.testCoverage) { apply plugin: 'jacoco' @@ -8,12 +10,12 @@ if (rootProject.testCoverage) { dependencies { api project(":mail:common") - implementation "commons-io:commons-io:${versions.commonsIo}" - compileOnly "org.apache.httpcomponents:httpclient:${versions.httpClient}" + implementation libs.commons.io + compileOnly libs.apache.httpclient testImplementation project(":mail:testing") - testImplementation "junit:junit:${versions.junit}" - testImplementation "com.google.truth:truth:${versions.truth}" - testImplementation "org.mockito:mockito-inline:${versions.mockito}" - testImplementation "org.apache.httpcomponents:httpclient:${versions.httpClient}" + testImplementation libs.junit + testImplementation libs.truth + testImplementation libs.mockito.inline + testImplementation libs.apache.httpclient } diff --git a/mail/testing/build.gradle b/mail/testing/build.gradle index 2c4e34f8a0..d09cf68910 100644 --- a/mail/testing/build.gradle +++ b/mail/testing/build.gradle @@ -1,6 +1,8 @@ -apply plugin: 'java-library' -apply plugin: 'kotlin' -apply plugin: 'com.android.lint' +plugins { + id 'java-library' + id 'kotlin' + alias(libs.plugins.android.lint) +} if (rootProject.testCoverage) { apply plugin: 'jacoco' @@ -9,6 +11,6 @@ if (rootProject.testCoverage) { dependencies { api project(":mail:common") - api "com.squareup.okio:okio:${versions.okio}" - api "junit:junit:${versions.junit}" + api libs.okio + api libs.junit } diff --git a/plugins/openpgp-api-lib/openpgp-api/build.gradle b/plugins/openpgp-api-lib/openpgp-api/build.gradle index 7ba7c0b8fb..c0f8a0e184 100644 --- a/plugins/openpgp-api-lib/openpgp-api/build.gradle +++ b/plugins/openpgp-api-lib/openpgp-api/build.gradle @@ -1,4 +1,6 @@ -apply plugin: 'com.android.library' +plugins { + alias(libs.plugins.android.library) +} android { namespace 'org.openintents.openpgp' @@ -9,7 +11,7 @@ android { } dependencies { - implementation "androidx.lifecycle:lifecycle-common:${versions.androidxLifecycle}" - implementation "com.jakewharton.timber:timber:${versions.timber}" - implementation "com.takisoft.preferencex:preferencex:${versions.preferencesFix}" + implementation libs.androidx.lifecycle.common + implementation libs.timber + implementation libs.preferencex } diff --git a/settings.gradle b/settings.gradle index e6acc6a117..0df044039d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,11 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} + dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { @@ -5,6 +13,133 @@ dependencyResolutionManagement { mavenCentral() maven { url 'https://jitpack.io' } } + + versionCatalogs { + libs { + // Judging the impact of newer library versions on the app requires being intimately familiar with the code + // base. Please don't open pull requests upgrading dependencies if you're a new contributor. + version('java', '1.8') + version('androidGradlePlugin', '7.3.1') + version('ktlint', '0.44.0') + + version('kotlin', '1.7.22') + version('kotlinCoroutines', '1.6.4') + version('jetbrainsAnnotations', '23.0.0') + version('androidxAppCompat', '1.5.1') + version('androidxActivity', '1.6.0') + version('androidxRecyclerView', '1.2.1') + version('androidxLifecycle', '2.5.1') + version('androidxNavigation', '2.5.2') + version('androidxConstraintLayout', '2.1.4') + version('androidxFragment', '1.5.3') + version('androidxCore', '1.9.0') + version('androidxPreference', '1.2.0') + version('androidxDrawerLayout', '1.1.1') + version('androidxTransition', '1.4.1') + version('fastAdapter', '5.7.0') + version('preferencesFix', '1.1.0') + version('timber', '5.0.1') + version('koin', '3.2.2') + version('mime4j', '0.8.6') + version('okhttp', '4.10.0') + version('glide', '4.14.2') + version('moshi', '1.14.0') + version('mockito', '4.8.0') + + + library('kotlin-test', 'org.jetbrains.kotlin', 'kotlin-test').versionRef('kotlin') + library('kotlin-reflect', 'org.jetbrains.kotlin', 'kotlin-reflect').versionRef('kotlin') + library('kotlinx-coroutines-core', 'org.jetbrains.kotlinx', 'kotlinx-coroutines-core').versionRef('kotlinCoroutines') + library('kotlinx-coroutines-android', 'org.jetbrains.kotlinx', 'kotlinx-coroutines-android').versionRef('kotlinCoroutines') + library('kotlinx-coroutines-test', 'org.jetbrains.kotlinx', 'kotlinx-coroutines-test').versionRef('kotlinCoroutines') + library('jetbrains-annotations', 'org.jetbrains', 'annotations').versionRef('jetbrainsAnnotations') + library('androidx-appcompat', 'androidx.appcompat', 'appcompat').versionRef('androidxAppCompat') + library('androidx-activity', 'androidx.activity', 'activity').versionRef('androidxActivity') + library('androidx-recyclerview', 'androidx.recyclerview', 'recyclerview').versionRef('androidxRecyclerView') + library('androidx-lifecycle-common', 'androidx.lifecycle', 'lifecycle-common').versionRef('androidxLifecycle') + library('androidx-lifecycle-livedata-ktx', 'androidx.lifecycle', 'lifecycle-livedata-ktx').versionRef('androidxLifecycle') + library('androidx-lifecycle-runtime-ktx', 'androidx.lifecycle', 'lifecycle-runtime-ktx').versionRef('androidxLifecycle') + library('androidx-lifecycle-viewmodel-ktx', 'androidx.lifecycle', 'lifecycle-viewmodel-ktx').versionRef('androidxLifecycle') + library('androidx-annotation', 'androidx.annotation', 'annotation').version('1.5.0') + library('androidx-biometric', 'androidx.biometric', 'biometric').version('1.1.0') + library('androidx-navigation-fragment', 'androidx.navigation', 'navigation-fragment').versionRef('androidxNavigation') + library('androidx-navigation-ui', 'androidx.navigation', 'navigation-ui').versionRef('androidxNavigation') + library('androidx-constraintlayout', 'androidx.constraintlayout', 'constraintlayout').versionRef('androidxConstraintLayout') + library('androidx-work-ktx', 'androidx.work', 'work-runtime-ktx').version('2.7.1') + library('androidx-fragment', 'androidx.fragment', 'fragment').versionRef('androidxFragment') + library('androidx-localbroadcastmanager', 'androidx.localbroadcastmanager', 'localbroadcastmanager').version('1.1.0') + library('androidx-core', 'androidx.core', 'core').versionRef('androidxCore') + library('androidx-core-ktx', 'androidx.core', 'core-ktx').versionRef('androidxCore') + library('androidx-cardview', 'androidx.cardview', 'cardview').version('1.0.0') + library('androidx-preference', 'androidx.preference', 'preference').versionRef('androidxPreference') + library('androidx-swiperefreshlayout', 'androidx.swiperefreshlayout', 'swiperefreshlayout').version('1.1.0') + library('androidx-test-core', 'androidx.test', 'core').version('1.4.0') + library('android-material', 'com.google.android.material', 'material').version('1.6.1') + library('fastadapter', 'com.mikepenz', 'fastadapter').versionRef('fastAdapter') + library('fastadapter-extensions-drag', 'com.mikepenz', 'fastadapter-extensions-drag').versionRef('fastAdapter') + library('fastadapter-extensions-utils', 'com.mikepenz', 'fastadapter-extensions-utils').versionRef('fastAdapter') + library('materialdrawer', 'com.mikepenz', 'materialdrawer').version('8.4.5') + library('preferencex', 'com.takisoft.preferencex', 'preferencex').versionRef('preferencesFix') + library('preferencex-datetimepicker', 'com.takisoft.preferencex', 'preferencex-datetimepicker').versionRef('preferencesFix') + library('preferencex-colorpicker', 'com.takisoft.preferencex', 'preferencex-colorpicker').versionRef('preferencesFix') + library('okio', 'com.squareup.okio', 'okio').version('3.2.0') + library('moshi', 'com.squareup.moshi', 'moshi').versionRef('moshi') + library('moshi-kotlin-kotgen', 'com.squareup.moshi', 'moshi-kotlin-codegen').versionRef('moshi') + library('timber', 'com.jakewharton.timber', 'timber').version('5.0.1') + library('koin-core', 'io.insert-koin', 'koin-core').versionRef('koin') + library('koin-android', 'io.insert-koin', 'koin-android').versionRef('koin') + library('koin-test', 'io.insert-koin', 'koin-test').versionRef('koin') + library('koin-test-junit4', 'io.insert-koin', 'koin-test-junit4').versionRef('koin') + // We can't upgrade Commons IO beyond this version because starting with 2.7 it is using Java 8 API + // that is not available until Android API 26 (even with desugaring enabled). + // See https://issuetracker.google.com/issues/160484830 + library('commons-io', 'commons-io', 'commons-io').version('2.6') + library('apache-mime4j-core', 'org.apache.james', 'apache-mime4j-core').versionRef('mime4j') + library('apache-mime4j-dom', 'org.apache.james', 'apache-mime4j-dom').versionRef('mime4j') + library('okhttp', 'com.squareup.okhttp3', 'okhttp').versionRef('okhttp') + library('okhttp-mockwebserver', 'com.squareup.okhttp3', 'mockwebserver').versionRef('okhttp') + library('minidns-hla', 'org.minidns', 'minidns-hla').version('1.0.4') + library('glide', 'com.github.bumptech.glide', 'glide').versionRef('glide') + library('glide-compiler', 'com.github.bumptech.glide', 'compiler').versionRef('glide') + library('jsoup', 'org.jsoup', 'jsoup').version('1.15.3') + library('apache-httpclient', 'org.apache.httpcomponents', 'httpclient').version('4.5.13') + library('apache-httpclient5', 'org.apache.httpcomponents.client5', 'httpclient5').version('5.1.3') + library('clikt', 'com.github.ajalt.clikt', 'clikt').version('3.4.0') + library('jzlib', 'com.jcraft', 'jzlib').version('1.0.7') + library('jutf7', 'com.beetstra.jutf7', 'jutf7').version('1.0.0') + library('jcip-annotations', 'net.jcip', 'jcip-annotations').version('1.0') + library('jmap-client', 'rs.ltt.jmap', 'jmap-client').version('0.3.1') + library('circleimageview', 'de.hdodenhof', 'circleimageview').version('3.1.0') + library('appauth', 'net.openid', 'appauth').version('0.11.1') + library('search-preference', 'com.github.ByteHamster', 'SearchPreference').version('v2.3.0') + library('safe-content-resolver-v21', 'de.cketti.safecontentresolver', 'safe-content-resolver-v21').version('1.0.0') + library('tokenautocomplete', 'com.splitwise', 'tokenautocomplete').version('4.0.0-beta01') + library('ckchangelog-core', 'de.cketti.library.changelog', 'ckchangelog-core').version('2.0.0-beta02') + library('xmlpull-extracted-from-android', 'com.github.cketti', 'xmlpull-extracted-from-android').version('1.0') + library('kxml2-extracted-from-android', 'com.github.cketti', 'kxml2-extracted-from-android').version('1.0') + + library('junit', 'junit', 'junit').version('4.13.2') + library('robolectric', 'org.robolectric', 'robolectric').version('4.9') + library('mockito-core', 'org.mockito', 'mockito-core').versionRef('mockito') + library('mockito-inline', 'org.mockito', 'mockito-inline').versionRef('mockito') + library('mockito-kotlin', 'org.mockito.kotlin', 'mockito-kotlin').version('4.0.0') + library('truth', 'com.google.truth', 'truth').version('1.1.3') + library('turbine', 'app.cash.turbine', 'turbine').version('0.11.0') + library('jdom2', 'org.jdom', 'jdom2').version('2.0.6') + library('icu4j-charset', 'com.ibm.icu', 'icu4j-charset').version('70.1') + + library('leakcanary-android', 'com.squareup.leakcanary', 'leakcanary-android').version('2.9.1') + + plugin('android-application', 'com.android.application').versionRef('androidGradlePlugin') + plugin('android-library', 'com.android.library').versionRef('androidGradlePlugin') + plugin('android-lint', 'com.android.lint').versionRef('androidGradlePlugin') + plugin('ksp', 'com.google.devtools.ksp').version('1.7.22-1.0.8') + plugin('kotlin-android', 'org.jetbrains.kotlin.android').versionRef('kotlin') + plugin('kotlin-parcelize', 'org.jetbrains.kotlin.plugin.parcelize').versionRef('kotlin') + plugin('kotlin-jvm', 'org.jetbrains.kotlin.jvm').versionRef('kotlin') + plugin('ktlint', 'org.jlleitschuh.gradle.ktlint').version('11.0.0') + } + } } include ':app:k9mail' diff --git a/ui-utils/ItemTouchHelper/build.gradle b/ui-utils/ItemTouchHelper/build.gradle index 7c8d85a0d8..b53ba41653 100644 --- a/ui-utils/ItemTouchHelper/build.gradle +++ b/ui-utils/ItemTouchHelper/build.gradle @@ -1,7 +1,9 @@ -apply plugin: 'com.android.library' +plugins { + alias(libs.plugins.android.library) +} dependencies { - api "androidx.recyclerview:recyclerview:${versions.androidxRecyclerView}" + api libs.androidx.recyclerview } android { diff --git a/ui-utils/LinearLayoutManager/build.gradle b/ui-utils/LinearLayoutManager/build.gradle index 96cb591470..53ab0bd9a8 100644 --- a/ui-utils/LinearLayoutManager/build.gradle +++ b/ui-utils/LinearLayoutManager/build.gradle @@ -1,7 +1,9 @@ -apply plugin: 'com.android.library' +plugins { + alias(libs.plugins.android.library) +} dependencies { - api "androidx.recyclerview:recyclerview:${versions.androidxRecyclerView}" + api libs.androidx.recyclerview } android { -- GitLab From 1052bd07c757486a4543cbea36bbdc3c7dd10f3f Mon Sep 17 00:00:00 2001 From: cketti Date: Fri, 13 Jan 2023 16:30:14 +0100 Subject: [PATCH 03/37] Rename some Gradle version catalog entries --- app/autodiscovery/thunderbird/build.gradle | 4 ++-- app/core/build.gradle | 2 +- app/storage/build.gradle | 2 +- app/ui/legacy/build.gradle | 6 +++--- backend/demo/build.gradle | 2 +- backend/imap/build.gradle | 2 +- backend/jmap/build.gradle | 2 +- mail/common/build.gradle | 4 ++-- mail/protocols/imap/build.gradle | 2 +- settings.gradle | 14 +++++++------- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/app/autodiscovery/thunderbird/build.gradle b/app/autodiscovery/thunderbird/build.gradle index 5c0d62966d..4ef0ba7340 100644 --- a/app/autodiscovery/thunderbird/build.gradle +++ b/app/autodiscovery/thunderbird/build.gradle @@ -7,12 +7,12 @@ plugins { dependencies { api project(":app:autodiscovery:api") - compileOnly libs.xmlpull.extracted.from.android + compileOnly libs.xmlpull implementation libs.okhttp testImplementation libs.junit testImplementation libs.truth testImplementation libs.mockito.inline testImplementation libs.mockito.kotlin - testImplementation libs.kxml2.extracted.from.android + testImplementation libs.kxml2 } diff --git a/app/core/build.gradle b/app/core/build.gradle index e688309ebb..9c8ca30796 100644 --- a/app/core/build.gradle +++ b/app/core/build.gradle @@ -24,7 +24,7 @@ dependencies { implementation libs.jsoup implementation libs.moshi implementation libs.timber - implementation libs.apache.mime4j.core + implementation libs.mime4j.core testImplementation project(':mail:testing') testImplementation project(":backend:imap") diff --git a/app/storage/build.gradle b/app/storage/build.gradle index d25a949270..d5a8b51c11 100644 --- a/app/storage/build.gradle +++ b/app/storage/build.gradle @@ -9,7 +9,7 @@ dependencies { implementation project(":app:core") implementation libs.androidx.core.ktx implementation libs.timber - implementation libs.apache.mime4j.core + implementation libs.mime4j.core implementation libs.commons.io implementation libs.moshi diff --git a/app/ui/legacy/build.gradle b/app/ui/legacy/build.gradle index dd3575c98c..19dfe3538b 100644 --- a/app/ui/legacy/build.gradle +++ b/app/ui/legacy/build.gradle @@ -35,9 +35,9 @@ dependencies { implementation libs.androidx.swiperefreshlayout implementation libs.ckchangelog.core implementation libs.tokenautocomplete - implementation libs.safe.content.resolver.v21 + implementation libs.safeContentResolver implementation libs.materialdrawer - implementation libs.search.preference + implementation libs.searchPreference implementation libs.fastadapter implementation libs.fastadapter.extensions.drag implementation libs.fastadapter.extensions.utils @@ -48,7 +48,7 @@ dependencies { implementation libs.androidx.core.ktx implementation libs.jcip.annotations implementation libs.timber - implementation libs.apache.mime4j.core + implementation libs.mime4j.core implementation libs.kotlinx.coroutines.core implementation libs.kotlinx.coroutines.android diff --git a/backend/demo/build.gradle b/backend/demo/build.gradle index 21fa15d57c..4e1ea924c7 100644 --- a/backend/demo/build.gradle +++ b/backend/demo/build.gradle @@ -10,7 +10,7 @@ dependencies { implementation libs.kotlinx.coroutines.core implementation libs.moshi - ksp libs.moshi.kotlin.kotgen + ksp libs.moshi.kotlin.codegen testImplementation project(":mail:testing") testImplementation libs.junit diff --git a/backend/imap/build.gradle b/backend/imap/build.gradle index 14c4223e9c..745177e045 100644 --- a/backend/imap/build.gradle +++ b/backend/imap/build.gradle @@ -17,5 +17,5 @@ dependencies { testImplementation libs.mockito.inline testImplementation libs.mockito.kotlin testImplementation libs.truth - testImplementation libs.apache.mime4j.dom + testImplementation libs.mime4j.dom } diff --git a/backend/jmap/build.gradle b/backend/jmap/build.gradle index b27c1b82d8..700abb790b 100644 --- a/backend/jmap/build.gradle +++ b/backend/jmap/build.gradle @@ -11,7 +11,7 @@ dependencies { api libs.okhttp implementation libs.jmap.client implementation libs.moshi - ksp libs.moshi.kotlin.kotgen + ksp libs.moshi.kotlin.codegen testImplementation project(":mail:testing") testImplementation project(':backend:testing') diff --git a/mail/common/build.gradle b/mail/common/build.gradle index 437a21b3ec..e6e6d57cb3 100644 --- a/mail/common/build.gradle +++ b/mail/common/build.gradle @@ -11,8 +11,8 @@ if (rootProject.testCoverage) { dependencies { api libs.jetbrains.annotations - implementation libs.apache.mime4j.core - implementation libs.apache.mime4j.dom + implementation libs.mime4j.core + implementation libs.mime4j.dom implementation libs.okio implementation libs.commons.io implementation libs.moshi diff --git a/mail/protocols/imap/build.gradle b/mail/protocols/imap/build.gradle index 721593e91e..eea587364e 100644 --- a/mail/protocols/imap/build.gradle +++ b/mail/protocols/imap/build.gradle @@ -22,5 +22,5 @@ dependencies { testImplementation libs.mockito.core testImplementation libs.mockito.kotlin testImplementation libs.okio - testImplementation libs.apache.mime4j.core + testImplementation libs.mime4j.core } diff --git a/settings.gradle b/settings.gradle index 0df044039d..da84c945e7 100644 --- a/settings.gradle +++ b/settings.gradle @@ -84,7 +84,7 @@ dependencyResolutionManagement { library('preferencex-colorpicker', 'com.takisoft.preferencex', 'preferencex-colorpicker').versionRef('preferencesFix') library('okio', 'com.squareup.okio', 'okio').version('3.2.0') library('moshi', 'com.squareup.moshi', 'moshi').versionRef('moshi') - library('moshi-kotlin-kotgen', 'com.squareup.moshi', 'moshi-kotlin-codegen').versionRef('moshi') + library('moshi-kotlin-codegen', 'com.squareup.moshi', 'moshi-kotlin-codegen').versionRef('moshi') library('timber', 'com.jakewharton.timber', 'timber').version('5.0.1') library('koin-core', 'io.insert-koin', 'koin-core').versionRef('koin') library('koin-android', 'io.insert-koin', 'koin-android').versionRef('koin') @@ -94,8 +94,8 @@ dependencyResolutionManagement { // that is not available until Android API 26 (even with desugaring enabled). // See https://issuetracker.google.com/issues/160484830 library('commons-io', 'commons-io', 'commons-io').version('2.6') - library('apache-mime4j-core', 'org.apache.james', 'apache-mime4j-core').versionRef('mime4j') - library('apache-mime4j-dom', 'org.apache.james', 'apache-mime4j-dom').versionRef('mime4j') + library('mime4j-core', 'org.apache.james', 'apache-mime4j-core').versionRef('mime4j') + library('mime4j-dom', 'org.apache.james', 'apache-mime4j-dom').versionRef('mime4j') library('okhttp', 'com.squareup.okhttp3', 'okhttp').versionRef('okhttp') library('okhttp-mockwebserver', 'com.squareup.okhttp3', 'mockwebserver').versionRef('okhttp') library('minidns-hla', 'org.minidns', 'minidns-hla').version('1.0.4') @@ -111,12 +111,12 @@ dependencyResolutionManagement { library('jmap-client', 'rs.ltt.jmap', 'jmap-client').version('0.3.1') library('circleimageview', 'de.hdodenhof', 'circleimageview').version('3.1.0') library('appauth', 'net.openid', 'appauth').version('0.11.1') - library('search-preference', 'com.github.ByteHamster', 'SearchPreference').version('v2.3.0') - library('safe-content-resolver-v21', 'de.cketti.safecontentresolver', 'safe-content-resolver-v21').version('1.0.0') + library('searchPreference', 'com.github.ByteHamster', 'SearchPreference').version('v2.3.0') + library('safeContentResolver', 'de.cketti.safecontentresolver', 'safe-content-resolver-v21').version('1.0.0') library('tokenautocomplete', 'com.splitwise', 'tokenautocomplete').version('4.0.0-beta01') library('ckchangelog-core', 'de.cketti.library.changelog', 'ckchangelog-core').version('2.0.0-beta02') - library('xmlpull-extracted-from-android', 'com.github.cketti', 'xmlpull-extracted-from-android').version('1.0') - library('kxml2-extracted-from-android', 'com.github.cketti', 'kxml2-extracted-from-android').version('1.0') + library('xmlpull', 'com.github.cketti', 'xmlpull-extracted-from-android').version('1.0') + library('kxml2', 'com.github.cketti', 'kxml2-extracted-from-android').version('1.0') library('junit', 'junit', 'junit').version('4.13.2') library('robolectric', 'org.robolectric', 'robolectric').version('4.9') -- GitLab From 7e8c7f18db15f920cf8e48aa80e9a381b7dee0a9 Mon Sep 17 00:00:00 2001 From: cketti Date: Fri, 13 Jan 2023 16:54:39 +0100 Subject: [PATCH 04/37] Switch to TOML file for Gradle version catalog --- gradle/libs.versions.toml | 126 +++++++++++++++++++++++++++++++++++++ settings.gradle | 127 -------------------------------------- 2 files changed, 126 insertions(+), 127 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000000..16df906993 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,126 @@ +# Judging the impact of newer library versions on the app requires being intimately familiar with the code base. +# Please don't open pull requests upgrading dependencies if you're a new contributor. + +[versions] +java = "1.8" +androidGradlePlugin = "7.3.1" +ktlint = "0.44.0" + +kotlin = "1.7.22" +kotlinCoroutines = "1.6.4" +jetbrainsAnnotations = "23.0.0" +androidxAppCompat = "1.5.1" +androidxActivity = "1.6.0" +androidxRecyclerView = "1.2.1" +androidxLifecycle = "2.5.1" +androidxNavigation = "2.5.2" +androidxConstraintLayout = "2.1.4" +androidxFragment = "1.5.3" +androidxCore = "1.9.0" +androidxPreference = "1.2.0" +androidxDrawerLayout = "1.1.1" +androidxTransition = "1.4.1" +fastAdapter = "5.7.0" +preferencesFix = "1.1.0" +timber = "5.0.1" +koin = "3.2.2" +mime4j = "0.8.6" +okhttp = "4.10.0" +glide = "4.14.2" +moshi = "1.14.0" +mockito = "4.8.0" + +[plugins] +android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } +android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" } +android-lint = { id = "com.android.lint", version.ref = "androidGradlePlugin" } +ksp = "com.google.devtools.ksp:1.7.22-1.0.8" +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" } +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +ktlint = "org.jlleitschuh.gradle.ktlint:11.0.0" + +[libraries] +kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } +kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } +kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinCoroutines" } +kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinCoroutines" } +kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinCoroutines" } +jetbrains-annotations = { module = "org.jetbrains:annotations", version.ref = "jetbrainsAnnotations" } +androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidxAppCompat" } +androidx-activity = { module = "androidx.activity:activity", version.ref = "androidxActivity" } +androidx-recyclerview = { module = "androidx.recyclerview:recyclerview", version.ref = "androidxRecyclerView" } +androidx-lifecycle-common = { module = "androidx.lifecycle:lifecycle-common", version.ref = "androidxLifecycle" } +androidx-lifecycle-livedata-ktx = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "androidxLifecycle" } +androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "androidxLifecycle" } +androidx-lifecycle-viewmodel-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "androidxLifecycle" } +androidx-annotation = "androidx.annotation:annotation:1.5.0" +androidx-biometric = "androidx.biometric:biometric:1.1.0" +androidx-navigation-fragment = { module = "androidx.navigation:navigation-fragment", version.ref = "androidxNavigation" } +androidx-navigation-ui = { module = "androidx.navigation:navigation-ui", version.ref = "androidxNavigation" } +androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "androidxConstraintLayout" } +androidx-work-ktx = "androidx.work:work-runtime-ktx:2.7.1" +androidx-fragment = { module = "androidx.fragment:fragment", version.ref = "androidxFragment" } +androidx-localbroadcastmanager = "androidx.localbroadcastmanager:localbroadcastmanager:1.1.0" +androidx-core = { module = "androidx.core:core", version.ref = "androidxCore" } +androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "androidxCore" } +androidx-cardview = "androidx.cardview:cardview:1.0.0" +androidx-preference = { module = "androidx.preference:preference", version.ref = "androidxPreference" } +androidx-swiperefreshlayout = "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" +androidx-test-core = "androidx.test:core:1.4.0" +android-material = "com.google.android.material:material:1.6.1" +fastadapter = { module = "com.mikepenz:fastadapter", version.ref = "fastAdapter" } +fastadapter-extensions-drag = { module = "com.mikepenz:fastadapter-extensions-drag", version.ref = "fastAdapter" } +fastadapter-extensions-utils = { module = "com.mikepenz:fastadapter-extensions-utils", version.ref = "fastAdapter" } +materialdrawer = "com.mikepenz:materialdrawer:8.4.5" +preferencex = { module = "com.takisoft.preferencex:preferencex", version.ref = "preferencesFix" } +preferencex-datetimepicker = { module = "com.takisoft.preferencex:preferencex-datetimepicker", version.ref = "preferencesFix" } +preferencex-colorpicker = { module = "com.takisoft.preferencex:preferencex-colorpicker", version.ref = "preferencesFix" } +okio = "com.squareup.okio:okio:3.2.0" +moshi = { module = "com.squareup.moshi:moshi", version.ref = "moshi" } +moshi-kotlin-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref = "moshi" } +timber = "com.jakewharton.timber:timber:5.0.1" +koin-core = { module = "io.insert-koin:koin-core", version.ref = "koin" } +koin-android = { module = "io.insert-koin:koin-android", version.ref = "koin" } +koin-test = { module = "io.insert-koin:koin-test", version.ref = "koin" } +koin-test-junit4 = { module = "io.insert-koin:koin-test-junit4", version.ref = "koin" } + +# We can't upgrade Commons IO beyond this version because starting with 2.7 it is using Java 8 API +# that is not available until Android API 26 (even with desugaring enabled). +# See https://issuetracker.google.com/issues/160484830 +commons-io = "commons-io:commons-io:2.6" +mime4j-core = { module = "org.apache.james:apache-mime4j-core", version.ref = "mime4j" } +mime4j-dom = { module = "org.apache.james:apache-mime4j-dom", version.ref = "mime4j" } +okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" } +okhttp-mockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "okhttp" } +minidns-hla = "org.minidns:minidns-hla:1.0.4" +glide = { module = "com.github.bumptech.glide:glide", version.ref = "glide" } +glide-compiler = { module = "com.github.bumptech.glide:compiler", version.ref = "glide" } +jsoup = "org.jsoup:jsoup:1.15.3" +apache-httpclient = "org.apache.httpcomponents:httpclient:4.5.13" +apache-httpclient5 = "org.apache.httpcomponents.client5:httpclient5:5.1.3" +clikt = "com.github.ajalt.clikt:clikt:3.4.0" +jzlib = "com.jcraft:jzlib:1.0.7" +jutf7 = "com.beetstra.jutf7:jutf7:1.0.0" +jcip-annotations = "net.jcip:jcip-annotations:1.0" +jmap-client = "rs.ltt.jmap:jmap-client:0.3.1" +circleimageview = "de.hdodenhof:circleimageview:3.1.0" +appauth = "net.openid:appauth:0.11.1" +searchPreference = "com.github.ByteHamster:SearchPreference:v2.3.0" +safeContentResolver = "de.cketti.safecontentresolver:safe-content-resolver-v21:1.0.0" +tokenautocomplete = "com.splitwise:tokenautocomplete:4.0.0-beta01" +ckchangelog-core = "de.cketti.library.changelog:ckchangelog-core:2.0.0-beta02" +xmlpull = "com.github.cketti:xmlpull-extracted-from-android:1.0" +kxml2 = "com.github.cketti:kxml2-extracted-from-android:1.0" + +junit = "junit:junit:4.13.2" +robolectric = "org.robolectric:robolectric:4.9" +mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" } +mockito-inline = { module = "org.mockito:mockito-inline", version.ref = "mockito" } +mockito-kotlin = "org.mockito.kotlin:mockito-kotlin:4.0.0" +truth = "com.google.truth:truth:1.1.3" +turbine = "app.cash.turbine:turbine:0.11.0" +jdom2 = "org.jdom:jdom2:2.0.6" +icu4j-charset = "com.ibm.icu:icu4j-charset:70.1" + +leakcanary-android = "com.squareup.leakcanary:leakcanary-android:2.9.1" diff --git a/settings.gradle b/settings.gradle index da84c945e7..12697df787 100644 --- a/settings.gradle +++ b/settings.gradle @@ -13,133 +13,6 @@ dependencyResolutionManagement { mavenCentral() maven { url 'https://jitpack.io' } } - - versionCatalogs { - libs { - // Judging the impact of newer library versions on the app requires being intimately familiar with the code - // base. Please don't open pull requests upgrading dependencies if you're a new contributor. - version('java', '1.8') - version('androidGradlePlugin', '7.3.1') - version('ktlint', '0.44.0') - - version('kotlin', '1.7.22') - version('kotlinCoroutines', '1.6.4') - version('jetbrainsAnnotations', '23.0.0') - version('androidxAppCompat', '1.5.1') - version('androidxActivity', '1.6.0') - version('androidxRecyclerView', '1.2.1') - version('androidxLifecycle', '2.5.1') - version('androidxNavigation', '2.5.2') - version('androidxConstraintLayout', '2.1.4') - version('androidxFragment', '1.5.3') - version('androidxCore', '1.9.0') - version('androidxPreference', '1.2.0') - version('androidxDrawerLayout', '1.1.1') - version('androidxTransition', '1.4.1') - version('fastAdapter', '5.7.0') - version('preferencesFix', '1.1.0') - version('timber', '5.0.1') - version('koin', '3.2.2') - version('mime4j', '0.8.6') - version('okhttp', '4.10.0') - version('glide', '4.14.2') - version('moshi', '1.14.0') - version('mockito', '4.8.0') - - - library('kotlin-test', 'org.jetbrains.kotlin', 'kotlin-test').versionRef('kotlin') - library('kotlin-reflect', 'org.jetbrains.kotlin', 'kotlin-reflect').versionRef('kotlin') - library('kotlinx-coroutines-core', 'org.jetbrains.kotlinx', 'kotlinx-coroutines-core').versionRef('kotlinCoroutines') - library('kotlinx-coroutines-android', 'org.jetbrains.kotlinx', 'kotlinx-coroutines-android').versionRef('kotlinCoroutines') - library('kotlinx-coroutines-test', 'org.jetbrains.kotlinx', 'kotlinx-coroutines-test').versionRef('kotlinCoroutines') - library('jetbrains-annotations', 'org.jetbrains', 'annotations').versionRef('jetbrainsAnnotations') - library('androidx-appcompat', 'androidx.appcompat', 'appcompat').versionRef('androidxAppCompat') - library('androidx-activity', 'androidx.activity', 'activity').versionRef('androidxActivity') - library('androidx-recyclerview', 'androidx.recyclerview', 'recyclerview').versionRef('androidxRecyclerView') - library('androidx-lifecycle-common', 'androidx.lifecycle', 'lifecycle-common').versionRef('androidxLifecycle') - library('androidx-lifecycle-livedata-ktx', 'androidx.lifecycle', 'lifecycle-livedata-ktx').versionRef('androidxLifecycle') - library('androidx-lifecycle-runtime-ktx', 'androidx.lifecycle', 'lifecycle-runtime-ktx').versionRef('androidxLifecycle') - library('androidx-lifecycle-viewmodel-ktx', 'androidx.lifecycle', 'lifecycle-viewmodel-ktx').versionRef('androidxLifecycle') - library('androidx-annotation', 'androidx.annotation', 'annotation').version('1.5.0') - library('androidx-biometric', 'androidx.biometric', 'biometric').version('1.1.0') - library('androidx-navigation-fragment', 'androidx.navigation', 'navigation-fragment').versionRef('androidxNavigation') - library('androidx-navigation-ui', 'androidx.navigation', 'navigation-ui').versionRef('androidxNavigation') - library('androidx-constraintlayout', 'androidx.constraintlayout', 'constraintlayout').versionRef('androidxConstraintLayout') - library('androidx-work-ktx', 'androidx.work', 'work-runtime-ktx').version('2.7.1') - library('androidx-fragment', 'androidx.fragment', 'fragment').versionRef('androidxFragment') - library('androidx-localbroadcastmanager', 'androidx.localbroadcastmanager', 'localbroadcastmanager').version('1.1.0') - library('androidx-core', 'androidx.core', 'core').versionRef('androidxCore') - library('androidx-core-ktx', 'androidx.core', 'core-ktx').versionRef('androidxCore') - library('androidx-cardview', 'androidx.cardview', 'cardview').version('1.0.0') - library('androidx-preference', 'androidx.preference', 'preference').versionRef('androidxPreference') - library('androidx-swiperefreshlayout', 'androidx.swiperefreshlayout', 'swiperefreshlayout').version('1.1.0') - library('androidx-test-core', 'androidx.test', 'core').version('1.4.0') - library('android-material', 'com.google.android.material', 'material').version('1.6.1') - library('fastadapter', 'com.mikepenz', 'fastadapter').versionRef('fastAdapter') - library('fastadapter-extensions-drag', 'com.mikepenz', 'fastadapter-extensions-drag').versionRef('fastAdapter') - library('fastadapter-extensions-utils', 'com.mikepenz', 'fastadapter-extensions-utils').versionRef('fastAdapter') - library('materialdrawer', 'com.mikepenz', 'materialdrawer').version('8.4.5') - library('preferencex', 'com.takisoft.preferencex', 'preferencex').versionRef('preferencesFix') - library('preferencex-datetimepicker', 'com.takisoft.preferencex', 'preferencex-datetimepicker').versionRef('preferencesFix') - library('preferencex-colorpicker', 'com.takisoft.preferencex', 'preferencex-colorpicker').versionRef('preferencesFix') - library('okio', 'com.squareup.okio', 'okio').version('3.2.0') - library('moshi', 'com.squareup.moshi', 'moshi').versionRef('moshi') - library('moshi-kotlin-codegen', 'com.squareup.moshi', 'moshi-kotlin-codegen').versionRef('moshi') - library('timber', 'com.jakewharton.timber', 'timber').version('5.0.1') - library('koin-core', 'io.insert-koin', 'koin-core').versionRef('koin') - library('koin-android', 'io.insert-koin', 'koin-android').versionRef('koin') - library('koin-test', 'io.insert-koin', 'koin-test').versionRef('koin') - library('koin-test-junit4', 'io.insert-koin', 'koin-test-junit4').versionRef('koin') - // We can't upgrade Commons IO beyond this version because starting with 2.7 it is using Java 8 API - // that is not available until Android API 26 (even with desugaring enabled). - // See https://issuetracker.google.com/issues/160484830 - library('commons-io', 'commons-io', 'commons-io').version('2.6') - library('mime4j-core', 'org.apache.james', 'apache-mime4j-core').versionRef('mime4j') - library('mime4j-dom', 'org.apache.james', 'apache-mime4j-dom').versionRef('mime4j') - library('okhttp', 'com.squareup.okhttp3', 'okhttp').versionRef('okhttp') - library('okhttp-mockwebserver', 'com.squareup.okhttp3', 'mockwebserver').versionRef('okhttp') - library('minidns-hla', 'org.minidns', 'minidns-hla').version('1.0.4') - library('glide', 'com.github.bumptech.glide', 'glide').versionRef('glide') - library('glide-compiler', 'com.github.bumptech.glide', 'compiler').versionRef('glide') - library('jsoup', 'org.jsoup', 'jsoup').version('1.15.3') - library('apache-httpclient', 'org.apache.httpcomponents', 'httpclient').version('4.5.13') - library('apache-httpclient5', 'org.apache.httpcomponents.client5', 'httpclient5').version('5.1.3') - library('clikt', 'com.github.ajalt.clikt', 'clikt').version('3.4.0') - library('jzlib', 'com.jcraft', 'jzlib').version('1.0.7') - library('jutf7', 'com.beetstra.jutf7', 'jutf7').version('1.0.0') - library('jcip-annotations', 'net.jcip', 'jcip-annotations').version('1.0') - library('jmap-client', 'rs.ltt.jmap', 'jmap-client').version('0.3.1') - library('circleimageview', 'de.hdodenhof', 'circleimageview').version('3.1.0') - library('appauth', 'net.openid', 'appauth').version('0.11.1') - library('searchPreference', 'com.github.ByteHamster', 'SearchPreference').version('v2.3.0') - library('safeContentResolver', 'de.cketti.safecontentresolver', 'safe-content-resolver-v21').version('1.0.0') - library('tokenautocomplete', 'com.splitwise', 'tokenautocomplete').version('4.0.0-beta01') - library('ckchangelog-core', 'de.cketti.library.changelog', 'ckchangelog-core').version('2.0.0-beta02') - library('xmlpull', 'com.github.cketti', 'xmlpull-extracted-from-android').version('1.0') - library('kxml2', 'com.github.cketti', 'kxml2-extracted-from-android').version('1.0') - - library('junit', 'junit', 'junit').version('4.13.2') - library('robolectric', 'org.robolectric', 'robolectric').version('4.9') - library('mockito-core', 'org.mockito', 'mockito-core').versionRef('mockito') - library('mockito-inline', 'org.mockito', 'mockito-inline').versionRef('mockito') - library('mockito-kotlin', 'org.mockito.kotlin', 'mockito-kotlin').version('4.0.0') - library('truth', 'com.google.truth', 'truth').version('1.1.3') - library('turbine', 'app.cash.turbine', 'turbine').version('0.11.0') - library('jdom2', 'org.jdom', 'jdom2').version('2.0.6') - library('icu4j-charset', 'com.ibm.icu', 'icu4j-charset').version('70.1') - - library('leakcanary-android', 'com.squareup.leakcanary', 'leakcanary-android').version('2.9.1') - - plugin('android-application', 'com.android.application').versionRef('androidGradlePlugin') - plugin('android-library', 'com.android.library').versionRef('androidGradlePlugin') - plugin('android-lint', 'com.android.lint').versionRef('androidGradlePlugin') - plugin('ksp', 'com.google.devtools.ksp').version('1.7.22-1.0.8') - plugin('kotlin-android', 'org.jetbrains.kotlin.android').versionRef('kotlin') - plugin('kotlin-parcelize', 'org.jetbrains.kotlin.plugin.parcelize').versionRef('kotlin') - plugin('kotlin-jvm', 'org.jetbrains.kotlin.jvm').versionRef('kotlin') - plugin('ktlint', 'org.jlleitschuh.gradle.ktlint').version('11.0.0') - } - } } include ':app:k9mail' -- GitLab From a8432dd6d8c0f91c847d59b2814336eb64fbe2c5 Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 14:15:23 +0100 Subject: [PATCH 05/37] SMTP: Log "sensitive" responses when "Log sensitive information" is enabled --- .../java/com/fsck/k9/mail/transport/smtp/SmtpTransport.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mail/protocols/smtp/src/main/java/com/fsck/k9/mail/transport/smtp/SmtpTransport.kt b/mail/protocols/smtp/src/main/java/com/fsck/k9/mail/transport/smtp/SmtpTransport.kt index 0591d664ef..773e515e30 100644 --- a/mail/protocols/smtp/src/main/java/com/fsck/k9/mail/transport/smtp/SmtpTransport.kt +++ b/mail/protocols/smtp/src/main/java/com/fsck/k9/mail/transport/smtp/SmtpTransport.kt @@ -283,8 +283,9 @@ class SmtpTransport( logResponse(smtpResponse) } - private fun logResponse(smtpResponse: SmtpResponse, omitText: Boolean = false) { + private fun logResponse(smtpResponse: SmtpResponse, sensitive: Boolean = false) { if (K9MailLib.isDebug()) { + val omitText = sensitive && !K9MailLib.isDebugSensitive() Timber.v("%s", smtpResponse.toLogString(omitText, linePrefix = "SMTP <<< ")) } } @@ -532,7 +533,7 @@ class SmtpTransport( repeat(pipelinedCommands.size) { val response = responseParser.readResponse(isEnhancedStatusCodesProvided) - logResponse(response, omitText = false) + logResponse(response) if (response.isNegativeResponse && firstException == null) { firstException = buildNegativeSmtpReplyException(response) -- GitLab From 8988b85e693b5cc5a0f3d5bd65d2cc481dc6a19d Mon Sep 17 00:00:00 2001 From: cketti Date: Fri, 13 Jan 2023 11:40:55 +0100 Subject: [PATCH 06/37] Make color of the selection check mark part of the theme --- app/ui/legacy/src/main/res/drawable/ic_check_circle_large.xml | 2 +- app/ui/legacy/src/main/res/values/attrs.xml | 1 + app/ui/legacy/src/main/res/values/themes.xml | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/ui/legacy/src/main/res/drawable/ic_check_circle_large.xml b/app/ui/legacy/src/main/res/drawable/ic_check_circle_large.xml index 6483898ca3..52c9bcc0da 100644 --- a/app/ui/legacy/src/main/res/drawable/ic_check_circle_large.xml +++ b/app/ui/legacy/src/main/res/drawable/ic_check_circle_large.xml @@ -6,7 +6,7 @@ + diff --git a/app/ui/legacy/src/main/res/values/themes.xml b/app/ui/legacy/src/main/res/values/themes.xml index 4cc3fd819c..eb188d569e 100644 --- a/app/ui/legacy/src/main/res/values/themes.xml +++ b/app/ui/legacy/src/main/res/values/themes.xml @@ -87,6 +87,7 @@ @drawable/ic_import_status @android:color/primary_text_light @android:color/secondary_text_light + #ff1976d2 #ff99d9ee ?android:attr/windowBackground #ffd8d8d8 @@ -240,6 +241,7 @@ @drawable/ic_import_status @android:color/primary_text_dark @android:color/secondary_text_dark + #ff1976d2 #ff347489 ?android:attr/windowBackground ?attr/messageListRegularItemBackgroundColor -- GitLab From 5db9401f55b56aaebc1d7740b9f2ebe077ec3a27 Mon Sep 17 00:00:00 2001 From: cketti Date: Fri, 13 Jan 2023 12:03:48 +0100 Subject: [PATCH 07/37] Make colors of the floating action button part of the theme --- app/ui/legacy/src/main/res/layout/message_list_fragment.xml | 5 ++++- app/ui/legacy/src/main/res/values/attrs.xml | 2 ++ app/ui/legacy/src/main/res/values/themes.xml | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/ui/legacy/src/main/res/layout/message_list_fragment.xml b/app/ui/legacy/src/main/res/layout/message_list_fragment.xml index 6e7996124d..975566b9a5 100644 --- a/app/ui/legacy/src/main/res/layout/message_list_fragment.xml +++ b/app/ui/legacy/src/main/res/layout/message_list_fragment.xml @@ -33,6 +33,9 @@ android:layout_margin="@dimen/floatingActionButtonMargin" android:contentDescription="@string/compose_action" android:text="@string/compose_action" - app:icon="?attr/iconActionCompose" /> + android:textColor="?attr/floatingActionButtonForegroundColor" + app:backgroundTint="?attr/floatingActionButtonBackgroundColor" + app:icon="?attr/iconActionCompose" + app:iconTint="?attr/floatingActionButtonForegroundColor" /> diff --git a/app/ui/legacy/src/main/res/values/attrs.xml b/app/ui/legacy/src/main/res/values/attrs.xml index 33a6e920a0..63f88c638e 100644 --- a/app/ui/legacy/src/main/res/values/attrs.xml +++ b/app/ui/legacy/src/main/res/values/attrs.xml @@ -4,6 +4,8 @@ + + diff --git a/app/ui/legacy/src/main/res/values/themes.xml b/app/ui/legacy/src/main/res/values/themes.xml index eb188d569e..a2df7c8449 100644 --- a/app/ui/legacy/src/main/res/values/themes.xml +++ b/app/ui/legacy/src/main/res/values/themes.xml @@ -22,6 +22,8 @@ @color/material_pink_200 #ffffff @color/material_gray_50 + ?attr/colorSecondary + ?attr/colorOnSecondary @style/Widget.K9.Toolbar @style/PreferenceThemeOverlay @@ -176,6 +178,8 @@ @color/material_pink_300 @color/material_pink_500 @color/material_gray_900 + ?attr/colorSecondary + ?attr/colorOnSecondary @style/Widget.K9.Toolbar @style/PreferenceThemeOverlay -- GitLab From 9bed86a636be62ce4d09522672763e70561701e8 Mon Sep 17 00:00:00 2001 From: cketti Date: Fri, 13 Jan 2023 12:22:25 +0100 Subject: [PATCH 08/37] Change themes to use shades of gray as primary color Also use the primary color for the floating action button. --- app/ui/legacy/src/main/res/values/themes.xml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/ui/legacy/src/main/res/values/themes.xml b/app/ui/legacy/src/main/res/values/themes.xml index a2df7c8449..acbd8019a3 100644 --- a/app/ui/legacy/src/main/res/values/themes.xml +++ b/app/ui/legacy/src/main/res/values/themes.xml @@ -16,14 +16,14 @@ @color/material_gray_100 @color/material_gray_100 - @color/material_blue_600 - @color/material_blue_800 - @color/material_pink_400 - @color/material_pink_200 + @color/material_gray_800 + @color/material_gray_700 + @color/material_pink_500 + @color/material_pink_300 #ffffff @color/material_gray_50 - ?attr/colorSecondary - ?attr/colorOnSecondary + ?attr/colorPrimary + ?attr/colorOnPrimary @style/Widget.K9.Toolbar @style/PreferenceThemeOverlay @@ -173,13 +173,13 @@ @color/material_gray_900 @color/material_gray_900 - @color/material_blue_400 - @color/material_blue_600 + @color/material_gray_100 + @color/material_gray_50 @color/material_pink_300 @color/material_pink_500 @color/material_gray_900 - ?attr/colorSecondary - ?attr/colorOnSecondary + ?attr/colorPrimary + ?attr/colorOnPrimary @style/Widget.K9.Toolbar @style/PreferenceThemeOverlay -- GitLab From 6244ea65735735046c1ea7c756aa232c7e23e397 Mon Sep 17 00:00:00 2001 From: cketti Date: Fri, 13 Jan 2023 13:10:26 +0100 Subject: [PATCH 09/37] Change colors for selected/active messages in the message list We can't use semi-transparent colors because the message list item backgrounds are drawn on top of other colors when using swipe actions. Instead, we mix the colors ourselves, e.g. 60% of ?attr/colorSecondaryVariant on ?attr/colorSurface --- .../java/com/fsck/k9/ui/ThemeExtensions.kt | 27 +++++++++++++++++++ .../k9/ui/messagelist/MessageListAdapter.kt | 12 +++++++-- app/ui/legacy/src/main/res/values/attrs.xml | 4 +++ app/ui/legacy/src/main/res/values/themes.xml | 20 +++++++++----- 4 files changed, 55 insertions(+), 8 deletions(-) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/ThemeExtensions.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/ThemeExtensions.kt index d8aa489e09..51c73e2d0a 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/ThemeExtensions.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/ThemeExtensions.kt @@ -1,6 +1,7 @@ package com.fsck.k9.ui import android.content.res.Resources.Theme +import android.graphics.Color import android.graphics.drawable.Drawable import android.util.TypedValue @@ -15,6 +16,32 @@ fun Theme.resolveColorAttribute(attrId: Int): Int { return typedValue.data } +fun Theme.resolveColorAttribute(colorAttrId: Int, alphaFractionAttrId: Int, backgroundColorAttrId: Int): Int { + val typedValue = TypedValue() + + if (!resolveAttribute(colorAttrId, typedValue, true)) { + error("Couldn't resolve attribute ($colorAttrId)") + } + val color = typedValue.data + + if (!resolveAttribute(alphaFractionAttrId, typedValue, true)) { + error("Couldn't resolve attribute ($alphaFractionAttrId)") + } + val colorPercentage = TypedValue.complexToFloat(typedValue.data) + val backgroundPercentage = 1 - colorPercentage + + if (!resolveAttribute(backgroundColorAttrId, typedValue, true)) { + error("Couldn't resolve attribute ($colorAttrId)") + } + val backgroundColor = typedValue.data + + val red = colorPercentage * Color.red(color) + backgroundPercentage * Color.red(backgroundColor) + val green = colorPercentage * Color.green(color) + backgroundPercentage * Color.green(backgroundColor) + val blue = colorPercentage * Color.blue(color) + backgroundPercentage * Color.blue(backgroundColor) + + return Color.rgb(red.toInt(), green.toInt(), blue.toInt()) +} + fun Theme.resolveDrawableAttribute(attrId: Int): Drawable { val typedValue = TypedValue() diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListAdapter.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListAdapter.kt index b58281a031..18c937c28f 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListAdapter.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messagelist/MessageListAdapter.kt @@ -51,8 +51,16 @@ class MessageListAdapter internal constructor( private val answeredIcon: Drawable = theme.resolveDrawableAttribute(R.attr.messageListAnswered) private val forwardedAnsweredIcon: Drawable = theme.resolveDrawableAttribute(R.attr.messageListAnsweredForwarded) private val previewTextColor: Int = theme.resolveColorAttribute(R.attr.messageListPreviewTextColor) - private val activeItemBackgroundColor: Int = theme.resolveColorAttribute(R.attr.messageListActiveItemBackgroundColor) - private val selectedItemBackgroundColor: Int = theme.resolveColorAttribute(R.attr.messageListSelectedBackgroundColor) + private val activeItemBackgroundColor: Int = theme.resolveColorAttribute( + colorAttrId = R.attr.messageListActiveItemBackgroundColor, + alphaFractionAttrId = R.attr.messageListActiveItemBackgroundAlphaFraction, + backgroundColorAttrId = R.attr.messageListActiveItemBackgroundAlphaBackground + ) + private val selectedItemBackgroundColor: Int = theme.resolveColorAttribute( + colorAttrId = R.attr.messageListSelectedBackgroundColor, + alphaFractionAttrId = R.attr.messageListSelectedBackgroundAlphaFraction, + backgroundColorAttrId = R.attr.messageListSelectedBackgroundAlphaBackground + ) private val regularItemBackgroundColor: Int = theme.resolveColorAttribute(R.attr.messageListRegularItemBackgroundColor) private val readItemBackgroundColor: Int = theme.resolveColorAttribute(R.attr.messageListReadItemBackgroundColor) private val unreadItemBackgroundColor: Int = theme.resolveColorAttribute(R.attr.messageListUnreadItemBackgroundColor) diff --git a/app/ui/legacy/src/main/res/values/attrs.xml b/app/ui/legacy/src/main/res/values/attrs.xml index 63f88c638e..c17bff604e 100644 --- a/app/ui/legacy/src/main/res/values/attrs.xml +++ b/app/ui/legacy/src/main/res/values/attrs.xml @@ -69,12 +69,16 @@ + + + + diff --git a/app/ui/legacy/src/main/res/values/themes.xml b/app/ui/legacy/src/main/res/values/themes.xml index acbd8019a3..55c4b43a11 100644 --- a/app/ui/legacy/src/main/res/values/themes.xml +++ b/app/ui/legacy/src/main/res/values/themes.xml @@ -89,14 +89,18 @@ @drawable/ic_import_status @android:color/primary_text_light @android:color/secondary_text_light - #ff1976d2 - #ff99d9ee + ?attr/colorSecondary + ?attr/colorSecondaryVariant + 33% + ?attr/colorSurface ?android:attr/windowBackground #ffd8d8d8 ?attr/messageListRegularItemBackgroundColor ?android:attr/colorBackground @drawable/thread_count_box_light - #ff2ea7d1 + ?attr/colorSecondaryVariant + 60% + ?attr/colorSurface #ff696969 #ffcccccc #bbbbbb @@ -245,14 +249,18 @@ @drawable/ic_import_status @android:color/primary_text_dark @android:color/secondary_text_dark - #ff1976d2 - #ff347489 + ?attr/colorSecondary + ?attr/colorSecondaryVariant + 25% + ?attr/colorSurface ?android:attr/windowBackground ?attr/messageListRegularItemBackgroundColor #ff505050 ?android:attr/colorBackground @drawable/thread_count_box_dark - #ff33b5e5 + ?attr/colorSecondaryVariant + 50% + ?attr/colorSurface #ffa0a0a0 #ff333333 #777777 -- GitLab From 6a5263aa415b87a1bbaaad51ad8e5ee5d6eed1c7 Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 16:24:13 +0100 Subject: [PATCH 10/37] Update Android Gradle Plugin to version 7.4.0 --- app/k9mail/build.gradle | 36 +++++++++++++-------- backend/webdav/src/main/AndroidManifest.xml | 2 -- gradle/libs.versions.toml | 2 +- 3 files changed, 23 insertions(+), 17 deletions(-) delete mode 100644 backend/webdav/src/main/AndroidManifest.xml diff --git a/app/k9mail/build.gradle b/app/k9mail/build.gradle index 592897eb00..a8f38f418e 100644 --- a/app/k9mail/build.gradle +++ b/app/k9mail/build.gradle @@ -103,24 +103,32 @@ android { } } - lintOptions { + lint { checkDependencies true } packagingOptions { - exclude 'META-INF/DEPENDENCIES' - exclude 'META-INF/LICENSE' - exclude 'META-INF/LICENSE.txt' - exclude 'META-INF/NOTICE' - exclude 'META-INF/NOTICE.txt' - exclude 'META-INF/README' - exclude 'META-INF/README.md' - exclude 'META-INF/CHANGES' - exclude 'LICENSE.txt' - exclude 'META-INF/*.kotlin_module' - exclude 'META-INF/*.version' - exclude 'kotlin/**' - exclude 'DebugProbesKt.bin' + jniLibs { + excludes += ['kotlin/**'] + } + + resources { + excludes += [ + 'META-INF/DEPENDENCIES', + 'META-INF/LICENSE', + 'META-INF/LICENSE.txt', + 'META-INF/NOTICE', + 'META-INF/NOTICE.txt', + 'META-INF/README', + 'META-INF/README.md', + 'META-INF/CHANGES', + 'LICENSE.txt', + 'META-INF/*.kotlin_module', + 'META-INF/*.version', + 'kotlin/**', + 'DebugProbesKt.bin' + ] + } } dependenciesInfo { diff --git a/backend/webdav/src/main/AndroidManifest.xml b/backend/webdav/src/main/AndroidManifest.xml deleted file mode 100644 index 7299b9e31b..0000000000 --- a/backend/webdav/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 16df906993..c866baf682 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,7 +3,7 @@ [versions] java = "1.8" -androidGradlePlugin = "7.3.1" +androidGradlePlugin = "7.4.0" ktlint = "0.44.0" kotlin = "1.7.22" -- GitLab From 6981490861f6aac161a7805d15035b9c532d4b0e Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 17:09:54 +0100 Subject: [PATCH 11/37] Enable core library desugaring --- app/k9mail/build.gradle | 6 ++++++ gradle/libs.versions.toml | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/k9mail/build.gradle b/app/k9mail/build.gradle index a8f38f418e..cde74c44d7 100644 --- a/app/k9mail/build.gradle +++ b/app/k9mail/build.gradle @@ -8,6 +8,8 @@ if (rootProject.testCoverage) { } dependencies { + coreLibraryDesugaring libs.desugar + implementation project(":app:ui:legacy") implementation project(":app:ui:message-list-widget") implementation project(":app:core") @@ -69,6 +71,10 @@ android { release } + compileOptions { + coreLibraryDesugaringEnabled true + } + buildTypes { release { if (project.hasProperty('storeFile')) { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c866baf682..635ce4a23c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,7 @@ # Please don't open pull requests upgrading dependencies if you're a new contributor. [versions] -java = "1.8" +java = "11" androidGradlePlugin = "7.4.0" ktlint = "0.44.0" @@ -41,6 +41,8 @@ kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } ktlint = "org.jlleitschuh.gradle.ktlint:11.0.0" [libraries] +desugar = "com.android.tools:desugar_jdk_libs:1.1.8" + kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinCoroutines" } -- GitLab From 2b25d0d1ac51e3e17bcd4da17c8b6ffc02c63510 Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 17:34:19 +0100 Subject: [PATCH 12/37] Update Kotlin to version 1.8.0 --- gradle/libs.versions.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 635ce4a23c..307a5f616f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ java = "11" androidGradlePlugin = "7.4.0" ktlint = "0.44.0" -kotlin = "1.7.22" +kotlin = "1.8.0" kotlinCoroutines = "1.6.4" jetbrainsAnnotations = "23.0.0" androidxAppCompat = "1.5.1" @@ -34,7 +34,7 @@ mockito = "4.8.0" android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" } android-lint = { id = "com.android.lint", version.ref = "androidGradlePlugin" } -ksp = "com.google.devtools.ksp:1.7.22-1.0.8" +ksp = "com.google.devtools.ksp:1.8.0-1.0.8" kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } -- GitLab From 7577e66f3b33664b8c1be3bedcf608470a5b72ea Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 17:15:21 +0100 Subject: [PATCH 13/37] Update Jetbrains annotations library to version 24.0.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 307a5f616f..f6563999b5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -8,7 +8,7 @@ ktlint = "0.44.0" kotlin = "1.8.0" kotlinCoroutines = "1.6.4" -jetbrainsAnnotations = "23.0.0" +jetbrainsAnnotations = "24.0.0" androidxAppCompat = "1.5.1" androidxActivity = "1.6.0" androidxRecyclerView = "1.2.1" -- GitLab From 48edb196a0a4648705eae1f9184a62f1e6e8d8fc Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 17:37:20 +0100 Subject: [PATCH 14/37] Update AndroidX AppCompat to version 1.6.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f6563999b5..779e059050 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -9,7 +9,7 @@ ktlint = "0.44.0" kotlin = "1.8.0" kotlinCoroutines = "1.6.4" jetbrainsAnnotations = "24.0.0" -androidxAppCompat = "1.5.1" +androidxAppCompat = "1.6.0" androidxActivity = "1.6.0" androidxRecyclerView = "1.2.1" androidxLifecycle = "2.5.1" -- GitLab From 301b951d049580d49e98c958e9cfbc71b546781f Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 17:40:13 +0100 Subject: [PATCH 15/37] Update AndroidX Activity to version 1.6.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 779e059050..dd3c42ce66 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,7 +10,7 @@ kotlin = "1.8.0" kotlinCoroutines = "1.6.4" jetbrainsAnnotations = "24.0.0" androidxAppCompat = "1.6.0" -androidxActivity = "1.6.0" +androidxActivity = "1.6.1" androidxRecyclerView = "1.2.1" androidxLifecycle = "2.5.1" androidxNavigation = "2.5.2" -- GitLab From a32cc421e8b69dd5d158f7d715bf42b51eec1298 Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 17:41:59 +0100 Subject: [PATCH 16/37] Update AndroidX Navigation to version 2.5.3 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index dd3c42ce66..a190aa2454 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -13,7 +13,7 @@ androidxAppCompat = "1.6.0" androidxActivity = "1.6.1" androidxRecyclerView = "1.2.1" androidxLifecycle = "2.5.1" -androidxNavigation = "2.5.2" +androidxNavigation = "2.5.3" androidxConstraintLayout = "2.1.4" androidxFragment = "1.5.3" androidxCore = "1.9.0" -- GitLab From aca40f40bf6de7cba4efa01e113556f278407665 Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 17:43:12 +0100 Subject: [PATCH 17/37] Update AndroidX Fragment to version 1.5.5 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a190aa2454..f9956fc23e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -15,7 +15,7 @@ androidxRecyclerView = "1.2.1" androidxLifecycle = "2.5.1" androidxNavigation = "2.5.3" androidxConstraintLayout = "2.1.4" -androidxFragment = "1.5.3" +androidxFragment = "1.5.5" androidxCore = "1.9.0" androidxPreference = "1.2.0" androidxDrawerLayout = "1.1.1" -- GitLab From 041c890eb9d5fd578e33e11fa8a86774b8598182 Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 17:50:30 +0100 Subject: [PATCH 18/37] Update AndroidX Test Core to version 1.5.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f9956fc23e..ebe3c7a546 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -69,7 +69,7 @@ androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "androidx androidx-cardview = "androidx.cardview:cardview:1.0.0" androidx-preference = { module = "androidx.preference:preference", version.ref = "androidxPreference" } androidx-swiperefreshlayout = "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" -androidx-test-core = "androidx.test:core:1.4.0" +androidx-test-core = "androidx.test:core:1.5.0" android-material = "com.google.android.material:material:1.6.1" fastadapter = { module = "com.mikepenz:fastadapter", version.ref = "fastAdapter" } fastadapter-extensions-drag = { module = "com.mikepenz:fastadapter-extensions-drag", version.ref = "fastAdapter" } -- GitLab From e3782313e0e680c2b17838341e38113e422a9ca8 Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 17:58:47 +0100 Subject: [PATCH 19/37] Update Material Components to version 1.7.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ebe3c7a546..c135777cf2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -70,7 +70,7 @@ androidx-cardview = "androidx.cardview:cardview:1.0.0" androidx-preference = { module = "androidx.preference:preference", version.ref = "androidxPreference" } androidx-swiperefreshlayout = "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0" androidx-test-core = "androidx.test:core:1.5.0" -android-material = "com.google.android.material:material:1.6.1" +android-material = "com.google.android.material:material:1.7.0" fastadapter = { module = "com.mikepenz:fastadapter", version.ref = "fastAdapter" } fastadapter-extensions-drag = { module = "com.mikepenz:fastadapter-extensions-drag", version.ref = "fastAdapter" } fastadapter-extensions-utils = { module = "com.mikepenz:fastadapter-extensions-utils", version.ref = "fastAdapter" } -- GitLab From 54128718c3f06e3ba63c365f4027e1ea3ab30692 Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 18:04:07 +0100 Subject: [PATCH 20/37] Update Okio to version 3.3.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c135777cf2..13f24d4d01 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -78,7 +78,7 @@ materialdrawer = "com.mikepenz:materialdrawer:8.4.5" preferencex = { module = "com.takisoft.preferencex:preferencex", version.ref = "preferencesFix" } preferencex-datetimepicker = { module = "com.takisoft.preferencex:preferencex-datetimepicker", version.ref = "preferencesFix" } preferencex-colorpicker = { module = "com.takisoft.preferencex:preferencex-colorpicker", version.ref = "preferencesFix" } -okio = "com.squareup.okio:okio:3.2.0" +okio = "com.squareup.okio:okio:3.3.0" moshi = { module = "com.squareup.moshi:moshi", version.ref = "moshi" } moshi-kotlin-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref = "moshi" } timber = "com.jakewharton.timber:timber:5.0.1" -- GitLab From e2fbe4382c64461c88ee4182c4c16f0ee3dab410 Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 18:22:04 +0100 Subject: [PATCH 21/37] Update Koin components to version 3.3.2 --- .../java/com/fsck/k9/ui/onboarding/WelcomeFragment.kt | 4 ++-- .../k9/ui/settings/account/AccountSettingsFragment.kt | 4 ++-- .../k9/ui/settings/import/SettingsImportFragment.kt | 4 ++-- gradle/libs.versions.toml | 11 ++++++----- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/onboarding/WelcomeFragment.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/onboarding/WelcomeFragment.kt index 55080bc025..046f48a51d 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/onboarding/WelcomeFragment.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/onboarding/WelcomeFragment.kt @@ -15,11 +15,11 @@ import com.fsck.k9.ui.observeNotNull import com.fsck.k9.ui.settings.import.SettingsImportResultViewModel import com.fsck.k9.ui.settings.import.SettingsImportSuccess import org.koin.android.ext.android.inject -import org.koin.androidx.viewmodel.ext.android.sharedViewModel +import org.koin.androidx.viewmodel.ext.android.activityViewModel class WelcomeFragment : Fragment() { private val htmlToSpanned: HtmlToSpanned by inject() - private val importResultViewModel: SettingsImportResultViewModel by sharedViewModel() + private val importResultViewModel: SettingsImportResultViewModel by activityViewModel() override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { return inflater.inflate(R.layout.fragment_welcome_message, container, false) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsFragment.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsFragment.kt index b79ef71701..8ae3d7cabe 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsFragment.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsFragment.kt @@ -39,14 +39,14 @@ import com.fsck.k9.ui.settings.removeEntry import com.fsck.k9.ui.withArguments import com.takisoft.preferencex.PreferenceFragmentCompat import org.koin.android.ext.android.inject -import org.koin.androidx.viewmodel.ext.android.sharedViewModel +import org.koin.androidx.viewmodel.ext.android.activityViewModel import org.koin.core.parameter.parametersOf import org.openintents.openpgp.OpenPgpApiManager import org.openintents.openpgp.util.OpenPgpKeyPreference import org.openintents.openpgp.util.OpenPgpProviderUtil class AccountSettingsFragment : PreferenceFragmentCompat(), ConfirmationDialogFragmentListener { - private val viewModel: AccountSettingsViewModel by sharedViewModel() + private val viewModel: AccountSettingsViewModel by activityViewModel() private val dataStoreFactory: AccountSettingsDataStoreFactory by inject() private val openPgpApiManager: OpenPgpApiManager by inject { parametersOf(this) } private val messagingController: MessagingController by inject() diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/import/SettingsImportFragment.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/import/SettingsImportFragment.kt index 330b1b5711..4b3399dcbe 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/import/SettingsImportFragment.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/import/SettingsImportFragment.kt @@ -19,12 +19,12 @@ import com.fsck.k9.ui.R import com.fsck.k9.ui.observeNotNull import com.mikepenz.fastadapter.FastAdapter import com.mikepenz.fastadapter.adapters.ItemAdapter -import org.koin.androidx.viewmodel.ext.android.sharedViewModel +import org.koin.androidx.viewmodel.ext.android.activityViewModel import org.koin.androidx.viewmodel.ext.android.viewModel class SettingsImportFragment : Fragment() { private val viewModel: SettingsImportViewModel by viewModel() - private val resultViewModel: SettingsImportResultViewModel by sharedViewModel() + private val resultViewModel: SettingsImportResultViewModel by activityViewModel() private lateinit var settingsImportAdapter: FastAdapter> private lateinit var itemAdapter: ItemAdapter> diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 13f24d4d01..3c47d86165 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -23,7 +23,8 @@ androidxTransition = "1.4.1" fastAdapter = "5.7.0" preferencesFix = "1.1.0" timber = "5.0.1" -koin = "3.2.2" +koinCore = "3.3.2" +koinAndroid = "3.3.2" mime4j = "0.8.6" okhttp = "4.10.0" glide = "4.14.2" @@ -82,10 +83,10 @@ okio = "com.squareup.okio:okio:3.3.0" moshi = { module = "com.squareup.moshi:moshi", version.ref = "moshi" } moshi-kotlin-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref = "moshi" } timber = "com.jakewharton.timber:timber:5.0.1" -koin-core = { module = "io.insert-koin:koin-core", version.ref = "koin" } -koin-android = { module = "io.insert-koin:koin-android", version.ref = "koin" } -koin-test = { module = "io.insert-koin:koin-test", version.ref = "koin" } -koin-test-junit4 = { module = "io.insert-koin:koin-test-junit4", version.ref = "koin" } +koin-core = { module = "io.insert-koin:koin-core", version.ref = "koinCore" } +koin-android = { module = "io.insert-koin:koin-android", version.ref = "koinAndroid" } +koin-test = { module = "io.insert-koin:koin-test", version.ref = "koinCore" } +koin-test-junit4 = { module = "io.insert-koin:koin-test-junit4", version.ref = "koinCore" } # We can't upgrade Commons IO beyond this version because starting with 2.7 it is using Java 8 API # that is not available until Android API 26 (even with desugaring enabled). -- GitLab From d858b20f3fb67125a6df5782fe23d4e399d612a1 Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 18:27:17 +0100 Subject: [PATCH 22/37] Update Apache Commons IO to version 2.11.0 --- gradle/libs.versions.toml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3c47d86165..9b4b122604 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -87,11 +87,7 @@ koin-core = { module = "io.insert-koin:koin-core", version.ref = "koinCore" } koin-android = { module = "io.insert-koin:koin-android", version.ref = "koinAndroid" } koin-test = { module = "io.insert-koin:koin-test", version.ref = "koinCore" } koin-test-junit4 = { module = "io.insert-koin:koin-test-junit4", version.ref = "koinCore" } - -# We can't upgrade Commons IO beyond this version because starting with 2.7 it is using Java 8 API -# that is not available until Android API 26 (even with desugaring enabled). -# See https://issuetracker.google.com/issues/160484830 -commons-io = "commons-io:commons-io:2.6" +commons-io = "commons-io:commons-io:2.11.0" mime4j-core = { module = "org.apache.james:apache-mime4j-core", version.ref = "mime4j" } mime4j-dom = { module = "org.apache.james:apache-mime4j-dom", version.ref = "mime4j" } okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" } -- GitLab From ddd464cffbd29b731690d6b1df3b89afb488958a Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 18:31:06 +0100 Subject: [PATCH 23/37] Update Apache James Mime4J to version 0.8.8 --- .../src/main/java/com/fsck/k9/mailstore/LocalStore.java | 8 ++++++-- gradle/libs.versions.toml | 2 +- .../main/java/com/fsck/k9/mail/internet/MimeUtility.java | 8 ++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/core/src/main/java/com/fsck/k9/mailstore/LocalStore.java b/app/core/src/main/java/com/fsck/k9/mailstore/LocalStore.java index 3f846a6c6c..01af194719 100644 --- a/app/core/src/main/java/com/fsck/k9/mailstore/LocalStore.java +++ b/app/core/src/main/java/com/fsck/k9/mailstore/LocalStore.java @@ -651,9 +651,13 @@ public class LocalStore { if (MimeUtil.ENC_QUOTED_PRINTABLE.equals(encoding)) { return new QuotedPrintableInputStream(rawInputStream) { @Override - public void close() throws IOException { + public void close() { super.close(); - rawInputStream.close(); + try { + rawInputStream.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } } }; } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9b4b122604..df1f2ec5c8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -25,7 +25,7 @@ preferencesFix = "1.1.0" timber = "5.0.1" koinCore = "3.3.2" koinAndroid = "3.3.2" -mime4j = "0.8.6" +mime4j = "0.8.8" okhttp = "4.10.0" glide = "4.14.2" moshi = "1.14.0" diff --git a/mail/common/src/main/java/com/fsck/k9/mail/internet/MimeUtility.java b/mail/common/src/main/java/com/fsck/k9/mail/internet/MimeUtility.java index da138d2fa9..da697b12a0 100644 --- a/mail/common/src/main/java/com/fsck/k9/mail/internet/MimeUtility.java +++ b/mail/common/src/main/java/com/fsck/k9/mail/internet/MimeUtility.java @@ -149,9 +149,13 @@ public class MimeUtility { } else if (MimeUtil.ENC_QUOTED_PRINTABLE.equalsIgnoreCase(encoding)) { inputStream = new QuotedPrintableInputStream(rawInputStream) { @Override - public void close() throws IOException { + public void close() { super.close(); - closeInputStreamWithoutDeletingTemporaryFiles(rawInputStream); + try { + closeInputStreamWithoutDeletingTemporaryFiles(rawInputStream); + } catch (IOException e) { + throw new RuntimeException(e); + } } }; } else { -- GitLab From 95b61e61ca1f204900c72842e4b174350b8fd254 Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 18:53:22 +0100 Subject: [PATCH 24/37] Update Clikt to version 3.5.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index df1f2ec5c8..e57281cda3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -98,7 +98,7 @@ glide-compiler = { module = "com.github.bumptech.glide:compiler", version.ref = jsoup = "org.jsoup:jsoup:1.15.3" apache-httpclient = "org.apache.httpcomponents:httpclient:4.5.13" apache-httpclient5 = "org.apache.httpcomponents.client5:httpclient5:5.1.3" -clikt = "com.github.ajalt.clikt:clikt:3.4.0" +clikt = "com.github.ajalt.clikt:clikt:3.5.1" jzlib = "com.jcraft:jzlib:1.0.7" jutf7 = "com.beetstra.jutf7:jutf7:1.0.0" jcip-annotations = "net.jcip:jcip-annotations:1.0" -- GitLab From 259a644e021c677c39b5829f1c3810cc2ff203fb Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 18:56:38 +0100 Subject: [PATCH 25/37] Update Robolectric to version 4.9.2 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e57281cda3..af213dff09 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -113,7 +113,7 @@ xmlpull = "com.github.cketti:xmlpull-extracted-from-android:1.0" kxml2 = "com.github.cketti:kxml2-extracted-from-android:1.0" junit = "junit:junit:4.13.2" -robolectric = "org.robolectric:robolectric:4.9" +robolectric = "org.robolectric:robolectric:4.9.2" mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" } mockito-inline = { module = "org.mockito:mockito-inline", version.ref = "mockito" } mockito-kotlin = "org.mockito.kotlin:mockito-kotlin:4.0.0" -- GitLab From b8d18bbfad089c1d53e7b69d16805e1b90ac8da4 Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 19:02:55 +0100 Subject: [PATCH 26/37] Update Mockito to version 5.0.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index af213dff09..e0e336e260 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -29,7 +29,7 @@ mime4j = "0.8.8" okhttp = "4.10.0" glide = "4.14.2" moshi = "1.14.0" -mockito = "4.8.0" +mockito = "5.0.0" [plugins] android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } -- GitLab From eebc82be38940d4e762099efee373a0ea5d8f9a8 Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 19:03:32 +0100 Subject: [PATCH 27/37] Update mockito-kotlin to version 4.1.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e0e336e260..05109bb3ff 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -116,7 +116,7 @@ junit = "junit:junit:4.13.2" robolectric = "org.robolectric:robolectric:4.9.2" mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" } mockito-inline = { module = "org.mockito:mockito-inline", version.ref = "mockito" } -mockito-kotlin = "org.mockito.kotlin:mockito-kotlin:4.0.0" +mockito-kotlin = "org.mockito.kotlin:mockito-kotlin:4.1.0" truth = "com.google.truth:truth:1.1.3" turbine = "app.cash.turbine:turbine:0.11.0" jdom2 = "org.jdom:jdom2:2.0.6" -- GitLab From b4976b29a1a1419789871a80bde52dd46dbd92e2 Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 19:05:08 +0100 Subject: [PATCH 28/37] Update Turbine to version 0.12.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 05109bb3ff..70f0288838 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -118,7 +118,7 @@ mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" } mockito-inline = { module = "org.mockito:mockito-inline", version.ref = "mockito" } mockito-kotlin = "org.mockito.kotlin:mockito-kotlin:4.1.0" truth = "com.google.truth:truth:1.1.3" -turbine = "app.cash.turbine:turbine:0.11.0" +turbine = "app.cash.turbine:turbine:0.12.1" jdom2 = "org.jdom:jdom2:2.0.6" icu4j-charset = "com.ibm.icu:icu4j-charset:70.1" -- GitLab From 24a6fb62ed8dcc2f3fd2beb3798f9104b9576648 Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 19:06:15 +0100 Subject: [PATCH 29/37] Update JDOM to version 2.0.6.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 70f0288838..eb23e722a1 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -119,7 +119,7 @@ mockito-inline = { module = "org.mockito:mockito-inline", version.ref = "mockito mockito-kotlin = "org.mockito.kotlin:mockito-kotlin:4.1.0" truth = "com.google.truth:truth:1.1.3" turbine = "app.cash.turbine:turbine:0.12.1" -jdom2 = "org.jdom:jdom2:2.0.6" +jdom2 = "org.jdom:jdom2:2.0.6.1" icu4j-charset = "com.ibm.icu:icu4j-charset:70.1" leakcanary-android = "com.squareup.leakcanary:leakcanary-android:2.9.1" -- GitLab From 8b92a7c162f541318825311822b7ac269e8b8c4e Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 19:07:36 +0100 Subject: [PATCH 30/37] Update icu4j-charset to version 72.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index eb23e722a1..e58b30439e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -120,6 +120,6 @@ mockito-kotlin = "org.mockito.kotlin:mockito-kotlin:4.1.0" truth = "com.google.truth:truth:1.1.3" turbine = "app.cash.turbine:turbine:0.12.1" jdom2 = "org.jdom:jdom2:2.0.6.1" -icu4j-charset = "com.ibm.icu:icu4j-charset:70.1" +icu4j-charset = "com.ibm.icu:icu4j-charset:72.1" leakcanary-android = "com.squareup.leakcanary:leakcanary-android:2.9.1" -- GitLab From 3a04190aa223a4292e0c4af4815b0aca5cfc7c41 Mon Sep 17 00:00:00 2001 From: cketti Date: Tue, 17 Jan 2023 12:21:51 +0100 Subject: [PATCH 31/37] Fix logic to skip the trash folder when deleting messages --- .../com/fsck/k9/controller/MessagingController.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java b/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java index 16944e743c..dfa2cc2524 100644 --- a/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java +++ b/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java @@ -2025,10 +2025,13 @@ public class MessagingController { Map uidMap = null; Long trashFolderId = account.getTrashFolderId(); boolean isSpamFolder = account.hasSpamFolder() && account.getSpamFolderId() == folderId; + boolean doNotMoveToTrashFolder = skipTrashFolder || + !account.hasTrashFolder() || folderId == trashFolderId || + isSpamFolder || + (backend.getSupportsTrashFolder() && !backend.isDeleteMoveToTrash()); LocalFolder localTrashFolder = null; - if (skipTrashFolder || !account.hasTrashFolder() || folderId == trashFolderId || isSpamFolder || - (backend.getSupportsTrashFolder() && !backend.isDeleteMoveToTrash())) { + if (doNotMoveToTrashFolder) { Timber.d("Not moving deleted messages to local Trash folder. Removing local copies."); if (!localOnlyMessages.isEmpty()) { @@ -2092,8 +2095,7 @@ public class MessagingController { // Nothing to do on the remote side } else if (!syncedMessageUids.isEmpty()) { if (account.getDeletePolicy() == DeletePolicy.ON_DELETE) { - if (!account.hasTrashFolder() || folderId == trashFolderId || - !backend.isDeleteMoveToTrash()) { + if (doNotMoveToTrashFolder) { queueDelete(account, folderId, syncedMessageUids); } else if (account.isMarkMessageAsReadOnDelete()) { queueMoveOrCopy(account, folderId, trashFolderId, -- GitLab From ef2b955d01efb048ad2d5436171a6c9bc3ff5bd8 Mon Sep 17 00:00:00 2001 From: cketti Date: Tue, 17 Jan 2023 16:23:18 +0100 Subject: [PATCH 32/37] Keep `` element --- .../app/k9mail/html/cleaner/HeadCleaner.kt | 2 +- .../k9mail/html/cleaner/HtmlSanitizerTest.kt | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/html-cleaner/src/main/java/app/k9mail/html/cleaner/HeadCleaner.kt b/app/html-cleaner/src/main/java/app/k9mail/html/cleaner/HeadCleaner.kt index d9ac70f810..1485291428 100644 --- a/app/html-cleaner/src/main/java/app/k9mail/html/cleaner/HeadCleaner.kt +++ b/app/html-cleaner/src/main/java/app/k9mail/html/cleaner/HeadCleaner.kt @@ -9,7 +9,7 @@ import org.jsoup.parser.Tag import org.jsoup.select.NodeTraversor import org.jsoup.select.NodeVisitor -private val ALLOWED_TAGS = listOf("style", "meta") +private val ALLOWED_TAGS = listOf("style", "meta", "base") internal class HeadCleaner { fun clean(dirtyDocument: Document, cleanedDocument: Document) { diff --git a/app/html-cleaner/src/test/java/app/k9mail/html/cleaner/HtmlSanitizerTest.kt b/app/html-cleaner/src/test/java/app/k9mail/html/cleaner/HtmlSanitizerTest.kt index d60ae8b381..9025000067 100644 --- a/app/html-cleaner/src/test/java/app/k9mail/html/cleaner/HtmlSanitizerTest.kt +++ b/app/html-cleaner/src/test/java/app/k9mail/html/cleaner/HtmlSanitizerTest.kt @@ -465,6 +465,25 @@ class HtmlSanitizerTest { assertTagsNotStripped("var") } + @Test + fun `should keep 'base' element`() { + val html = + """ + + + + + + Link + + + """.compactHtml() + + val result = htmlSanitizer.sanitize(html) + + assertThat(result.toCompactString()).isEqualTo(html) + } + private fun assertTagsNotStripped(element: String) { val html = """<$element>some text""" @@ -491,4 +510,6 @@ class HtmlSanitizerTest { } private fun String.trimLineBreaks() = replace("\n", "") + + private fun String.compactHtml() = lines().joinToString(separator = "") { it.trim() } } -- GitLab From ccc5223e6793506fad8478bd2d250ec17299fb25 Mon Sep 17 00:00:00 2001 From: cketti Date: Tue, 17 Jan 2023 18:17:27 +0100 Subject: [PATCH 33/37] Use single queue for handling commands modifying messages We want to use a single queue so commands are not sent to the server out of order. --- .../k9/controller/MessagingController.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java b/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java index dfa2cc2524..4007efa8b2 100644 --- a/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java +++ b/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java @@ -1044,12 +1044,9 @@ public class MessagingController { setFlagInCache(account, messageIds, flag, newState); - threadPool.execute(new Runnable() { - @Override - public void run() { - setFlagSynchronous(account, messageIds, flag, newState, false); - } - }); + putBackground("setFlag", null, () -> + setFlagSynchronous(account, messageIds, flag, newState, false) + ); } public void setFlagForThreads(final Account account, final List threadRootIds, @@ -1057,12 +1054,9 @@ public class MessagingController { setFlagForThreadsInCache(account, threadRootIds, flag, newState); - threadPool.execute(new Runnable() { - @Override - public void run() { - setFlagSynchronous(account, threadRootIds, flag, newState, true); - } - }); + putBackground("setFlagForThreads", null, () -> + setFlagSynchronous(account, threadRootIds, flag, newState, true) + ); } private void setFlagSynchronous(final Account account, final List ids, -- GitLab From 3f1911783e97b5cfcde6a2db5376af6b278aaa9e Mon Sep 17 00:00:00 2001 From: cketti Date: Thu, 19 Jan 2023 11:55:15 +0100 Subject: [PATCH 34/37] Fix `queue*()` methods Change methods to only add a pending command, but not process the pending commands immediately. Also, don't defer adding the pending command by using `putBackground()`. This can mess with the execution order of remote commands. --- .../fsck/k9/controller/MessagingController.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java b/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java index 4007efa8b2..2d20a1f79b 100644 --- a/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java +++ b/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java @@ -952,11 +952,8 @@ public class MessagingController { } private void queueSetFlag(Account account, long folderId, boolean newState, Flag flag, List uids) { - putBackground("queueSetFlag", null, () -> { - PendingCommand command = PendingSetFlag.create(folderId, newState, flag, uids); - queuePendingCommand(account, command); - processPendingCommands(account); - }); + PendingCommand command = PendingSetFlag.create(folderId, newState, flag, uids); + queuePendingCommand(account, command); } /** @@ -969,11 +966,8 @@ public class MessagingController { } private void queueDelete(Account account, long folderId, List uids) { - putBackground("queueDelete", null, () -> { - PendingCommand command = PendingDelete.create(folderId, uids); - queuePendingCommand(account, command); - processPendingCommands(account); - }); + PendingCommand command = PendingDelete.create(folderId, uids); + queuePendingCommand(account, command); } void processPendingDelete(PendingDelete command, Account account) throws MessagingException { -- GitLab From 78d6e233629e6cfc598f349d2837c168c0909b1d Mon Sep 17 00:00:00 2001 From: cketti Date: Thu, 19 Jan 2023 11:58:38 +0100 Subject: [PATCH 35/37] Tweak the way messages are marked as read on opening Update the message object and cache right away. Do the rest in a single background operation. --- .../k9/controller/MessagingController.java | 55 ++++++++++++------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java b/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java index 2d20a1f79b..0d1f491f39 100644 --- a/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java +++ b/app/core/src/main/java/com/fsck/k9/controller/MessagingController.java @@ -1272,36 +1272,49 @@ public class MessagingController { } public void markMessageAsOpened(Account account, LocalMessage message) { - put("markMessageAsOpened", null, () -> { - markMessageAsOpenedBlocking(account, message); - }); - } + threadPool.execute(() -> + notificationController.removeNewMailNotification(account, message.makeMessageReference()) + ); - private void markMessageAsOpenedBlocking(Account account, LocalMessage message) { - notificationController.removeNewMailNotification(account,message.makeMessageReference()); + if (message.isSet(Flag.SEEN)) { + // Nothing to do if the message is already marked as read + return; + } - if (!message.isSet(Flag.SEEN)) { - if (account.isMarkMessageAsReadOnView()) { - markMessageAsReadOnView(account, message); - } else { - // Marking a message as read will automatically mark it as "not new". But if we don't mark the message - // as read on opening, we have to manually mark it as "not new". - markMessageAsNotNew(account, message); + boolean markMessageAsRead = account.isMarkMessageAsReadOnView(); + if (markMessageAsRead) { + // Mark the message itself as read right away + try { + message.setFlagInternal(Flag.SEEN, true); + } catch (MessagingException e) { + Timber.e(e, "Error while marking message as read"); } - } - } - private void markMessageAsReadOnView(Account account, LocalMessage message) { - try { + // Also mark the message as read in the cache List messageIds = Collections.singletonList(message.getDatabaseId()); - setFlag(account, messageIds, Flag.SEEN, true); + setFlagInCache(account, messageIds, Flag.SEEN, true); + } - message.setFlagInternal(Flag.SEEN, true); - } catch (MessagingException e) { - Timber.e(e, "Error while marking message as read"); + putBackground("markMessageAsOpened", null, () -> { + markMessageAsOpenedBlocking(account, message, markMessageAsRead); + }); + } + + private void markMessageAsOpenedBlocking(Account account, LocalMessage message, boolean markMessageAsRead) { + if (markMessageAsRead) { + markMessageAsRead(account, message); + } else { + // Marking a message as read will automatically mark it as "not new". But if we don't mark the message + // as read on opening, we have to manually mark it as "not new". + markMessageAsNotNew(account, message); } } + private void markMessageAsRead(Account account, LocalMessage message) { + List messageIds = Collections.singletonList(message.getDatabaseId()); + setFlagSynchronous(account, messageIds, Flag.SEEN, true, false); + } + private void markMessageAsNotNew(Account account, LocalMessage message) { MessageStore messageStore = messageStoreManager.getMessageStore(account); long folderId = message.getFolder().getDatabaseId(); -- GitLab From 2131bfcd05a8624f633ef6c98938ec163f7812c4 Mon Sep 17 00:00:00 2001 From: cketti Date: Mon, 16 Jan 2023 20:13:51 +0100 Subject: [PATCH 36/37] Switch from AndroidX CardView to MaterialCardView --- app/ui/legacy/build.gradle | 1 - .../java/com/fsck/k9/ui/messageview/AttachmentView.java | 6 ++++-- .../src/main/res/layout/message_compose_attachment.xml | 5 ++--- .../src/main/res/layout/message_view_attachment.xml | 9 +++++---- .../main/res/layout/message_view_attachment_locked.xml | 5 ++--- gradle/libs.versions.toml | 1 - 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/app/ui/legacy/build.gradle b/app/ui/legacy/build.gradle index 19dfe3538b..ee4f6d759c 100644 --- a/app/ui/legacy/build.gradle +++ b/app/ui/legacy/build.gradle @@ -30,7 +30,6 @@ dependencies { implementation libs.androidx.lifecycle.viewmodel.ktx implementation libs.androidx.lifecycle.livedata.ktx implementation libs.androidx.constraintlayout - implementation libs.androidx.cardview implementation libs.androidx.localbroadcastmanager implementation libs.androidx.swiperefreshlayout implementation libs.ckchangelog.core diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/AttachmentView.java b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/AttachmentView.java index fbacf67bd9..400a29dc73 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/AttachmentView.java +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/AttachmentView.java @@ -25,6 +25,7 @@ public class AttachmentView extends FrameLayout implements OnClickListener { private AttachmentViewInfo attachment; private AttachmentViewCallback callback; + private View cardView; private View saveButton; private ImageView preview; private ImageView attachmentType; @@ -46,6 +47,7 @@ public class AttachmentView extends FrameLayout implements OnClickListener { @Override protected void onFinishInflate() { super.onFinishInflate(); + cardView = findViewById(R.id.attachment_card); saveButton = findViewById(R.id.save_button); preview = findViewById(R.id.attachment_preview); attachmentType = findViewById(R.id.attachment_type); @@ -72,7 +74,7 @@ public class AttachmentView extends FrameLayout implements OnClickListener { saveButton.setVisibility(View.INVISIBLE); } - setOnClickListener(this); + cardView.setOnClickListener(this); saveButton.setOnClickListener(this); TextView attachmentName = findViewById(R.id.attachment_name); @@ -102,7 +104,7 @@ public class AttachmentView extends FrameLayout implements OnClickListener { @Override public void onClick(View view) { - if (view == this) { + if (view.getId() == R.id.attachment_card) { onViewButtonClick(); } else if (view.getId() == R.id.save_button) { onSaveButtonClick(); diff --git a/app/ui/legacy/src/main/res/layout/message_compose_attachment.xml b/app/ui/legacy/src/main/res/layout/message_compose_attachment.xml index 565f7b50cc..c33b686db3 100644 --- a/app/ui/legacy/src/main/res/layout/message_compose_attachment.xml +++ b/app/ui/legacy/src/main/res/layout/message_compose_attachment.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/ui/legacy/src/main/res/layout/message_view_attachment.xml b/app/ui/legacy/src/main/res/layout/message_view_attachment.xml index 8b1784a34f..270a2232aa 100644 --- a/app/ui/legacy/src/main/res/layout/message_view_attachment.xml +++ b/app/ui/legacy/src/main/res/layout/message_view_attachment.xml @@ -7,16 +7,17 @@ android:paddingBottom="4dp" android:id="@+id/attachment"> - - + diff --git a/app/ui/legacy/src/main/res/layout/message_view_attachment_locked.xml b/app/ui/legacy/src/main/res/layout/message_view_attachment_locked.xml index dd85384899..5605d7b568 100644 --- a/app/ui/legacy/src/main/res/layout/message_view_attachment_locked.xml +++ b/app/ui/legacy/src/main/res/layout/message_view_attachment_locked.xml @@ -8,7 +8,7 @@ android:outAnimation="@anim/fade_out" app:previewInitialChild="0"> - - + Date: Thu, 19 Jan 2023 13:03:20 +0100 Subject: [PATCH 37/37] Version 6.503 --- app/k9mail/build.gradle | 4 ++-- app/ui/legacy/src/main/res/raw/changelog_master.xml | 7 +++++++ fastlane/metadata/android/en-US/changelogs/35003.txt | 5 +++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 fastlane/metadata/android/en-US/changelogs/35003.txt diff --git a/app/k9mail/build.gradle b/app/k9mail/build.gradle index cde74c44d7..ba958c449f 100644 --- a/app/k9mail/build.gradle +++ b/app/k9mail/build.gradle @@ -53,8 +53,8 @@ android { applicationId "com.fsck.k9" testApplicationId "com.fsck.k9.tests" - versionCode 35002 - versionName '6.503-SNAPSHOT' + versionCode 35003 + versionName '6.503' // Keep in sync with the resource string array 'supported_languages' resConfigs "in", "br", "ca", "cs", "cy", "da", "de", "et", "en", "en_GB", "es", "eo", "eu", "fr", "gd", "gl", diff --git a/app/ui/legacy/src/main/res/raw/changelog_master.xml b/app/ui/legacy/src/main/res/raw/changelog_master.xml index 3c93a611ed..b214c4f362 100644 --- a/app/ui/legacy/src/main/res/raw/changelog_master.xml +++ b/app/ui/legacy/src/main/res/raw/changelog_master.xml @@ -5,6 +5,13 @@ Locale-specific versions are kept in res/raw-/changelog.xml. --> + + Tweaked theme colors + Added support for HTML messages using the <base> tag and relative links + Fixed the logic to skip the trash folder when deleting messages, e.g. when deleting spam + Fixed bug that could lead to messages not being marked as read on the server when they should have been + Internal changes + Fixed crash at app startup diff --git a/fastlane/metadata/android/en-US/changelogs/35003.txt b/fastlane/metadata/android/en-US/changelogs/35003.txt new file mode 100644 index 0000000000..92056f363d --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/35003.txt @@ -0,0 +1,5 @@ +- Tweaked theme colors +- Added support for HTML messages using the tag and relative links +- Fixed the logic to skip the trash folder when deleting messages, e.g. when deleting spam +- Fixed bug that could lead to messages not being marked as read on the server when they should have been +- Internal changes -- GitLab