feat(label): Added LabelRepository updateLabelIsExpanded.

This commit is contained in:
Neil Marietta
2022-05-26 14:44:47 +02:00
parent d61fbfa9ec
commit 8a9fab5ebf
4 changed files with 13 additions and 1 deletions
+1
View File
@@ -474,6 +474,7 @@ public final class me/proton/core/label/data/repository/LabelRepositoryImpl : me
public fun markAsStale (Lme/proton/core/domain/entity/UserId;Lme/proton/core/label/domain/entity/LabelType;)V
public fun observeLabels (Lme/proton/core/domain/entity/UserId;Lme/proton/core/label/domain/entity/LabelType;Z)Lkotlinx/coroutines/flow/Flow;
public fun updateLabel (Lme/proton/core/domain/entity/UserId;Lme/proton/core/label/domain/entity/Label;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun updateLabelIsExpanded (Lme/proton/core/domain/entity/UserId;Lme/proton/core/label/domain/entity/LabelType;Lme/proton/core/label/domain/entity/LabelId;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class me/proton/core/label/data/repository/LabelRepositoryImpl_Factory : dagger/internal/Factory {
@@ -99,6 +99,11 @@ class LabelRepositoryImpl @Inject constructor(
)
}
override suspend fun updateLabelIsExpanded(userId: UserId, type: LabelType, labelId: LabelId, isExpanded: Boolean) {
val label = requireNotNull(getLabel(userId, type, labelId))
updateLabel(userId, label.copy(isExpanded = isExpanded))
}
override suspend fun deleteLabel(userId: UserId, type: LabelType, labelId: LabelId) {
localDataSource.deleteLabel(userId, listOf(labelId))
// Replace any existing [Update|Delete]LabelWorker.
+1
View File
@@ -146,6 +146,7 @@ public abstract interface class me/proton/core/label/domain/repository/LabelRepo
public abstract fun markAsStale (Lme/proton/core/domain/entity/UserId;Lme/proton/core/label/domain/entity/LabelType;)V
public abstract fun observeLabels (Lme/proton/core/domain/entity/UserId;Lme/proton/core/label/domain/entity/LabelType;Z)Lkotlinx/coroutines/flow/Flow;
public abstract fun updateLabel (Lme/proton/core/domain/entity/UserId;Lme/proton/core/label/domain/entity/Label;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun updateLabelIsExpanded (Lme/proton/core/domain/entity/UserId;Lme/proton/core/label/domain/entity/LabelType;Lme/proton/core/label/domain/entity/LabelId;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class me/proton/core/label/domain/repository/LabelRepository$DefaultImpls {
@@ -48,10 +48,15 @@ interface LabelRepository {
suspend fun createLabel(userId: UserId, label: NewLabel)
/**
* Update label for [userId], locally, then remotely in background.
* Update [Label] for [userId], locally, then remotely in background.
*/
suspend fun updateLabel(userId: UserId, label: Label)
/**
* Update [Label.isExpanded] for [userId], locally, then remotely in background.
*/
suspend fun updateLabelIsExpanded(userId: UserId, type: LabelType, labelId: LabelId, isExpanded: Boolean)
/**
* Delete label for [userId] by [labelId], locally, then remotely in background.
*/