refactor: Start creating core modules (#286)
The existing code base is a single monolithic module. This is relatively
simple to configure, but many of the tasks to compile the module and
produce the final app have to run in series.
This is unnecessarily slow.
This change starts to split the code in to multiple modules, which are:
- :core:account - AccountManager, to break a dependency cycle
- :core:common - low level types or utilities used in many other modules
- :core:database - database types, DAOs, and DI infrastructure
- :core:network - network types, API definitions, and DI infrastructure
- :core:preferences - shared preferences definitions and DI
infrastructure
- :core:testing - fakes and rules used across different modules
Benchmarking with gradle-profiler shows a ~ 17% reduction in incremental
build times after an ABI change. That will improve further as more code
is moved to modules.
The rough mechanics of the changes are:
- Create the modules, and move existing files in to them. This causes a
lot of churn in import arguments.
- Convert build.gradle files to build.gradle.kts
- Separate out the data required to display a tab (`TabViewData`) from
the data required to configure a tab (`TabData`) to avoid circular
dependencies.
- Abstract the repeated build logic shared between the modules in to
a set of plugins under `build-logic/`, to simplify configuration of
the application and library builds.
- Be explicit that some nullable types are non-null at time of use.
Nullable properties in types imported from modules generally can't be
smart cast to non-null. There's a detailed discussion of why this
restriction exists at
https://discuss.kotlinlang.org/t/what-is-the-reason-behind-smart-cast-being-impossible-to-perform-when-referenced-class-is-in-another-module/2201.
The changes highlight design problems with the current code, including:
- The main application code is too tightly coupled to the network types
- Too many values are declared unnecessarily nullable
- Dependency cycles between code that make modularisation difficult
Future changes will add more modules.
See #291.
2023-12-04 16:58:36 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2023 Pachli Association
|
|
|
|
*
|
|
|
|
* This file is a part of Pachli.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
|
|
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Pachli is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
|
|
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
|
|
|
* Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with Pachli; if not,
|
|
|
|
* see <http://www.gnu.org/licenses>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
import com.android.build.gradle.internal.api.ApkVariantOutputImpl
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
alias(libs.plugins.pachli.android.application)
|
|
|
|
alias(libs.plugins.pachli.android.hilt)
|
|
|
|
alias(libs.plugins.kotlin.parcelize)
|
|
|
|
}
|
|
|
|
|
|
|
|
apply(from = "gitTools.gradle")
|
|
|
|
val getGitSha: groovy.lang.Closure<String> by extra
|
|
|
|
val getGitRevCount: groovy.lang.Closure<Int> by extra
|
|
|
|
|
|
|
|
android {
|
|
|
|
namespace = "app.pachli"
|
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
applicationId = "app.pachli"
|
2024-09-30 15:21:52 +02:00
|
|
|
versionCode = 22
|
|
|
|
versionName = "2.8.2"
|
refactor: Start creating core modules (#286)
The existing code base is a single monolithic module. This is relatively
simple to configure, but many of the tasks to compile the module and
produce the final app have to run in series.
This is unnecessarily slow.
This change starts to split the code in to multiple modules, which are:
- :core:account - AccountManager, to break a dependency cycle
- :core:common - low level types or utilities used in many other modules
- :core:database - database types, DAOs, and DI infrastructure
- :core:network - network types, API definitions, and DI infrastructure
- :core:preferences - shared preferences definitions and DI
infrastructure
- :core:testing - fakes and rules used across different modules
Benchmarking with gradle-profiler shows a ~ 17% reduction in incremental
build times after an ABI change. That will improve further as more code
is moved to modules.
The rough mechanics of the changes are:
- Create the modules, and move existing files in to them. This causes a
lot of churn in import arguments.
- Convert build.gradle files to build.gradle.kts
- Separate out the data required to display a tab (`TabViewData`) from
the data required to configure a tab (`TabData`) to avoid circular
dependencies.
- Abstract the repeated build logic shared between the modules in to
a set of plugins under `build-logic/`, to simplify configuration of
the application and library builds.
- Be explicit that some nullable types are non-null at time of use.
Nullable properties in types imported from modules generally can't be
smart cast to non-null. There's a detailed discussion of why this
restriction exists at
https://discuss.kotlinlang.org/t/what-is-the-reason-behind-smart-cast-being-impossible-to-perform-when-referenced-class-is-in-another-module/2201.
The changes highlight design problems with the current code, including:
- The main application code is too tightly coupled to the network types
- Too many values are declared unnecessarily nullable
- Dependency cycles between code that make modularisation difficult
Future changes will add more modules.
See #291.
2023-12-04 16:58:36 +01:00
|
|
|
|
|
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
|
|
testInstrumentationRunnerArguments["disableAnalytics"] = "true"
|
|
|
|
|
|
|
|
vectorDrawables.useSupportLibrary = true
|
|
|
|
}
|
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
debug {
|
|
|
|
isDefault = true
|
|
|
|
}
|
|
|
|
|
|
|
|
release {
|
|
|
|
isMinifyEnabled = true
|
|
|
|
isShrinkResources = true
|
|
|
|
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
packaging {
|
|
|
|
resources.excludes.apply {
|
|
|
|
add("LICENSE_OFL")
|
|
|
|
add("LICENSE_UNICODE")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bundle {
|
|
|
|
language {
|
|
|
|
// bundle all languages in every apk so the dynamic language switching works
|
|
|
|
enableSplit = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependenciesInfo {
|
|
|
|
includeInApk = false
|
|
|
|
includeInBundle = false
|
|
|
|
}
|
|
|
|
|
|
|
|
testOptions {
|
|
|
|
unitTests.all {
|
|
|
|
it.systemProperty("robolectric.logging.enabled", "true")
|
|
|
|
it.systemProperty("robolectric.lazyload", "ON")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
applicationVariants.configureEach {
|
|
|
|
tasks.register("printVersionInfo${name.replaceFirstChar { it.uppercaseChar() }}") {
|
|
|
|
notCompatibleWithConfigurationCache("Should always print the version info")
|
|
|
|
doLast {
|
|
|
|
println("$versionCode $versionName")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
outputs.configureEach {
|
|
|
|
this as ApkVariantOutputImpl
|
|
|
|
// Set the "orange" release versionCode to the number of commits on the
|
|
|
|
// branch, to ensure the versionCode updates on every release. Include the
|
|
|
|
// SHA of the current commit to help with troubleshooting bug reports
|
2024-01-30 11:37:00 +01:00
|
|
|
if (flavorName.startsWith("orange")) {
|
|
|
|
versionNameOverride = "$versionName+${getGitSha()}"
|
|
|
|
}
|
refactor: Start creating core modules (#286)
The existing code base is a single monolithic module. This is relatively
simple to configure, but many of the tasks to compile the module and
produce the final app have to run in series.
This is unnecessarily slow.
This change starts to split the code in to multiple modules, which are:
- :core:account - AccountManager, to break a dependency cycle
- :core:common - low level types or utilities used in many other modules
- :core:database - database types, DAOs, and DI infrastructure
- :core:network - network types, API definitions, and DI infrastructure
- :core:preferences - shared preferences definitions and DI
infrastructure
- :core:testing - fakes and rules used across different modules
Benchmarking with gradle-profiler shows a ~ 17% reduction in incremental
build times after an ABI change. That will improve further as more code
is moved to modules.
The rough mechanics of the changes are:
- Create the modules, and move existing files in to them. This causes a
lot of churn in import arguments.
- Convert build.gradle files to build.gradle.kts
- Separate out the data required to display a tab (`TabViewData`) from
the data required to configure a tab (`TabData`) to avoid circular
dependencies.
- Abstract the repeated build logic shared between the modules in to
a set of plugins under `build-logic/`, to simplify configuration of
the application and library builds.
- Be explicit that some nullable types are non-null at time of use.
Nullable properties in types imported from modules generally can't be
smart cast to non-null. There's a detailed discussion of why this
restriction exists at
https://discuss.kotlinlang.org/t/what-is-the-reason-behind-smart-cast-being-impossible-to-perform-when-referenced-class-is-in-another-module/2201.
The changes highlight design problems with the current code, including:
- The main application code is too tightly coupled to the network types
- Too many values are declared unnecessarily nullable
- Dependency cycles between code that make modularisation difficult
Future changes will add more modules.
See #291.
2023-12-04 16:58:36 +01:00
|
|
|
if (buildType.name == "release" && flavorName.startsWith("orange")) {
|
|
|
|
versionCodeOverride = getGitRevCount()
|
|
|
|
}
|
|
|
|
outputFileName = "Pachli_${versionName}_${versionCode}_${getGitSha()}_${flavorName}_${buildType.name}.apk"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
configurations {
|
|
|
|
// JNI-only libraries don't play nicely with Robolectric
|
|
|
|
// see https://github.com/tuskyapp/Tusky/pull/3367 and
|
|
|
|
// https://github.com/google/conscrypt/issues/649
|
|
|
|
testImplementation {
|
|
|
|
exclude(group = "org.conscrypt", module = "conscrypt-android")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
// CachedTimelineRemoteMediator needs the @Transaction annotation from Room
|
|
|
|
compileOnly(libs.bundles.room)
|
|
|
|
testCompileOnly(libs.bundles.room)
|
|
|
|
|
2024-03-11 10:49:58 +01:00
|
|
|
// @HiltWorker annotation
|
|
|
|
implementation(libs.androidx.hilt.common)
|
|
|
|
implementation(libs.androidx.hilt.work)
|
|
|
|
ksp(libs.androidx.hilt.compiler)
|
|
|
|
|
2024-01-30 11:37:00 +01:00
|
|
|
implementation(projects.core.activity)
|
refactor: Start creating core modules (#286)
The existing code base is a single monolithic module. This is relatively
simple to configure, but many of the tasks to compile the module and
produce the final app have to run in series.
This is unnecessarily slow.
This change starts to split the code in to multiple modules, which are:
- :core:account - AccountManager, to break a dependency cycle
- :core:common - low level types or utilities used in many other modules
- :core:database - database types, DAOs, and DI infrastructure
- :core:network - network types, API definitions, and DI infrastructure
- :core:preferences - shared preferences definitions and DI
infrastructure
- :core:testing - fakes and rules used across different modules
Benchmarking with gradle-profiler shows a ~ 17% reduction in incremental
build times after an ABI change. That will improve further as more code
is moved to modules.
The rough mechanics of the changes are:
- Create the modules, and move existing files in to them. This causes a
lot of churn in import arguments.
- Convert build.gradle files to build.gradle.kts
- Separate out the data required to display a tab (`TabViewData`) from
the data required to configure a tab (`TabData`) to avoid circular
dependencies.
- Abstract the repeated build logic shared between the modules in to
a set of plugins under `build-logic/`, to simplify configuration of
the application and library builds.
- Be explicit that some nullable types are non-null at time of use.
Nullable properties in types imported from modules generally can't be
smart cast to non-null. There's a detailed discussion of why this
restriction exists at
https://discuss.kotlinlang.org/t/what-is-the-reason-behind-smart-cast-being-impossible-to-perform-when-referenced-class-is-in-another-module/2201.
The changes highlight design problems with the current code, including:
- The main application code is too tightly coupled to the network types
- Too many values are declared unnecessarily nullable
- Dependency cycles between code that make modularisation difficult
Future changes will add more modules.
See #291.
2023-12-04 16:58:36 +01:00
|
|
|
implementation(projects.core.common)
|
2024-02-02 15:14:31 +01:00
|
|
|
implementation(projects.core.data)
|
refactor: Start creating core modules (#286)
The existing code base is a single monolithic module. This is relatively
simple to configure, but many of the tasks to compile the module and
produce the final app have to run in series.
This is unnecessarily slow.
This change starts to split the code in to multiple modules, which are:
- :core:account - AccountManager, to break a dependency cycle
- :core:common - low level types or utilities used in many other modules
- :core:database - database types, DAOs, and DI infrastructure
- :core:network - network types, API definitions, and DI infrastructure
- :core:preferences - shared preferences definitions and DI
infrastructure
- :core:testing - fakes and rules used across different modules
Benchmarking with gradle-profiler shows a ~ 17% reduction in incremental
build times after an ABI change. That will improve further as more code
is moved to modules.
The rough mechanics of the changes are:
- Create the modules, and move existing files in to them. This causes a
lot of churn in import arguments.
- Convert build.gradle files to build.gradle.kts
- Separate out the data required to display a tab (`TabViewData`) from
the data required to configure a tab (`TabData`) to avoid circular
dependencies.
- Abstract the repeated build logic shared between the modules in to
a set of plugins under `build-logic/`, to simplify configuration of
the application and library builds.
- Be explicit that some nullable types are non-null at time of use.
Nullable properties in types imported from modules generally can't be
smart cast to non-null. There's a detailed discussion of why this
restriction exists at
https://discuss.kotlinlang.org/t/what-is-the-reason-behind-smart-cast-being-impossible-to-perform-when-referenced-class-is-in-another-module/2201.
The changes highlight design problems with the current code, including:
- The main application code is too tightly coupled to the network types
- Too many values are declared unnecessarily nullable
- Dependency cycles between code that make modularisation difficult
Future changes will add more modules.
See #291.
2023-12-04 16:58:36 +01:00
|
|
|
implementation(projects.core.database)
|
2024-01-30 11:37:00 +01:00
|
|
|
implementation(projects.core.designsystem)
|
2024-09-26 13:51:30 +02:00
|
|
|
implementation(projects.core.domain)
|
2024-03-30 23:27:25 +01:00
|
|
|
implementation(projects.core.model)
|
2023-12-07 18:36:00 +01:00
|
|
|
implementation(projects.core.navigation)
|
refactor: Start creating core modules (#286)
The existing code base is a single monolithic module. This is relatively
simple to configure, but many of the tasks to compile the module and
produce the final app have to run in series.
This is unnecessarily slow.
This change starts to split the code in to multiple modules, which are:
- :core:account - AccountManager, to break a dependency cycle
- :core:common - low level types or utilities used in many other modules
- :core:database - database types, DAOs, and DI infrastructure
- :core:network - network types, API definitions, and DI infrastructure
- :core:preferences - shared preferences definitions and DI
infrastructure
- :core:testing - fakes and rules used across different modules
Benchmarking with gradle-profiler shows a ~ 17% reduction in incremental
build times after an ABI change. That will improve further as more code
is moved to modules.
The rough mechanics of the changes are:
- Create the modules, and move existing files in to them. This causes a
lot of churn in import arguments.
- Convert build.gradle files to build.gradle.kts
- Separate out the data required to display a tab (`TabViewData`) from
the data required to configure a tab (`TabData`) to avoid circular
dependencies.
- Abstract the repeated build logic shared between the modules in to
a set of plugins under `build-logic/`, to simplify configuration of
the application and library builds.
- Be explicit that some nullable types are non-null at time of use.
Nullable properties in types imported from modules generally can't be
smart cast to non-null. There's a detailed discussion of why this
restriction exists at
https://discuss.kotlinlang.org/t/what-is-the-reason-behind-smart-cast-being-impossible-to-perform-when-referenced-class-is-in-another-module/2201.
The changes highlight design problems with the current code, including:
- The main application code is too tightly coupled to the network types
- Too many values are declared unnecessarily nullable
- Dependency cycles between code that make modularisation difficult
Future changes will add more modules.
See #291.
2023-12-04 16:58:36 +01:00
|
|
|
implementation(projects.core.network)
|
|
|
|
implementation(projects.core.preferences)
|
2024-02-02 15:14:31 +01:00
|
|
|
implementation(projects.core.ui)
|
|
|
|
|
|
|
|
implementation(projects.feature.about)
|
2024-03-16 18:42:11 +01:00
|
|
|
implementation(projects.feature.lists)
|
2024-01-30 11:37:00 +01:00
|
|
|
implementation(projects.feature.login)
|
2024-06-17 21:43:12 +02:00
|
|
|
implementation(projects.feature.suggestions)
|
refactor: Start creating core modules (#286)
The existing code base is a single monolithic module. This is relatively
simple to configure, but many of the tasks to compile the module and
produce the final app have to run in series.
This is unnecessarily slow.
This change starts to split the code in to multiple modules, which are:
- :core:account - AccountManager, to break a dependency cycle
- :core:common - low level types or utilities used in many other modules
- :core:database - database types, DAOs, and DI infrastructure
- :core:network - network types, API definitions, and DI infrastructure
- :core:preferences - shared preferences definitions and DI
infrastructure
- :core:testing - fakes and rules used across different modules
Benchmarking with gradle-profiler shows a ~ 17% reduction in incremental
build times after an ABI change. That will improve further as more code
is moved to modules.
The rough mechanics of the changes are:
- Create the modules, and move existing files in to them. This causes a
lot of churn in import arguments.
- Convert build.gradle files to build.gradle.kts
- Separate out the data required to display a tab (`TabViewData`) from
the data required to configure a tab (`TabData`) to avoid circular
dependencies.
- Abstract the repeated build logic shared between the modules in to
a set of plugins under `build-logic/`, to simplify configuration of
the application and library builds.
- Be explicit that some nullable types are non-null at time of use.
Nullable properties in types imported from modules generally can't be
smart cast to non-null. There's a detailed discussion of why this
restriction exists at
https://discuss.kotlinlang.org/t/what-is-the-reason-behind-smart-cast-being-impossible-to-perform-when-referenced-class-is-in-another-module/2201.
The changes highlight design problems with the current code, including:
- The main application code is too tightly coupled to the network types
- Too many values are declared unnecessarily nullable
- Dependency cycles between code that make modularisation difficult
Future changes will add more modules.
See #291.
2023-12-04 16:58:36 +01:00
|
|
|
|
|
|
|
implementation(libs.kotlinx.coroutines.android)
|
|
|
|
|
|
|
|
implementation(libs.bundles.androidx)
|
|
|
|
|
|
|
|
implementation(libs.android.material)
|
|
|
|
|
2024-02-09 12:41:13 +01:00
|
|
|
implementation(libs.moshi)
|
|
|
|
implementation(libs.moshi.adapters)
|
|
|
|
ksp(libs.moshi.codegen)
|
refactor: Start creating core modules (#286)
The existing code base is a single monolithic module. This is relatively
simple to configure, but many of the tasks to compile the module and
produce the final app have to run in series.
This is unnecessarily slow.
This change starts to split the code in to multiple modules, which are:
- :core:account - AccountManager, to break a dependency cycle
- :core:common - low level types or utilities used in many other modules
- :core:database - database types, DAOs, and DI infrastructure
- :core:network - network types, API definitions, and DI infrastructure
- :core:preferences - shared preferences definitions and DI
infrastructure
- :core:testing - fakes and rules used across different modules
Benchmarking with gradle-profiler shows a ~ 17% reduction in incremental
build times after an ABI change. That will improve further as more code
is moved to modules.
The rough mechanics of the changes are:
- Create the modules, and move existing files in to them. This causes a
lot of churn in import arguments.
- Convert build.gradle files to build.gradle.kts
- Separate out the data required to display a tab (`TabViewData`) from
the data required to configure a tab (`TabData`) to avoid circular
dependencies.
- Abstract the repeated build logic shared between the modules in to
a set of plugins under `build-logic/`, to simplify configuration of
the application and library builds.
- Be explicit that some nullable types are non-null at time of use.
Nullable properties in types imported from modules generally can't be
smart cast to non-null. There's a detailed discussion of why this
restriction exists at
https://discuss.kotlinlang.org/t/what-is-the-reason-behind-smart-cast-being-impossible-to-perform-when-referenced-class-is-in-another-module/2201.
The changes highlight design problems with the current code, including:
- The main application code is too tightly coupled to the network types
- Too many values are declared unnecessarily nullable
- Dependency cycles between code that make modularisation difficult
Future changes will add more modules.
See #291.
2023-12-04 16:58:36 +01:00
|
|
|
|
|
|
|
implementation(libs.bundles.retrofit)
|
|
|
|
|
|
|
|
implementation(libs.bundles.okhttp)
|
2024-06-20 13:18:58 +02:00
|
|
|
implementation(libs.okio)
|
refactor: Start creating core modules (#286)
The existing code base is a single monolithic module. This is relatively
simple to configure, but many of the tasks to compile the module and
produce the final app have to run in series.
This is unnecessarily slow.
This change starts to split the code in to multiple modules, which are:
- :core:account - AccountManager, to break a dependency cycle
- :core:common - low level types or utilities used in many other modules
- :core:database - database types, DAOs, and DI infrastructure
- :core:network - network types, API definitions, and DI infrastructure
- :core:preferences - shared preferences definitions and DI
infrastructure
- :core:testing - fakes and rules used across different modules
Benchmarking with gradle-profiler shows a ~ 17% reduction in incremental
build times after an ABI change. That will improve further as more code
is moved to modules.
The rough mechanics of the changes are:
- Create the modules, and move existing files in to them. This causes a
lot of churn in import arguments.
- Convert build.gradle files to build.gradle.kts
- Separate out the data required to display a tab (`TabViewData`) from
the data required to configure a tab (`TabData`) to avoid circular
dependencies.
- Abstract the repeated build logic shared between the modules in to
a set of plugins under `build-logic/`, to simplify configuration of
the application and library builds.
- Be explicit that some nullable types are non-null at time of use.
Nullable properties in types imported from modules generally can't be
smart cast to non-null. There's a detailed discussion of why this
restriction exists at
https://discuss.kotlinlang.org/t/what-is-the-reason-behind-smart-cast-being-impossible-to-perform-when-referenced-class-is-in-another-module/2201.
The changes highlight design problems with the current code, including:
- The main application code is too tightly coupled to the network types
- Too many values are declared unnecessarily nullable
- Dependency cycles between code that make modularisation difficult
Future changes will add more modules.
See #291.
2023-12-04 16:58:36 +01:00
|
|
|
|
|
|
|
implementation(libs.conscrypt.android)
|
|
|
|
|
|
|
|
implementation(libs.bundles.glide)
|
|
|
|
ksp(libs.glide.compiler)
|
|
|
|
|
|
|
|
implementation(libs.sparkbutton)
|
|
|
|
|
|
|
|
implementation(libs.touchimageview)
|
|
|
|
|
|
|
|
implementation(libs.bundles.material.drawer)
|
|
|
|
implementation(libs.material.typeface)
|
|
|
|
|
|
|
|
implementation(libs.image.cropper)
|
|
|
|
|
|
|
|
implementation(libs.bundles.filemojicompat)
|
|
|
|
|
|
|
|
implementation(libs.bouncycastle)
|
|
|
|
implementation(libs.unified.push)
|
|
|
|
|
|
|
|
implementation(libs.bundles.xmldiff)
|
|
|
|
|
|
|
|
implementation(libs.timber)
|
|
|
|
|
|
|
|
googleImplementation(libs.app.update)
|
|
|
|
googleImplementation(libs.app.update.ktx)
|
|
|
|
|
feat: Warn the user if the posting language might be incorrect (#792)
The user has to specify the language they're posting in, and sometimes
they might get it wrong (e.g., replying to a post that also had the
language set incorrectly, forgetfulness, etc).
This has accessiblity issues (only following statuses in a given
language fails, translation can fail, etc).
Prevent this by trying to detect the language the status is written in
when the user tries to post it. If the detected language and the set
language do not match, and the detection is 60+% confident, warn the
user the status language might be incorrect, and offer to correct it
before posting.
How this works differs by device and API level.
- API 23 - 28, fdroid and github build flavours
- Not supported. A no-op language detector is used.
- API 29 and above, fdroid and github build flavours
- Uses Android TextClassifier to detect the likely language
- AP 23 and above, google build flavour
- Uses ML Kit language identification
To do this:
- Add `LanguageIdentifier`, with methods to do the identification, and
`LanguageIdentifier.Factory` to create the identifiers.
- Inject the factory in `ComposeActivity`
- Detect the language when the user posts, showing a dialog if there's a
sufficiently large discrepancy.
The ML Kit dependencies (language models) will be installed by the Play
libraries, so there's some machinery to check that they're installed,
and kick off the installation if not. If they can't be installed then
the language check is bypassed.
Update the privacy policy, as the ML Kit libraries may send some data to
Google.
2024-07-02 20:22:17 +02:00
|
|
|
// Language detection
|
|
|
|
googleImplementation(libs.play.services.base)
|
|
|
|
googleImplementation(libs.mlkit.language.id)
|
|
|
|
googleImplementation(libs.kotlinx.coroutines.play.services)
|
|
|
|
|
refactor: Start creating core modules (#286)
The existing code base is a single monolithic module. This is relatively
simple to configure, but many of the tasks to compile the module and
produce the final app have to run in series.
This is unnecessarily slow.
This change starts to split the code in to multiple modules, which are:
- :core:account - AccountManager, to break a dependency cycle
- :core:common - low level types or utilities used in many other modules
- :core:database - database types, DAOs, and DI infrastructure
- :core:network - network types, API definitions, and DI infrastructure
- :core:preferences - shared preferences definitions and DI
infrastructure
- :core:testing - fakes and rules used across different modules
Benchmarking with gradle-profiler shows a ~ 17% reduction in incremental
build times after an ABI change. That will improve further as more code
is moved to modules.
The rough mechanics of the changes are:
- Create the modules, and move existing files in to them. This causes a
lot of churn in import arguments.
- Convert build.gradle files to build.gradle.kts
- Separate out the data required to display a tab (`TabViewData`) from
the data required to configure a tab (`TabData`) to avoid circular
dependencies.
- Abstract the repeated build logic shared between the modules in to
a set of plugins under `build-logic/`, to simplify configuration of
the application and library builds.
- Be explicit that some nullable types are non-null at time of use.
Nullable properties in types imported from modules generally can't be
smart cast to non-null. There's a detailed discussion of why this
restriction exists at
https://discuss.kotlinlang.org/t/what-is-the-reason-behind-smart-cast-being-impossible-to-perform-when-referenced-class-is-in-another-module/2201.
The changes highlight design problems with the current code, including:
- The main application code is too tightly coupled to the network types
- Too many values are declared unnecessarily nullable
- Dependency cycles between code that make modularisation difficult
Future changes will add more modules.
See #291.
2023-12-04 16:58:36 +01:00
|
|
|
implementation(libs.semver)
|
|
|
|
|
2023-12-09 18:06:01 +01:00
|
|
|
debugImplementation(libs.leakcanary)
|
|
|
|
|
refactor: Start creating core modules (#286)
The existing code base is a single monolithic module. This is relatively
simple to configure, but many of the tasks to compile the module and
produce the final app have to run in series.
This is unnecessarily slow.
This change starts to split the code in to multiple modules, which are:
- :core:account - AccountManager, to break a dependency cycle
- :core:common - low level types or utilities used in many other modules
- :core:database - database types, DAOs, and DI infrastructure
- :core:network - network types, API definitions, and DI infrastructure
- :core:preferences - shared preferences definitions and DI
infrastructure
- :core:testing - fakes and rules used across different modules
Benchmarking with gradle-profiler shows a ~ 17% reduction in incremental
build times after an ABI change. That will improve further as more code
is moved to modules.
The rough mechanics of the changes are:
- Create the modules, and move existing files in to them. This causes a
lot of churn in import arguments.
- Convert build.gradle files to build.gradle.kts
- Separate out the data required to display a tab (`TabViewData`) from
the data required to configure a tab (`TabData`) to avoid circular
dependencies.
- Abstract the repeated build logic shared between the modules in to
a set of plugins under `build-logic/`, to simplify configuration of
the application and library builds.
- Be explicit that some nullable types are non-null at time of use.
Nullable properties in types imported from modules generally can't be
smart cast to non-null. There's a detailed discussion of why this
restriction exists at
https://discuss.kotlinlang.org/t/what-is-the-reason-behind-smart-cast-being-impossible-to-perform-when-referenced-class-is-in-another-module/2201.
The changes highlight design problems with the current code, including:
- The main application code is too tightly coupled to the network types
- Too many values are declared unnecessarily nullable
- Dependency cycles between code that make modularisation difficult
Future changes will add more modules.
See #291.
2023-12-04 16:58:36 +01:00
|
|
|
testImplementation(projects.core.testing)
|
2024-04-28 18:19:13 +02:00
|
|
|
testImplementation(projects.core.networkTest)
|
refactor: Start creating core modules (#286)
The existing code base is a single monolithic module. This is relatively
simple to configure, but many of the tasks to compile the module and
produce the final app have to run in series.
This is unnecessarily slow.
This change starts to split the code in to multiple modules, which are:
- :core:account - AccountManager, to break a dependency cycle
- :core:common - low level types or utilities used in many other modules
- :core:database - database types, DAOs, and DI infrastructure
- :core:network - network types, API definitions, and DI infrastructure
- :core:preferences - shared preferences definitions and DI
infrastructure
- :core:testing - fakes and rules used across different modules
Benchmarking with gradle-profiler shows a ~ 17% reduction in incremental
build times after an ABI change. That will improve further as more code
is moved to modules.
The rough mechanics of the changes are:
- Create the modules, and move existing files in to them. This causes a
lot of churn in import arguments.
- Convert build.gradle files to build.gradle.kts
- Separate out the data required to display a tab (`TabViewData`) from
the data required to configure a tab (`TabData`) to avoid circular
dependencies.
- Abstract the repeated build logic shared between the modules in to
a set of plugins under `build-logic/`, to simplify configuration of
the application and library builds.
- Be explicit that some nullable types are non-null at time of use.
Nullable properties in types imported from modules generally can't be
smart cast to non-null. There's a detailed discussion of why this
restriction exists at
https://discuss.kotlinlang.org/t/what-is-the-reason-behind-smart-cast-being-impossible-to-perform-when-referenced-class-is-in-another-module/2201.
The changes highlight design problems with the current code, including:
- The main application code is too tightly coupled to the network types
- Too many values are declared unnecessarily nullable
- Dependency cycles between code that make modularisation difficult
Future changes will add more modules.
See #291.
2023-12-04 16:58:36 +01:00
|
|
|
testImplementation(libs.androidx.test.junit)
|
|
|
|
testImplementation(libs.robolectric)
|
|
|
|
testImplementation(libs.bundles.mockito)
|
|
|
|
testImplementation(libs.androidx.core.testing)
|
|
|
|
testImplementation(libs.kotlinx.coroutines.test)
|
|
|
|
testImplementation(libs.androidx.work.testing)
|
|
|
|
testImplementation(libs.truth)
|
|
|
|
testImplementation(libs.turbine)
|
|
|
|
testImplementation(libs.androidx.test.core.ktx)
|
|
|
|
|
|
|
|
androidTestImplementation(libs.espresso.core)
|
|
|
|
androidTestImplementation(libs.androidx.room.testing)
|
|
|
|
androidTestImplementation(libs.androidx.test.junit)
|
|
|
|
androidTestImplementation(libs.androidx.test.core.ktx)
|
|
|
|
|
|
|
|
lintChecks(projects.checks)
|
|
|
|
}
|