Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipthelen committed Apr 25, 2024
1 parent 22ac1e9 commit 93e6b34
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@ fastlane/metadata/android/*/changelogs/
/Habitica/alpha
output-metadata.json
/Habitica/jacoco.exec
*.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,24 @@ class ChallengeRepositoryImpl(
challenge: Challenge,
addedTaskList: List<Task>,
) {
when {
val savedTasks: List<Task>? = when {
addedTaskList.count() == 1 ->
apiClient.createChallengeTask(
listOf(apiClient.createChallengeTask(
challenge.id ?: "",
addedTaskList[0],
)

addedTaskList.count() > 1 ->
)).filterNotNull()
else ->
apiClient.createChallengeTasks(
challenge.id ?: "",
addedTaskList,
)
}
if (savedTasks != null) {
savedTasks.forEach {
it.ownerID = challenge.id ?: ""
}
localRepository.save(savedTasks)
}
}

override suspend fun createChallenge(
Expand All @@ -122,11 +127,14 @@ class ChallengeRepositoryImpl(
updatedTaskList: List<Task>,
removedTaskList: List<String>,
): Challenge? {
updatedTaskList
.map { localRepository.getUnmanagedCopy(it) }
.forEach { task ->
val savedTasks = updatedTaskList
.map { localRepository.getUnmanagedCopy(it) }.mapNotNull { task ->
apiClient.updateTask(task.id ?: "", task)
}
if (savedTasks.isNotEmpty()) {
savedTasks.forEach { it.ownerID = challenge.id ?: "" }
localRepository.save(savedTasks)
}

removedTaskList.forEach { task ->
apiClient.deleteTask(task)
Expand Down
2 changes: 1 addition & 1 deletion version.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
NAME=4.3.7
CODE=7221
CODE=7571
1 change: 1 addition & 0 deletions wearos/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ android {

buildFeatures {
viewBinding true
buildConfig true
}
namespace 'com.habitrpg.android.habitica'
}
Expand Down

0 comments on commit 93e6b34

Please sign in to comment.