Explorar o código

修复若干个bug

wbspool hai 1 ano
pai
achega
92011106bf

+ 8 - 5
BusinessAuth/src/main/java/com/develop/auth/viewmodel/MemberViewModel.kt

@@ -2,6 +2,8 @@ package com.develop.auth.viewmodel
 
 import androidx.lifecycle.MutableLiveData
 import androidx.lifecycle.scopeNetLife
+import com.develop.auth.R
+import com.develop.base.ext.globalApp
 import com.develop.base.mvvm.BaseViewModel
 import com.develop.base.util.GlobalToast
 import com.develop.base.util.MMkvUtils
@@ -45,7 +47,7 @@ class MemberViewModel : BaseViewModel() {
         }
     }.catch {
         if (it.message == "账号已存在") {
-            registerLiveData.postValue(AuthModel(false, "The email has been already registered."))
+            registerLiveData.postValue(AuthModel(false, globalApp().getString(com.develop.common.R.string.the_email_has_been_already_registered)))
         } else {
             registerLiveData.postValue(AuthModel(false, it.message))
         }
@@ -84,10 +86,10 @@ class MemberViewModel : BaseViewModel() {
             body = SendVerifyCodeBody.genSendVerifyCodeBody(email)
         }.await().apply {
             mVerifyCodeKey = verifyCodeKey
-            sendEmailLiveData.postValue(AuthModel(true, "Email send"))
+            sendEmailLiveData.postValue(AuthModel(true, globalApp().getString(com.develop.common.R.string.email_send)))
         }
     }.catch {
-        GlobalToast.showToast(it.message ?: "Email not send")
+        GlobalToast.showToast(it.message ?: globalApp().getString(com.develop.common.R.string.email_not_send))
         sendEmailLiveData.postValue(AuthModel(false))
     }
 
