From a9fb907043bccb074386ebc99815853e6654b63b Mon Sep 17 00:00:00 2001 From: Hoang Anh Tuan Date: Sun, 18 Aug 2024 21:32:24 +0700 Subject: [PATCH] optimize --- .../buildOutputCleanup.lock | Bin 39 -> 17 bytes .gradle/buildOutputCleanup/outputFiles.bin | Bin 1259297 -> 1266839 bytes constant/build.gradle | 32 +++++++++--------- .../mlkit/data/tasks/MlkitDetectStateTask.kt | 7 ++-- .../tasks/lanugage/LanguageDetectStateTask.kt | 7 ++-- .../detect/data/tasks/DetectStateTask.kt | 4 ++- .../data/tasks/MlkitTranslateStateTask.kt | 16 +++++---- .../data/tasks/TranslateStateTask.kt | 4 ++- .../translate/entities/TranslateProvider.kt | 14 ++++++++ 9 files changed, 53 insertions(+), 31 deletions(-) create mode 100644 library/translate/src/main/java/com/simple/translate/entities/TranslateProvider.kt diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 260ea404fcd68da6729be57884d090e3c4991718..55169a971cc3f20a933d696344854f775f04a35c 100644 GIT binary patch literal 17 VcmZR+#lcv`SW(i)00K;>k^v=C1PcHF literal 39 scmZR+#lcv`SW(i)00KG?9Qd+w+-j$x>8a^2Rf6)Oi91B;~K{qm`ok zCl$jsM>G)7{zCrx!ATMn^Yx`=RNZ|7`g8e=;|LLTF#nzlH-hS)KXV5qLi5nCuC57w zL?qNVKX$iVg#Pvj*nD)@7GYd)er$GHE2=cVSJA0K)T#Ve@6svM!BPFZG^;%k39HUu z(2yiT$^DjpX}5e40sWNu4WA+@RG8%wc5Y7>0(wN|yL{1!kob!E=K7vmVfcXj;oq_- zWbI#lHvZOa0@`QgH#EkIP}YJRJ3nM#I2SsT7&FbX#!vtNs=-{UXm1Kf81Yav?EH@{EJ>6lhJ#~<=99&f&sacgl zP-pAk!k@d1I7d;mOhs^8DVVrY^&+~99L9K30l`!{9NSDaYS8($@n;e%M++;O0lRXj zQW?t3e_VZF-F5!yOa)9tQnv)zW#x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c(kw>f=BACe!eA6*;%j1Onp3PX<6$esqGTg?!W2iRpY;eE7p*s&1p~~c zm|aftmBYcu<6Nl%44vRA=jie>^yjywyLNE!-9(p1g4?E; zpR-&Mi7u}ayj*8jh1V=HiraS8-QH@*Y6c?3^e$n_ml(s$9>l?a16}rGt64*=vczrB-bmWXyn6Y8%I!96HZ@6v8T$dd9Cv1*o3SxYSreRfiFrCUvu?F?!_f#oi(yULll9-|KYYu4m*s4kDpm`#sgVk1tt(BMFk-Zq>Xvs{l3$ok6l;og zL*Ctdjw0txbwn*?a*oehqqDt}+E8W>uC#RHK4>}aN+UGuOIH!7CtUbHoJl8Lg+l0| zooFT(f8%OVq3nXIffQ%dhav3;*LcYsebKCg`?g_X;>;S(;<9N;*o75*Jjc}Z73=uJ zYQ##<3@x6BOeApZn*$;JhGnWW`GHTM89^&$GRyQS2<+P$o}$?TmYa+_`nu&xdO^=l r?z8ycl`ifW2~y+TJ{#TL5z$TQ<3@X_-0NO0n*Q31+W ) : DetectStateTask { - override suspend fun executeTask(param: DetectStateTask.Param): Pair { - - val provider = DetectProvider.OFFLINE.value + override suspend fun executeTask(param: DetectStateTask.Param): Pair { val state = list.executeAsyncByFast(LanguageDetectStateTask.Param(param.languageCode)).toSuccess()?.data ?: throw LowException("") - return provider to state + return DetectProvider.OFFLINE to state } } \ No newline at end of file diff --git a/library/detect-mlkit/src/main/java/com/simple/detect/mlkit/data/tasks/lanugage/LanguageDetectStateTask.kt b/library/detect-mlkit/src/main/java/com/simple/detect/mlkit/data/tasks/lanugage/LanguageDetectStateTask.kt index 4976203b..bfb9652f 100644 --- a/library/detect-mlkit/src/main/java/com/simple/detect/mlkit/data/tasks/lanugage/LanguageDetectStateTask.kt +++ b/library/detect-mlkit/src/main/java/com/simple/detect/mlkit/data/tasks/lanugage/LanguageDetectStateTask.kt @@ -1,16 +1,17 @@ package com.simple.detect.mlkit.data.tasks.lanugage +import com.simple.detect.entities.DetectState import com.simple.task.LowException import com.simple.task.Task -abstract class LanguageDetectStateTask : Task, LanguageSupportTask { +abstract class LanguageDetectStateTask : Task, LanguageSupportTask { - override suspend fun executeTask(param: Param): Int { + override suspend fun executeTask(param: Param): DetectState { return if (!checkSupport(param.languageCode)) { throw LowException("") } else { - 1 + DetectState.READY } } diff --git a/library/detect/src/main/java/com/simple/detect/data/tasks/DetectStateTask.kt b/library/detect/src/main/java/com/simple/detect/data/tasks/DetectStateTask.kt index b11bb01b..552cd872 100644 --- a/library/detect/src/main/java/com/simple/detect/data/tasks/DetectStateTask.kt +++ b/library/detect/src/main/java/com/simple/detect/data/tasks/DetectStateTask.kt @@ -1,8 +1,10 @@ package com.simple.detect.data.tasks +import com.simple.detect.entities.DetectProvider +import com.simple.detect.entities.DetectState import com.simple.task.Task -interface DetectStateTask : Task> { +interface DetectStateTask : Task> { data class Param(val languageCode: String) } \ No newline at end of file diff --git a/library/translate-mlkit/src/main/java/com/simple/translate/mlkit/data/tasks/MlkitTranslateStateTask.kt b/library/translate-mlkit/src/main/java/com/simple/translate/mlkit/data/tasks/MlkitTranslateStateTask.kt index 3a42d55f..687c277f 100644 --- a/library/translate-mlkit/src/main/java/com/simple/translate/mlkit/data/tasks/MlkitTranslateStateTask.kt +++ b/library/translate-mlkit/src/main/java/com/simple/translate/mlkit/data/tasks/MlkitTranslateStateTask.kt @@ -4,31 +4,35 @@ import com.google.mlkit.nl.translate.TranslateLanguage import com.google.mlkit.nl.translate.TranslateRemoteModel import com.simple.state.ResultState import com.simple.translate.data.tasks.TranslateStateTask +import com.simple.translate.entities.TranslateProvider +import com.simple.translate.entities.TranslateState import com.simple.translate.mlkit.utils.exts.checkModelDownloaded class MlkitTranslateStateTask : TranslateStateTask { - override suspend fun executeTask(param: TranslateStateTask.Param): Int { + override suspend fun executeTask(param: TranslateStateTask.Param): Pair { - return if (param.languageCode !in TranslateLanguage.getAllLanguages()) { + val state = if (param.languageCode !in TranslateLanguage.getAllLanguages()) { - -1 + TranslateState.NO_SUPPORT } else { checkDownloadModel(param.languageCode) } + + return TranslateProvider.OFFLINE to state } - private suspend fun checkDownloadModel(languageCode: String): Int { + private suspend fun checkDownloadModel(languageCode: String): TranslateState { val state = TranslateRemoteModel.Builder(languageCode).build().checkModelDownloaded() return if (state is ResultState.Success) { - if (state.data) 1 else 0 + if (state.data) TranslateState.READY else TranslateState.NOT_READY } else { - -1 + TranslateState.NO_SUPPORT } } } \ No newline at end of file diff --git a/library/translate/src/main/java/com/simple/translate/data/tasks/TranslateStateTask.kt b/library/translate/src/main/java/com/simple/translate/data/tasks/TranslateStateTask.kt index ec2a0953..bd3ecd2f 100644 --- a/library/translate/src/main/java/com/simple/translate/data/tasks/TranslateStateTask.kt +++ b/library/translate/src/main/java/com/simple/translate/data/tasks/TranslateStateTask.kt @@ -1,8 +1,10 @@ package com.simple.translate.data.tasks import com.simple.task.Task +import com.simple.translate.entities.TranslateProvider +import com.simple.translate.entities.TranslateState -interface TranslateStateTask : Task { +interface TranslateStateTask : Task> { data class Param(val languageCode: String) } \ No newline at end of file diff --git a/library/translate/src/main/java/com/simple/translate/entities/TranslateProvider.kt b/library/translate/src/main/java/com/simple/translate/entities/TranslateProvider.kt new file mode 100644 index 00000000..168f05f7 --- /dev/null +++ b/library/translate/src/main/java/com/simple/translate/entities/TranslateProvider.kt @@ -0,0 +1,14 @@ +package com.simple.translate.entities + +enum class TranslateState(val value: Int) { + + READY(1), + NOT_READY(0), + NO_SUPPORT(-1) +} + +enum class TranslateProvider(val value: String) { + + ONLINE("ONLINE"), + OFFLINE("OFFLINE"); +}