improve task loading

This commit is contained in:
Phillip Thelen 2023-02-23 15:52:51 +01:00
parent 6dea4eb10f
commit 525870745a
9 changed files with 29 additions and 34 deletions

View file

@ -129,8 +129,7 @@ dependencies {
}
android {
compileSdkVersion target_sdk
buildToolsVersion '33.0.2'
compileSdk target_sdk
testOptions {
unitTests {
includeAndroidResources = true
@ -170,7 +169,7 @@ android {
signingConfigs {
release
}
flavorDimensions "buildType"
flavorDimensions.add("buildType")
buildTypes {
debug {
@ -330,7 +329,7 @@ if (HRPG_PROPS_FILE.canRead()) {
HRPG_PROPS.load(new FileInputStream(HRPG_PROPS_FILE))
if (HRPG_PROPS != null) {
android.buildTypes.all { buildType ->
android.buildTypes.configureEach { buildType ->
HRPG_PROPS.any { property ->
buildType.buildConfigField "String", property.key, "\"${property.value}\""
}
@ -349,7 +348,7 @@ if (HRPG_RES_FILE.canRead()) {
HRPG_RES.load(new FileInputStream(HRPG_RES_FILE))
if (HRPG_RES != null) {
android.buildTypes.all { buildType ->
android.buildTypes.configureEach { buildType ->
HRPG_RES.any { property ->
buildType.resValue "string", property.key, "\"${property.value}\""
}
@ -361,16 +360,16 @@ if (HRPG_RES_FILE.canRead()) {
throw new MissingResourceException('habitica.resources not found')
}
tasks.whenTaskAdded { task ->
tasks.configureEach { task ->
if (task.name == "lint") {
task.enabled = false
}
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
tasks.withType(JavaCompile).configureEach {
options.compilerArgs << "-Xmaxerrs" << "500"
}
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.gms.google-services'

View file

@ -240,7 +240,11 @@ class TaskRepositoryImpl(
task.isSaving = true
task.isCreating = true
task.hasErrored = false
task.ownerID = userID
task.ownerID = if (task.isGroupTask) {
task.group?.groupID ?: ""
} else {
userID
}
if (task.id == null) {
task.id = UUID.randomUUID().toString()
}

View file

@ -16,6 +16,7 @@ import com.habitrpg.android.habitica.helpers.GroupPlanInfoProvider
import com.habitrpg.android.habitica.models.TeamPlan
import com.habitrpg.android.habitica.models.tasks.Task
import com.habitrpg.common.habitica.helpers.ExceptionHandler
import com.habitrpg.common.habitica.helpers.launchCatching
import com.habitrpg.shared.habitica.models.responses.TaskDirection
import com.habitrpg.shared.habitica.models.responses.TaskScoringResult
import com.habitrpg.shared.habitica.models.tasks.TaskType
@ -247,6 +248,12 @@ class TasksViewModel : BaseViewModel(), GroupPlanInfoProvider {
fun setActiveFilter(type: TaskType, activeFilter: String) {
activeFilters[type] = activeFilter
filterSets[type]?.value = Triple(searchQuery, activeFilter, tags)
if (activeFilters[TaskType.TODO] == Task.FILTER_COMPLETED) {
viewModelScope.launchCatching {
taskRepository.retrieveCompletedTodos()
}
}
}
fun getActiveFilter(type: TaskType?): String? {

View file

@ -43,7 +43,7 @@ buildscript {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.google.gms:google-services:4.3.15'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.4'
classpath "io.realm:realm-gradle-plugin:10.11.0"
classpath "io.realm:realm-gradle-plugin:10.13.2-transformer-api"
classpath("io.realm.kotlin:gradle-plugin:$realm_version")
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.19.0"
@ -63,7 +63,7 @@ allprojects {
mavenCentral()
}
tasks.withType(Test) {
tasks.withType(Test).configureEach {
testLogging {
events "passed", "skipped", "failed", "standardError"
outputs.upToDateWhen {false}
@ -101,20 +101,6 @@ detekt {
source = files("Habitica/src/main/java")
config = files("detekt.yml")
baseline = file("${rootProject.projectDir}/detekt_baseline.xml")
reports {
xml {
enabled = true
destination = file("build/reports/detekt.xml")
}
html {
enabled = true
destination = file("build/reports/detekt.html")
}
sarif {
enabled = true
destination = file("build/reports/detekt.sarif")
}
}
}
tasks.named("detekt").configure {
@ -130,4 +116,4 @@ tasks.named("detekt").configure {
task allUnitTests(type: GradleBuild) {
tasks = [':Habitica:testProdDebugUnitTest', ':wearos:testProdDebugUnitTest', ':common:testProdDebugUnitTest', ':shared:testDebugUnitTest']
}
}

View file

@ -39,7 +39,7 @@ android {
}
namespace 'com.habitrpg.common.habitica'
flavorDimensions "buildType"
flavorDimensions.add("buildType")
productFlavors {
dev {
@ -122,4 +122,4 @@ if (HRPG_PROPS_FILE.canRead()) {
}
} else {
throw new MissingResourceException('habitica.properties not found')
}
}

View file

@ -1,4 +1,4 @@
kNew in 4.1.6:
New in 4.1.6:
-Fixed various issues with: Challenge task creation, Markdown appearance, animated potion sprites, Google Sign in, reminder scheduling, Group Tasks
-You can view, complete, assign, and add tasks to your Group Plan's shared task board!
-Tap your name on a task screen to switch to different task boards

View file

@ -40,7 +40,6 @@ android {
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdk = 21
targetSdk = 33
}
buildTypes {

View file

@ -1,2 +1,2 @@
NAME=4.1.6
CODE=5291
CODE=5381

View file

@ -51,7 +51,7 @@ android {
}
}
flavorDimensions "buildType"
flavorDimensions.add("buildType")
productFlavors {
dev {
@ -169,7 +169,7 @@ if (HRPG_PROPS_FILE.canRead()) {
HRPG_PROPS.load(new FileInputStream(HRPG_PROPS_FILE))
if (HRPG_PROPS != null) {
android.buildTypes.all { buildType ->
android.buildTypes.configureEach { buildType ->
HRPG_PROPS.any { property ->
buildType.buildConfigField "String", property.key, "\"${property.value}\""
}
@ -199,4 +199,4 @@ if (propFile.canRead()) {
} else {
println 'signing.properties not found'
android.buildTypes.release.signingConfig = null
}
}