Merge branch 'develop_sky_liyi' into 'develop_sky'

Develop sky liyi

See merge request StarlockTeam/app-starlock!225
This commit is contained in:
李仪 2025-07-29 05:51:07 +00:00
commit 43c4e703b9
6 changed files with 214 additions and 25 deletions

View File

@ -1168,6 +1168,7 @@
"第三方平台设置": "第三方平台设置",
"涂鸦智能": "Tuya Smart",
"锁语音包设置": "锁语音包设置",
"语音包设置": "语音包设置",
"(中国台湾)": "(中国台湾)",
"男声": "男声",
"女声": "女声"

View File

@ -1170,6 +1170,7 @@
"第三方平台设置": "第三方平台设置",
"涂鸦智能": "涂鸦智能",
"锁语音包设置": "锁语音包设置",
"语音包设置": "语音包设置",
"(中国台湾)": "(中国台湾)",
"男声": "男声",
"女声": "女声"

View File

@ -34,6 +34,12 @@ class SpeechLanguageSettingsLogic extends BaseGetXController {
final SpeechLanguageSettingsState state = SpeechLanguageSettingsState();
StreamSubscription<Reply>? _replySubscription;
//
Timer? _sendTimeoutTimer;
//
bool _isTimeout = false;
@override
void onInit() async {
super.onInit();
@ -45,10 +51,9 @@ class SpeechLanguageSettingsLogic extends BaseGetXController {
} else if (reply is VoicePackageConfigureProcessReply) {
_handlerVoicePackageConfigureProcess(reply);
} else if (reply is VoicePackageConfigureConfirmationReply) {
_handlerVoicePackageConfigureConfirmation(reply);
handleVoiceConfigureThrottled(reply);
}
});
await initList();
}
@ -110,14 +115,22 @@ class SpeechLanguageSettingsLogic extends BaseGetXController {
.lockSetInfoData.value.lockSettingInfo?.currentVoiceTimbre?.lang;
final timbre = state
.lockSetInfoData.value.lockSettingInfo?.currentVoiceTimbre?.timbre;
state.languages.value.forEach((element) {
final timbres = element.timbres;
timbres.forEach((item) {
if (lang == element.lang && item.timbre == timbre) {
state.selectSoundTypeIndex.value = item.isFemale;
// for 访
for (int i = 0; i < state.languages.length; i++) {
final language = state.languages[i]; //
if (language.lang == lang) {
print('匹配到下标:$i,元素:$language');
final timbres = language.timbres;
for (int j = 0; j < timbres.length; j++) {
final item = timbres[j];
if (lang == language.lang && item.timbre == timbre) {
state.selectSoundTypeIndex.value = item.isFemale;
state.selectPassthroughListIndex.value = i;
break;
}
}
});
});
}
}
}
} catch (e) {
debugPrint('获取语音包出现错误:$e');
@ -266,7 +279,39 @@ class SpeechLanguageSettingsLogic extends BaseGetXController {
_sendNextPackage();
}
void _handleSendTimeout() {
_isTimeout = true; //
dismissEasyLoading();
cancelBlueConnetctToastTimer();
showBlueConnetctToast();
//
state.voiceSubcontractingIndex = 0;
state.voiceSubcontractingCount = 0;
state.data = null;
state.progress.value = 0.0;
_isTimeout = false; //
}
void _sendNextPackage() async {
//
if (_isTimeout) return;
//
_sendTimeoutTimer?.cancel();
//
if (state.voiceSubcontractingIndex >= state.voiceSubcontractingCount) {
print('所有分包已发送完成');
state.progress.value = 1.0;
return;
}
// 3
_sendTimeoutTimer = Timer(Duration(seconds: 3), () {
_handleSendTimeout(); //
});
if (state.voiceSubcontractingIndex >= state.voiceSubcontractingCount) {
print('所有分包已发送完成');
state.progress.value = 1.0; //
@ -313,6 +358,9 @@ class SpeechLanguageSettingsLogic extends BaseGetXController {
void _handlerVoicePackageConfigureProcess(
VoicePackageConfigureProcessReply reply) {
//
_sendTimeoutTimer?.cancel();
_isTimeout = false; //
final int status = reply.data[2];
switch (status) {
case 0x00:
@ -358,7 +406,30 @@ class SpeechLanguageSettingsLogic extends BaseGetXController {
super.onClose();
}
void _handlerVoicePackageConfigureConfirmation(
bool _isThrottled = false;
void handleVoiceConfigureThrottled(
VoicePackageConfigureConfirmationReply reply,
) {
if (_isThrottled) return;
_isThrottled = true;
//
_executeLogic(reply);
// 1
Future.delayed(Duration(seconds: 1), () {
_isThrottled = false;
});
}
Future<void> _executeLogic(
VoicePackageConfigureConfirmationReply reply) async {
await _handlerVoicePackageConfigureConfirmation(reply);
}
_handlerVoicePackageConfigureConfirmation(
VoicePackageConfigureConfirmationReply reply,
) async {
final int status = reply.data[2];

View File

@ -48,7 +48,86 @@ class _SpeechLanguageSettingsPageState
),
],
),
body: _buildBody(),
body: Obx(
() => ListView(
padding: EdgeInsets.zero,
children: [
//
Container(
color: Colors.white,
child: Column(
children: List.generate(
state.soundTypeList.length,
(index) {
final isLastItem = index == state.soundTypeList.length - 1;
final soundType = state.soundTypeList.value[index];
return CommonItem(
leftTitel: soundType,
rightTitle: '',
isHaveLine: !isLastItem,
isHaveDirection: false,
isHaveRightWidget: true,
rightWidget: Radio<String>(
value: soundType,
groupValue: state.soundTypeList
.value[state.selectSoundTypeIndex.value],
activeColor: AppColors.mainColor,
onChanged: (value) {
if (value != null) {
final newIndex = state.soundTypeList.value
.indexWhere((p) => p == value);
if (newIndex != -1) {
state.selectSoundTypeIndex.value = newIndex;
}
}
},
),
action: () {
state.selectSoundTypeIndex.value = index;
},
);
},
),
),
),
SizedBox(
height: 8.h,
),
//
Container(
color: Colors.transparent,
child: Column(
children: List.generate(
state.languages.length,
(index) {
final item = state.languages[index];
return CommonItem(
leftTitel: item.langText,
rightTitle: '',
isHaveLine: true,
isHaveDirection: false,
isHaveRightWidget: true,
rightWidget:
state.selectPassthroughListIndex.value == index
? Image(
image: const AssetImage(
'images/icon_item_checked.png'),
width: 30.w,
height: 30.w,
fit: BoxFit.contain,
)
: Container(),
action: () {
state.selectPassthroughListIndex.value = index;
},
);
},
),
),
),
],
),
),
);
}
@ -57,10 +136,7 @@ class _SpeechLanguageSettingsPageState
() => SingleChildScrollView(
child: Column(
children: [
Container(
width: 1.sw,
decoration: BoxDecoration(color: Colors.white),
child: ListView.builder(
ListView.builder(
itemCount: state.soundTypeList.length,
itemBuilder: (BuildContext context, int index) {
// itemCount - 1
@ -105,12 +181,8 @@ class _SpeechLanguageSettingsPageState
);
},
shrinkWrap: true,
physics: const AlwaysScrollableScrollPhysics(),
),
),
SizedBox(
height: 8.h,
),
physics: const NeverScrollableScrollPhysics() //add this line,
),
Column(
children: _buildList(),
),

View File

@ -1,8 +1,8 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:fluwx/fluwx.dart';
import 'package:get/get.dart';
import 'package:star_lock/flavors.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart';
@ -84,8 +84,8 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
// showCupertinoAlertDialog(
// context, state.inputNameController);
// })),
Obx(() => lockDataListItem('姓名'.tr,
state.keyboardPwdName.value, () {
Obx(() =>
lockDataListItem('姓名'.tr, state.keyboardPwdName.value, () {
showCupertinoAlertDialog(
context, state.inputNameController);
})),
@ -436,7 +436,18 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage>
final String pwdShareStr = logic.getShareContentStr();
switch (itemIndex) {
case 0: //
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
Fluwx fluwx = Fluwx();
fluwx.registerApi(
appId: F.wechatAppInfo.wechatAppId,
universalLink: F.wechatAppInfo.universalLink,
);
fluwx.share(
WeChatShareTextModel(
pwdShareStr,
scene: WeChatScene.session,
),
);
// NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
break;
case 1: //
case 2: //

View File

@ -31,6 +31,11 @@ class LockVoiceSettingLogic extends BaseGetXController {
LockVoiceSettingState state = LockVoiceSettingState();
StreamSubscription<Reply>? _replySubscription;
bool _isThrottled = false;
//
Timer? _sendTimeoutTimer;
//
bool _isTimeout = false;
@override
void onInit() async {
@ -168,6 +173,9 @@ class LockVoiceSettingLogic extends BaseGetXController {
void _handlerVoicePackageConfigureProcess(
VoicePackageConfigureProcessReply reply) {
//
_sendTimeoutTimer?.cancel();
_isTimeout = false; //
final int status = reply.data[2];
switch (status) {
case 0x00:
@ -300,8 +308,27 @@ class LockVoiceSettingLogic extends BaseGetXController {
state.progress.value = 0.0; //
_sendNextPackage();
}
void _handleSendTimeout() {
_isTimeout = true; //
dismissEasyLoading();
cancelBlueConnetctToastTimer();
showBlueConnetctToast();
//
state.voiceSubcontractingIndex = 0;
state.voiceSubcontractingCount = 0;
state.data = null;
state.progress.value = 0.0;
_isTimeout = false; //
}
void _sendNextPackage() {
//
if (_isTimeout) return;
//
_sendTimeoutTimer?.cancel();
if (state.voiceSubcontractingIndex >= state.voiceSubcontractingCount) {
print('所有分包已发送完成');
state.progress.value = 1.0; //
@ -309,6 +336,12 @@ class LockVoiceSettingLogic extends BaseGetXController {
return;
}
// 3
_sendTimeoutTimer = Timer(Duration(seconds: 3), () {
_handleSendTimeout(); //
});
int start = state.voiceSubcontractingIndex * state.voiceSubcontractingSize;
int end = start + state.voiceSubcontractingSize;
if (end > state.data!.length) end = state.data!.length;