-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature|optimize|fix] New MVI: AddScreen, SearchConfigScreen; Suppor…
…t for sticker MD5 in search domain; Fix known bugs
- Loading branch information
Showing
20 changed files
with
650 additions
and
395 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 7 additions & 19 deletions
26
app/src/main/java/com/skyd/rays/model/respository/SearchConfigRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,30 @@ | ||
package com.skyd.rays.model.respository | ||
|
||
import com.skyd.rays.base.BaseData | ||
import com.skyd.rays.base.BaseRepository | ||
import com.skyd.rays.model.db.dao.SearchDomainDao | ||
import com.skyd.rays.model.bean.SearchDomainBean | ||
import com.skyd.rays.model.db.dao.SearchDomainDao | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.flow | ||
import javax.inject.Inject | ||
|
||
class SearchConfigRepository @Inject constructor( | ||
private val searchDomainDao: SearchDomainDao | ||
) : BaseRepository() { | ||
suspend fun requestGetSearchDomain(): Flow<BaseData<Map<String, Boolean>>> { | ||
return flow { | ||
suspend fun requestGetSearchDomain(): Flow<Map<String, Boolean>> { | ||
return flowOnIo { | ||
val map = mutableMapOf<String, Boolean>() | ||
searchDomainDao.getAllSearchDomain().forEach { | ||
map["${it.tableName}/${it.columnName}"] = it.search | ||
} | ||
emitBaseData(BaseData<Map<String, Boolean>>().apply { | ||
code = 0 | ||
data = map | ||
}) | ||
emit(map) | ||
} | ||
} | ||
|
||
suspend fun requestSetSearchDomain( | ||
searchDomainBean: SearchDomainBean | ||
): Flow<BaseData<Map<String, Boolean>>> { | ||
return flow { | ||
): Flow<SearchDomainBean> { | ||
return flowOnIo { | ||
searchDomainDao.setSearchDomain(searchDomainBean) | ||
val map = mutableMapOf<String, Boolean>() | ||
searchDomainDao.getAllSearchDomain().forEach { | ||
map["${it.tableName}/${it.columnName}"] = it.search | ||
} | ||
emitBaseData(BaseData<Map<String, Boolean>>().apply { | ||
code = 0 | ||
data = map | ||
}) | ||
emit(searchDomainBean) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,16 @@ | ||
package com.skyd.rays.ui.screen.add | ||
|
||
import com.skyd.rays.base.IUiEvent | ||
import com.skyd.rays.base.mvi.MviSingleEvent | ||
import com.skyd.rays.model.bean.StickerWithTags | ||
|
||
class AddEvent( | ||
val getStickersWithTagsUiEvent: GetStickersWithTagsUiEvent? = null, | ||
val addStickersResultUiEvent: AddStickersResultUiEvent? = null, | ||
val recognizeTextUiEvent: RecognizeTextUiEvent? = null, | ||
) : IUiEvent | ||
sealed interface AddEvent : MviSingleEvent { | ||
sealed interface AddStickersResultEvent : AddEvent { | ||
data class Duplicate(val stickerWithTags: StickerWithTags) : AddStickersResultEvent | ||
data class Success(val stickerUuid: String) : AddStickersResultEvent | ||
data class Failed(val msg: String) : AddStickersResultEvent | ||
} | ||
|
||
sealed class GetStickersWithTagsUiEvent { | ||
class Success(val stickerWithTags: StickerWithTags) : GetStickersWithTagsUiEvent() | ||
data object Init : GetStickersWithTagsUiEvent() | ||
data object Failed : GetStickersWithTagsUiEvent() | ||
} | ||
data object CurrentStickerChanged : AddEvent | ||
|
||
sealed class AddStickersResultUiEvent { | ||
class Duplicate(val stickerUuid: String) : AddStickersResultUiEvent() | ||
class Success(val stickerUuid: String) : AddStickersResultUiEvent() | ||
} | ||
|
||
sealed class RecognizeTextUiEvent { | ||
class Success(val texts: Set<String>) : RecognizeTextUiEvent() | ||
data object GetStickersWithTagsStateChanged : AddEvent | ||
} |
Oops, something went wrong.