|
|
@@ -4,6 +4,7 @@ import 'dart:io';
|
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
import 'package:get/get_rx/src/rx_types/rx_types.dart';
|
|
|
+import 'package:get/get_rx/src/rx_workers/rx_workers.dart';
|
|
|
import 'package:injectable/injectable.dart';
|
|
|
import 'package:keyboard/base/base_controller.dart';
|
|
|
import 'package:keyboard/data/bean/upload_info.dart';
|
|
|
@@ -13,6 +14,7 @@ import 'package:keyboard/utils/toast_util.dart';
|
|
|
import 'package:wechat_assets_picker/wechat_assets_picker.dart';
|
|
|
|
|
|
import '../../../../data/api/request/intimacy_reply_analyze_request.dart';
|
|
|
+import '../../../../data/api/response/intimacy_analyze_reply_config_response.dart';
|
|
|
import '../../../../data/api/response/intimacy_reply_analyze_response.dart';
|
|
|
import '../../../../data/bean/option_select_config.dart';
|
|
|
import '../../../../data/bean/option_select_item.dart';
|
|
|
@@ -84,18 +86,37 @@ class ScanImageReplyController extends BaseController {
|
|
|
);
|
|
|
|
|
|
@override
|
|
|
+ void onInit() {
|
|
|
+ super.onInit();
|
|
|
+ // 监听配置更新,刷新选项列表
|
|
|
+ AtmobLog.d(_tag, "监听 <识图回复> 配置更新,刷新选项列表");
|
|
|
+ ever(intimacyAnalyzeConfigHelper.intimacyAnalyzeReplyConfig, (
|
|
|
+ IntimacyAnalyzeReplyConfigResponse? config,
|
|
|
+ ) {
|
|
|
+ if (config != null) {
|
|
|
+ _initReplyToneOptionSelectConfigList(config);
|
|
|
+ _initReplyModeList(config);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @override
|
|
|
void onReady() {
|
|
|
super.onReady();
|
|
|
- _initReplyToneOptionSelectConfigList();
|
|
|
- _initReplyModeList();
|
|
|
+ // 初次加载配置
|
|
|
+ var config = intimacyAnalyzeConfigHelper.intimacyAnalyzeReplyConfig.value;
|
|
|
+ if (config != null) {
|
|
|
+ _initReplyToneOptionSelectConfigList(config);
|
|
|
+ _initReplyModeList(config);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// 初始化回复语气列表
|
|
|
- void _initReplyToneOptionSelectConfigList() {
|
|
|
+ void _initReplyToneOptionSelectConfigList(
|
|
|
+ IntimacyAnalyzeReplyConfigResponse config,
|
|
|
+ ) {
|
|
|
// 语气列表
|
|
|
- var toneList =
|
|
|
- intimacyAnalyzeConfigHelper.intimacyAnalyzeReplyConfig.value?.tones ??
|
|
|
- [];
|
|
|
+ var toneList = config.tones ?? [];
|
|
|
if (toneList.isNotEmpty) {
|
|
|
var newList =
|
|
|
toneList.map((item) {
|
|
|
@@ -115,10 +136,8 @@ class ScanImageReplyController extends BaseController {
|
|
|
}
|
|
|
|
|
|
/// 初始化回复模式
|
|
|
- void _initReplyModeList() {
|
|
|
- var modeList =
|
|
|
- intimacyAnalyzeConfigHelper.intimacyAnalyzeReplyConfig.value?.modes ??
|
|
|
- [];
|
|
|
+ void _initReplyModeList(IntimacyAnalyzeReplyConfigResponse config) {
|
|
|
+ var modeList = config.modes;
|
|
|
replyModelList.addAll(modeList);
|
|
|
replyModelList.refresh();
|
|
|
|