Przeglądaj źródła

[feat]键盘插件,处理不断点击按键,正在加载中,还会触发多个请求的问题

hezihao 9 miesięcy temu
rodzic
commit
b88bb95f4c

+ 9 - 1
plugins/keyboard_android/android/src/main/kotlin/com/atmob/keyboard_android/component/child/impl/AiKeyboardCommonPanelComponent.kt

@@ -98,10 +98,18 @@ class AiKeyboardCommonPanelComponent @JvmOverloads constructor(
             mKeyListAdapter = MultiTypeAdapter(mKeyListItems).apply {
                 // 键盘按键条目
                 register(AiKeyboardKeyModel::class.java, AiKeyboardKeyViewBinder {
-                    // 正在加载中,忽略点击
+                    // 当前点击的条目,正在加载中,忽略点击
                     if (it.isLoading) {
                         return@AiKeyboardKeyViewBinder
                     }
+                    // 其他条目正在加载中,忽略点击
+                    val hasItemLoading =
+                        mKeyListItems.filterIsInstance<AiKeyboardKeyModel>().filter {
+                            it.isLoading
+                        }.toList().isNotEmpty()
+                    if (hasItemLoading) {
+                        return@AiKeyboardKeyViewBinder
+                    }
                     // 点击键盘按键,打开AI生成内容面板
                     if (it.isVip) {
                         // 检查是否VIP