wbspool 10 mēneši atpakaļ
vecāks
revīzija
c7f22e5150

+ 1 - 1
BusinessCommon/src/main/java/com/develop/common/ui/CommonBindingActivity.kt

@@ -282,7 +282,7 @@ abstract class CommonBindingActivity<T : ViewBinding> : BaseBindingActivity<T>()
         }
 
         //称重模式下,非电子称重异常的提示,都不用提示
-        if (CofarSDK.devInfo().isWeightStatus && event.msg != "dian_zi_cheng_tong_xin_yi_chan") {
+        if (CofarSDK.devInfo().isWeightStatus && event.msg != "dian_zi_cheng_tong_xin_yi_chan" && event.msg != "weight_overload_tips") {
             return
         }
 

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

@@ -176,6 +176,14 @@ object AppVersionUtil {
 
     var updateRecipe = false
 
+
+    private fun saveRecipeUpdateTime(recipeUpdateTime: Long?) {
+        val v =
+            FoodDataProvider.getUserDatabase().devConfigDao().recipeVersion() ?: DevVersion(0, 0)
+        v.recipeUpdateTime = recipeUpdateTime
+        FoodDataProvider.getUserDatabase().devConfigDao().saveDevVersion(v)
+    }
+
     @SuppressLint("InvalidWakeLockTag")
     private fun downloadRecipes(
         newRecipes: LinkedList<String>,
@@ -202,8 +210,25 @@ object AppVersionUtil {
 
         TopResumedAtyHolder.getCurrentActivity()?.apply {
             if (newRecipes.isEmpty()) {
-                recipeUpdateDialog.removeSelf()
-                showRecipesUpdateDialog(recipeUpdateTime)
+                saveRecipeUpdateTime(recipeUpdateTime)
+                scopeNetLife {
+                    //判断是否还有新菜谱
+                    val result = Post<DevInfoResult>(Api.DEV_INFO) {
+                        body = DeviceInfoBody.genDeviceInfoBody()
+                    }.await()
+
+                    val ut = result.recipeUpdateTime
+                    val nr = LinkedList(result.newRecipes)
+                    if (!nr.isEmpty()) {
+                        downloadRecipes(nr,recipeUpdateDialog,
+                            nr.size.toLong(),downloadDir,downloadName,ut)
+                        return@scopeNetLife
+                    }else{
+                        recipeUpdateDialog.removeSelf()
+                        showRecipesUpdateDialog(recipeUpdateTime)
+                    }
+                }
+
                 return
             }
 
@@ -324,10 +349,8 @@ object AppVersionUtil {
             RecipeUpdateDialog().apply {
                 onDialogClickListener = object : RecipeUpdateDialog.OnDialogClickListener {
                     override fun onConfirm() {
-                        val v = FoodDataProvider.getUserDatabase().devConfigDao().recipeVersion()
-                            ?: DevVersion(0, 0)
-                        v.recipeUpdateTime = recipeUpdateTime
-                        FoodDataProvider.getUserDatabase().devConfigDao().saveDevVersion(v)
+                        saveRecipeUpdateTime(recipeUpdateTime)
+
                         removeSelf()
                     }