@@ -104,7 +106,7 @@ class MemberViewModel : BaseViewModel() {
                 captcha
             )
         }.await().apply {
-            resetPasswordLiveData.postValue(AuthModel(true, "Reset password success!"))
+            resetPasswordLiveData.postValue(AuthModel(true, globalApp().getString(com.develop.common.R.string.reset_password_success)))
         }
     }.catch {
         resetPasswordLiveData.postValue(AuthModel(false, it.message))
@@ -115,7 +117,8 @@ class MemberViewModel : BaseViewModel() {
         Post<PerfectInfoResult>(Api.PERFECT_INFO) {
             body = PerfectInfoBody.genPerfectInfoBody(nickName, sex, portrait, age)
         }.await().apply {
-            perfectInfoLiveData.postValue(AuthModel(true, "Save success"))
+
+            perfectInfoLiveData.postValue(AuthModel(true,   globalApp().getString(com.develop.common.R.string.save_success)))
             MMkvUtils.save(CURRENT_USER_ID_TAG, user.id.toLong())
             val userInfo = UserInfo(
                 user.id.toLong(),

+ 1 - 3
BusinessCommon/src/main/java/com/develop/common/data_repo/FoodDataProvider.kt

@@ -16,9 +16,7 @@ import com.develop.base.util.FileKit
 import com.develop.base.util.GlobalToast
 import com.develop.base.util.ThreadUtils
 import com.develop.base.util.TopResumedAtyHolder
-import com.develop.common.data_repo.db.FoodDatabase
-import com.develop.common.data_repo.db.MIGRATION_1_2
-import com.develop.common.data_repo.db.UserDatabase
+import com.develop.common.data_repo.db.*
 import com.develop.common.dialog.CancelConfirmDialog
 import com.drake.net.utils.scope
 import kotlinx.coroutines.Dispatchers

+ 6 - 1
BusinessCommon/src/main/java/com/develop/common/data_repo/db/FoodDatabase.kt

@@ -2,10 +2,15 @@ package com.develop.common.data_repo.db
 
 import androidx.room.Database
 import androidx.room.RoomDatabase
+import androidx.room.migration.Migration
+import androidx.sqlite.db.SupportSQLiteDatabase
 import com.develop.common.data_repo.db.dao.FoodConfigDao
 import com.develop.common.data_repo.db.dao.FoodRecipeDao
 import com.develop.common.data_repo.db.entity.*
 
+
+
+
 @Database(
     entities = [
         DevAccessory::class,
@@ -20,7 +25,7 @@ import com.develop.common.data_repo.db.entity.*
         DevRecipePortionSize::class,
         DevRecipeRelTag::class,
         DevRecipeTag::class
-    ], version = 1, exportSchema = false
+    ], version = 3, exportSchema = false
 )
 abstract class FoodDatabase : RoomDatabase() {
 

+ 4 - 0
BusinessCommon/src/main/java/com/develop/common/data_repo/db/entity/DevRecipe.kt

@@ -1,5 +1,7 @@
 package com.develop.common.data_repo.db.entity
 
+import androidx.annotation.NonNull
+import androidx.annotation.Nullable
 import androidx.room.ColumnInfo
 import androidx.room.Entity
 import androidx.room.PrimaryKey
@@ -32,6 +34,8 @@ data class DevRecipe(
     @ColumnInfo
     val edition: String?,
 
+
+
     /**
      * 默认语言
      */

+ 29 - 0
BusinessCommon/src/main/java/com/develop/common/utils/AppVersionUtil.kt

@@ -1,11 +1,17 @@
 package com.develop.common.utils
 
+import android.annotation.SuppressLint
+import android.app.Application
+import android.content.Context
 import android.net.Uri
+import android.os.PowerManager
 import android.provider.Settings
+import androidx.core.content.ContextCompat.getSystemService
 import com.azhon.appupdate.util.LogUtil
 import com.blankj.utilcode.util.FileUtils
 import com.blankj.utilcode.util.ZipUtils
 import com.develop.base.ext.fromJson
+import com.develop.base.ext.globalApp
 import com.develop.base.util.FileKit
 import com.develop.base.util.MMkvUtils
 import com.develop.base.util.TopResumedAtyHolder
@@ -60,6 +66,8 @@ object AppVersionUtil {
                         dialog.onDialogClickListener =
                             object : RecipeUpdateDialog.OnDialogClickListener {
                                 override fun onConfirm() {
+                                    updateRecipe = !updateRecipe
+
                                     EventBus.getDefault().post(NoScreenEvent(true))
                                     downloadRecipes(
                                         newRecipes,
@@ -89,6 +97,9 @@ object AppVersionUtil {
         }
     }
 
+    var updateRecipe = false
+
+    @SuppressLint("InvalidWakeLockTag")
     private fun downloadRecipes(
         newRecipes: LinkedList<String>,
         recipeUpdateDialog: RecipeUpdateDialog,
@@ -97,12 +108,28 @@ object AppVersionUtil {
         downloadName: String,
         recipeUpdateTime: Long?
     ) {
+
+        //取消标识退出
+        if(!updateRecipe){
+            return
+        }
+
+        //升级休眠
+        val pm = globalApp().getSystemService(Application.POWER_SERVICE) as PowerManager
+        val mWakeLock = pm.newWakeLock(
+            PowerManager.SCREEN_BRIGHT_WAKE_LOCK or PowerManager.ON_AFTER_RELEASE or PowerManager.ACQUIRE_CAUSES_WAKEUP,
+            "tag"
+        );
+        mWakeLock?.setReferenceCounted(false);
+        mWakeLock?.acquire(10*60*1000L /*10 minutes*/)
+
         TopResumedAtyHolder.getCurrentActivity()?.apply {
             if (newRecipes.isEmpty()) {
                 recipeUpdateDialog.removeSelf()
                 showRecipesUpdateDialog(recipeUpdateTime)
                 return
             }
+
             val recipeUrl = newRecipes.pop()
             val recipeNumber = recipeUrl.split("@")[0]
             val fileUrl = recipeUrl.split("@")[1]
@@ -138,7 +165,9 @@ object AppVersionUtil {
                     )
                 }
             }
+
         }
+        mWakeLock.release()
     }
 
     private fun prepareResource(file: File, recipeNumber: String) {

+ 1 - 1
BusinessCommon/src/main/java/com/develop/common/widget/NewsLayout.kt

@@ -69,7 +69,7 @@ class NewsLayout : RelativeLayout {
             })
 
         }.models = dataList
-        binding.tvNotice.updateText("${context.getString(R.string.notice)}(0)")
+        binding.tvNotice.updateText("${context.getString(R.string.notice)}")
     }
 
 

+ 5 - 0
BusinessCommon/src/main/res/values-fr/strings.xml

@@ -261,4 +261,9 @@ Nanfang plus client is an online information platform developed and operated by
     <string name="loading">chargement</string>
     <string name="Min20">20Min</string>
     <string name="enjoy_your_meal">Votre recette est prête ! Bon appétit </string>
+    <string name="save_success">Paramètres enregistrés”</string>
+    <string name="reset_password_success">Réinitialisation du mot de passe réussie !</string>
+    <string name="email_send">Email envoyé</string>
+    <string name="email_not_send">Email non envoyé</string>
+    <string name="the_email_has_been_already_registered">L\'email est déjà enregistré</string>
 </resources>

+ 5 - 0
BusinessCommon/src/main/res/values/strings.xml

@@ -271,6 +271,11 @@ Nanfang plus client is an online information platform developed and operated by
     <string name="loading">Loading</string>
     <string name="Min20">20Min</string>
     <string name="enjoy_your_meal">ENJOY YOUR MEAL</string>
+    <string name="save_success">Save success</string>
+    <string name="reset_password_success">Reset password success!</string>
+    <string name="email_send">Email send</string>
+    <string name="email_not_send">Email not send</string>
+    <string name="the_email_has_been_already_registered">The email has been already registered</string>
 
 
 </resources>

+ 3 - 3
BusinessStep/src/main/java/com/develop/step/ui/ModesDetailActivity.kt

@@ -705,9 +705,9 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
             }
         }
         val packageName = this.packageName;
-
+        val ctx = this
         backRequestDialog.apply {
-            title = "Keep cooking in the background?"
+            title = ctx.getString(com.develop.common.R.string.keep_cooking_in_the_background)
             onDialogClickListener = object : CancelConfirmDialog.OnDialogClickListener {
                 override fun onConfirm() {
                     var workMode = ConfigUtils.getMode(modeType)
@@ -1144,7 +1144,7 @@ class ModesDetailActivity : CommonBVMActivity<ActivityModeDetailBinding, ModesVi
             }
             if (mRunningState == DevStatus.RUNNING.toInt() && currDevInfo.motorGear > 0) {
                 viewModel.playRotateAnimator(
-                    motorDirection, binding.clCookDirection.binding.viewIcon
+                    CofarSDK.devInfo().motorDirection.toInt(), binding.clCookDirection.binding.viewIcon
                 )
             } else {
                 viewModel.pauseRotateAnimator(binding.clCookDirection.binding.viewIcon)

+ 4 - 4
BusinessStep/src/main/java/com/develop/step/ui/cook_step/CookStepActivity.kt

@@ -373,9 +373,9 @@ class CookStepActivity : CookStepBaseActivity() {
             // initStepData()
 
         }
-
+        var ctx = this
         backRequestDialog.apply {
-            title = "Keep cooking in the background?"
+            title = ctx.getString(R.string.keep_cooking_in_the_background)
             onDialogClickListener = object : CancelConfirmDialog.OnDialogClickListener {
                 override fun onConfirm() {
                     val info = CofarSDK.devInfo().runningInstId.split(":");
@@ -793,7 +793,7 @@ class CookStepActivity : CookStepBaseActivity() {
                         it.targetTemp = it.limitMinTemp
                     }
 
-                    if (it.targetTemp < 37) {
+                    if (it.targetTemp < 35) {
                         it.targetTemp = 0
                     }
 
@@ -1102,7 +1102,7 @@ class CookStepActivity : CookStepBaseActivity() {
             && uiData.runningStatus == DevStatus.RUNNING.toInt()
             && uiData.currentSpeed > 0
         ) {
-            playRotateAnimator(uiData.direction)
+            playRotateAnimator(CofarSDK.devInfo().motorDirection.toInt()) //2023年06月28日20:58:13 旋转方向和实时固定
         } else {
             pauseRotateAnimator()
         }

+ 1 - 0
BusinessStep/src/main/java/com/develop/step/viewmodel/ModesViewMode.kt

@@ -127,6 +127,7 @@ class ModesViewMode : BaseViewModel() {
     }
 
     fun playRotateAnimator(direction: Int, viewIcon: ImageView) {
+
         if (rotateAnimator == null) {
             rotateAnimator = ObjectAnimator.ofFloat(
                 viewIcon, View.ROTATION, 0f, 360f

+ 0 - 18
app/release/output-metadata.json

@@ -1,18 +0,0 @@
-{
-  "version": 2,
-  "artifactType": {
-    "type": "APK",
-    "kind": "Directory"
-  },
-  "applicationId": "com.develop.foodcooking",
-  "variantName": "release",
-  "elements": [
-    {
-      "type": "SINGLE",
-      "filters": [],
-      "versionCode": 230617180,
-      "versionName": "1039.010D.230617180",
-      "outputFile": "cofar-cooking_1039.010D.230617180-release.apk"
-    }
-  ]
-}

+ 2 - 2
app/src/main/java/com/develop/foodcooking/FoodCookingApp.kt

@@ -70,8 +70,8 @@ class FoodCookingApp : BaseApp() {
         WindowManager.getInstance().init(this, OptionFactory())
         val isNight = !isNightTheme()
         //切换主题,theme=0 night= false 是0000的主题,而且需要AndroidManifest.xml主题设置为  android:theme="@style/SplashTheme"
-        ThemeSkinService.getInstance().switchThemeSkin(0)
-        setNightTheme(false)
+        ThemeSkinService.getInstance().switchThemeSkin(1)
+        setNightTheme(true)
         SerialPortUtils.init()
         CofarSDK.register(this)
         CofarSDK.stopNative()