|
@@ -119,15 +119,30 @@ class RooViewController extends GetxController with WatchRequestOption {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ bool isH210 =
|
|
|
+ (GlobalConfig.prefs.getString(PreferenceConst.PRE_DEVICE_MODEL) ?? '') == "H210";
|
|
|
@override
|
|
|
void replyFromWatch(data) {
|
|
|
if (data is WatchReceiverRespBean) {
|
|
|
switch (data.commandType) {
|
|
|
case WatchResponseType.findPhone: //查找手机
|
|
|
+ if(isH210) {
|
|
|
AvoidDoubleExecute.execute(Callback(notice: () {
|
|
|
playSound();
|
|
|
}), seconds: 1);
|
|
|
- break;
|
|
|
+ } else {
|
|
|
+ if(data.status == 1) {
|
|
|
+ if(findPhoneTimer == null) {
|
|
|
+ startFindPhoneTimer();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if(findPhoneTimer != null) {
|
|
|
+ findPhoneTimer!.cancel();
|
|
|
+ }
|
|
|
+ findPhoneTimer = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -208,6 +223,16 @@ class RooViewController extends GetxController with WatchRequestOption {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ Timer? findPhoneTimer;
|
|
|
+ void startFindPhoneTimer() {
|
|
|
+ const Duration duration = Duration(seconds: 3);
|
|
|
+ findPhoneTimer = Timer.periodic(duration, (timer) {
|
|
|
+ AvoidDoubleExecute.execute(Callback(notice: () {
|
|
|
+ playSound();
|
|
|
+ }), seconds: 1);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
///启动应用自动连接设备
|
|
|
void _doConnectDevice(BluetoothState? value) async {
|
|
|
switch (value) {
|