|
|
@ -1,6 +1,7 @@ |
|
|
import 'dart:async'; |
|
|
import 'dart:async'; |
|
|
import '/core/utils/id_verify_guard.dart'; |
|
|
import '/core/utils/id_verify_guard.dart'; |
|
|
import '/core/utils/device_connection.dart'; |
|
|
import '/core/utils/device_connection.dart'; |
|
|
|
|
|
import '/core/utils/toast_throttle.dart'; |
|
|
|
|
|
|
|
|
import 'package:device_jieli/device_jieli.dart'; |
|
|
import 'package:device_jieli/device_jieli.dart'; |
|
|
import 'package:get/get.dart'; |
|
|
import 'package:get/get.dart'; |
|
|
@ -271,25 +272,30 @@ class HomeController extends GetxController { |
|
|
// 三条链路任意一条连上都算已连接(杰理 / 蓝讯支架 / 恒玄耳机)。 |
|
|
// 三条链路任意一条连上都算已连接(杰理 / 蓝讯支架 / 恒玄耳机)。 |
|
|
// 之前只看 _isFullyConnected(杰理专用),恒玄耳机连上了照样被拦。 |
|
|
// 之前只看 _isFullyConnected(杰理专用),恒玄耳机连上了照样被拦。 |
|
|
// 通话翻译还要求正处于通话中——耳机得先进通话模式(0xD1)才有双路音频 |
|
|
// 通话翻译还要求正处于通话中——耳机得先进通话模式(0xD1)才有双路音频 |
|
|
|
|
|
// ⚠️ 下面三条一律走 ToastThrottle 而不是裸 Get.snackbar: |
|
|
|
|
|
// 它们拦的都是「这个功能现在就是用不了」,而卡片只是灰着、点得动, |
|
|
|
|
|
// 用户会连点几下试——每点一下补一条一模一样的提示就把屏幕糊满了, |
|
|
|
|
|
// 而且 Get 的 snackbar 会排队,要等它们逐条超时才散得干净。 |
|
|
|
|
|
// 信息量只在第一条,后面全是噪音。 |
|
|
if (needBle && DeviceConnection.any && !DeviceConnection.inCall) { |
|
|
if (needBle && DeviceConnection.any && !DeviceConnection.inCall) { |
|
|
Get.snackbar('callRequiredTitle'.tr, 'callRequiredDesc'.tr, |
|
|
ToastThrottle.show(ToastThrottle.keyCallRequired, |
|
|
snackPosition: SnackPosition.TOP, |
|
|
title: 'callRequiredTitle'.tr, |
|
|
duration: const Duration(seconds: 2)); |
|
|
message: 'callRequiredDesc'.tr, |
|
|
|
|
|
window: ToastThrottle.gateWindow); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (needBle && !DeviceConnection.any) { |
|
|
if (needBle && !DeviceConnection.any) { |
|
|
Get.snackbar( |
|
|
ToastThrottle.show(ToastThrottle.keyConnectDevice, |
|
|
'connectDevice'.tr, // 连接设备 |
|
|
title: 'connectDevice'.tr, // 连接设备 |
|
|
'pleaseConnectDeepSoundDevice'.tr, // 请连接 Eaimar 设备 |
|
|
message: 'pleaseConnectDeepSoundDevice'.tr, // 请连接 Eaimar 设备 |
|
|
snackPosition: SnackPosition.TOP, |
|
|
window: ToastThrottle.gateWindow); |
|
|
duration: const Duration(seconds: 1), |
|
|
|
|
|
); |
|
|
|
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (DeviceConnection.isBlockedByCall(translationId)) { |
|
|
if (DeviceConnection.isBlockedByCall(translationId)) { |
|
|
Get.snackbar('inCallBusyTitle'.tr, 'inCallBusyDesc'.tr, |
|
|
ToastThrottle.show(ToastThrottle.keyInCallBusy, |
|
|
snackPosition: SnackPosition.TOP, |
|
|
title: 'inCallBusyTitle'.tr, |
|
|
duration: const Duration(seconds: 2)); |
|
|
message: 'inCallBusyDesc'.tr, |
|
|
|
|
|
window: ToastThrottle.gateWindow); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
AgentService.interruptCurrentResponse(); |
|
|
AgentService.interruptCurrentResponse(); |
|
|
@ -301,18 +307,17 @@ class HomeController extends GetxController { |
|
|
void openCallRecording() { |
|
|
void openCallRecording() { |
|
|
if (IdVerifyGuard.blocked()) return; |
|
|
if (IdVerifyGuard.blocked()) return; |
|
|
if (DeviceConnection.any && !DeviceConnection.inCall) { |
|
|
if (DeviceConnection.any && !DeviceConnection.inCall) { |
|
|
Get.snackbar('callRequiredTitle'.tr, 'callRequiredDesc'.tr, |
|
|
ToastThrottle.show(ToastThrottle.keyCallRequired, |
|
|
snackPosition: SnackPosition.TOP, |
|
|
title: 'callRequiredTitle'.tr, |
|
|
duration: const Duration(seconds: 2)); |
|
|
message: 'callRequiredDesc'.tr, |
|
|
|
|
|
window: ToastThrottle.gateWindow); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (!DeviceConnection.any) { |
|
|
if (!DeviceConnection.any) { |
|
|
Get.snackbar( |
|
|
ToastThrottle.show(ToastThrottle.keyConnectDevice, |
|
|
'connectDevice'.tr, // 连接设备 |
|
|
title: 'connectDevice'.tr, // 连接设备 |
|
|
'pleaseConnectDeepSoundDevice'.tr, // 请连接 Eaimar 设备 |
|
|
message: 'pleaseConnectDeepSoundDevice'.tr, // 请连接 Eaimar 设备 |
|
|
snackPosition: SnackPosition.TOP, |
|
|
window: ToastThrottle.gateWindow); |
|
|
duration: const Duration(seconds: 1), |
|
|
|
|
|
); |
|
|
|
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
Get.toNamed(Routes.recording, |
|
|
Get.toNamed(Routes.recording, |
|
|
@ -325,9 +330,10 @@ class HomeController extends GetxController { |
|
|
/// (具体分支见 CallRecordingController._startRecording)。 |
|
|
/// (具体分支见 CallRecordingController._startRecording)。 |
|
|
void openFieldRecording() { |
|
|
void openFieldRecording() { |
|
|
if (DeviceConnection.isBlockedByCall('fieldRecording')) { |
|
|
if (DeviceConnection.isBlockedByCall('fieldRecording')) { |
|
|
Get.snackbar('inCallBusyTitle'.tr, 'inCallBusyDesc'.tr, |
|
|
ToastThrottle.show(ToastThrottle.keyInCallBusy, |
|
|
snackPosition: SnackPosition.TOP, |
|
|
title: 'inCallBusyTitle'.tr, |
|
|
duration: const Duration(seconds: 2)); |
|
|
message: 'inCallBusyDesc'.tr, |
|
|
|
|
|
window: ToastThrottle.gateWindow); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (IdVerifyGuard.blocked()) return; |
|
|
if (IdVerifyGuard.blocked()) return; |
|
|
|