Merge branch 'develop_liyi' into canary_release

This commit is contained in:
Liuyf 2025-04-10 14:35:20 +08:00
commit 80e2b62724
16 changed files with 163 additions and 103 deletions

View File

@ -173,9 +173,9 @@
"接收人信息": "收件人", "接收人信息": "收件人",
"转移网关": "傳輸網關", "转移网关": "傳輸網關",
"锁屏": "屏幕鎖定", "锁屏": "屏幕鎖定",
"已关闭": "關閉", "已关闭": "關閉",
"已开启": "", "已开启": "已開啟",
"开启": "開", "开启": "開",
"确定要开启重置键?": "繼續啟用Reset掣", "确定要开启重置键?": "繼續啟用Reset掣",
"确定要关闭重置键?": "繼續禁用Reset掣", "确定要关闭重置键?": "繼續禁用Reset掣",
"隐藏无效开锁权限": "隱藏無效訪問權限", "隐藏无效开锁权限": "隱藏無效訪問權限",

View File

@ -172,9 +172,9 @@
"接收人信息": "收件人", "接收人信息": "收件人",
"转移网关": "傳輸網關", "转移网关": "傳輸網關",
"锁屏": "屏幕鎖定", "锁屏": "屏幕鎖定",
"已关闭": "關", "已关闭": "",
"已开启": "開啟", "已开启": "開啟",
"开启": "開", "开启": "",
"确定要开启重置键?": "是否繼續啟用重置按鈕?", "确定要开启重置键?": "是否繼續啟用重置按鈕?",
"确定要关闭重置键?": "是否繼續禁用重置按鈕?", "确定要关闭重置键?": "是否繼續禁用重置按鈕?",
"隐藏无效开锁权限": "隱藏無效訪問", "隐藏无效开锁权限": "隱藏無效訪問",

View File

@ -140,11 +140,11 @@ class F {
case Flavor.dev: case Flavor.dev:
case Flavor.xhj_dev: case Flavor.xhj_dev:
case Flavor.sky_dev: case Flavor.sky_dev:
return 'https://dev.lock.star-lock.cn'; return 'https://lock.dev.star-lock.cn';
case Flavor.pre: case Flavor.pre:
case Flavor.xhj_pre: case Flavor.xhj_pre:
case Flavor.sky_pre: case Flavor.sky_pre:
return 'https://pre.lock.star-lock.cn'; return 'https://lock.pre.star-lock.cn';
case Flavor.sky: case Flavor.sky:
return 'https://lock.skychip.top'; return 'https://lock.skychip.top';
case Flavor.xhj: case Flavor.xhj:

View File

@ -1,18 +1,17 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/apm/apm_helper.dart'; import 'package:star_lock/apm/apm_helper.dart';
import 'package:jverify/jverify.dart';
import 'package:star_lock/appRouters.dart'; import 'package:star_lock/appRouters.dart';
import 'package:star_lock/app_settings/app_settings.dart'; import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/blue/blue_manage.dart'; import 'package:star_lock/blue/blue_manage.dart';
import 'package:star_lock/blue/io_tool/manager_event_bus.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/login/login/entity/LoginEntity.dart'; import 'package:star_lock/login/login/entity/LoginEntity.dart';
import 'package:star_lock/mine/mine/starLockMine_state.dart'; import 'package:star_lock/mine/mine/starLockMine_state.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart'; import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart';
import 'package:star_lock/network/start_chart_api.dart'; import 'package:star_lock/network/start_chart_api.dart';
import 'package:star_lock/talk/starChart/entity/star_chart_register_node_entity.dart'; import 'package:star_lock/talk/starChart/entity/star_chart_register_node_entity.dart';
import 'package:star_lock/tools/appFirstEnterHandle.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import '../../main/lockMian/lockMain/lockMain_logic.dart'; import '../../main/lockMian/lockMain/lockMain_logic.dart';
@ -143,7 +142,7 @@ class StarLockLoginLogic extends BaseGetXController {
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
if (state.countryName != entity.data!.name) { if (state.countryName != entity.data!.name) {
ShowTipView().showSureAlertDialog( ShowTipView().showSureAlertDialog(
'国家地区的选择将影响数据安全,你当前选择的是'+state.countryName+'请确认后再继续'.tr, '国家地区的选择将影响数据安全,你当前选择的是' + state.countryName + '请确认后再继续'.tr,
tipTitle: '确认国家或地区'.tr, tipTitle: '确认国家或地区'.tr,
sureStr: '我知道了'.tr); sureStr: '我知道了'.tr);
} }
@ -175,11 +174,22 @@ class StarLockLoginLogic extends BaseGetXController {
state.canNext.value = state.pwdIsOK && state.isEmailOrPhone; state.canNext.value = state.pwdIsOK && state.isEmailOrPhone;
} }
void _initEventListen() {
eventBus
.on<AgreePrivacyAgreement>()
.listen((AgreePrivacyAgreement event) async {
await JverifyOneClickLoginManage();
oneClickLoginAction();
state.isCheckVerifyEnable.value =
await JverifyOneClickLoginManage().checkVerifyEnable();
AppLog.log('一键登录初始化认证结果:${state.isCheckVerifyEnable.value}');
});
}
@override @override
Future<void> onInit() async { Future<void> onInit() async {
_initEventListen();
super.onInit(); super.onInit();
} }
@override @override

View File

@ -18,6 +18,7 @@ import 'package:star_lock/talk/starChart/handle/impl/debug_Info_model.dart';
import 'package:star_lock/talk/starChart/status/appLifecycle_observer.dart'; import 'package:star_lock/talk/starChart/status/appLifecycle_observer.dart';
import 'package:star_lock/tools/bugly/bugly_tool.dart'; import 'package:star_lock/tools/bugly/bugly_tool.dart';
import 'package:star_lock/tools/device_info_service.dart'; import 'package:star_lock/tools/device_info_service.dart';
import 'package:star_lock/tools/eventBusEventManage.dart';
import 'package:star_lock/tools/jverify_one_click_login.dart'; import 'package:star_lock/tools/jverify_one_click_login.dart';
import 'package:star_lock/tools/platform_info_services.dart'; import 'package:star_lock/tools/platform_info_services.dart';
import 'package:star_lock/tools/push/notification_service.dart'; import 'package:star_lock/tools/push/notification_service.dart';
@ -104,8 +105,9 @@ Future<void> privacySDKInitialization() async {
// //
final StarLockLoginLogic loginLogic = Get.put(StarLockLoginLogic()); final StarLockLoginLogic loginLogic = Get.put(StarLockLoginLogic());
JverifyOneClickLoginManage(); await JverifyOneClickLoginManage();
loginLogic.oneClickLoginAction(); loginLogic.oneClickLoginAction();
loginLogic.state.isCheckVerifyEnable.value = loginLogic.state.isCheckVerifyEnable.value =
await JverifyOneClickLoginManage().checkVerifyEnable(); await JverifyOneClickLoginManage().checkVerifyEnable();
eventBus.fire(AgreePrivacyAgreement());
} }

View File

@ -22,6 +22,7 @@ class FaceListLogic extends BaseGetXController {
// //
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = _replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) { EventBusManager().eventBus!.on<Reply>().listen((Reply reply) {
@ -77,11 +78,15 @@ class FaceListLogic extends BaseGetXController {
userID: (await Storage.getUid())!, userID: (await Storage.getUid())!,
faceNo: state.deletFaceNo, faceNo: state.deletFaceNo,
useCountLimit: 0xffff, useCountLimit: 0xffff,
operate: state.isDeletAll == true ? 3 : 2, // 0: 1 2: 3 operate: state.isDeletAll == true ? 3 : 2,
// 0: 1 2: 3
isAdmin: 0, isAdmin: 0,
isForce: 0, // isForce: 0,
isRound: 0, // //
weekRound: 0, // isRound: 0,
//
weekRound: 0,
//
startDate: 0x11223344, startDate: 0x11223344,
endDate: 0x11223344, endDate: 0x11223344,
startTime: '0', startTime: '0',
@ -277,11 +282,15 @@ class FaceListLogic extends BaseGetXController {
userID: (await Storage.getUid())!, userID: (await Storage.getUid())!,
faceNo: state.deletFaceNo, faceNo: state.deletFaceNo,
useCountLimit: 0xffff, useCountLimit: 0xffff,
operate: state.isDeletAll == true ? 3 : 2, // 0: 1 2: 3 operate: state.isDeletAll == true ? 3 : 2,
// 0: 1 2: 3
isAdmin: 0, isAdmin: 0,
isForce: 0, // isForce: 0,
isRound: 0, // //
weekRound: 0, // isRound: 0,
//
weekRound: 0,
//
startDate: 0x11223344, startDate: 0x11223344,
endDate: 0x11223344, endDate: 0x11223344,
startTime: '0', startTime: '0',
@ -348,8 +357,8 @@ class FaceListLogic extends BaseGetXController {
lockId: state.lockId.value, lockId: state.lockId.value,
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast('删除成功'.tr, something: () { showToast('删除成功'.tr, something: () async {
getFaceListData(isRefresh: true); await getFaceListData(isRefresh: true);
}); });
} }
} }
@ -366,8 +375,8 @@ class FaceListLogic extends BaseGetXController {
lockId: state.lockId.value, lockId: state.lockId.value,
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
showToast('重置成功'.tr, something: () { showToast('重置成功'.tr, something: () async{
getFaceListData(isRefresh: true); await getFaceListData(isRefresh: true);
}); });
} }
} }
@ -403,11 +412,12 @@ class FaceListLogic extends BaseGetXController {
// //
late StreamSubscription _teamEvent; late StreamSubscription _teamEvent;
void _initRefreshAction() { void _initRefreshAction() {
_teamEvent = eventBus _teamEvent = eventBus
.on<OtherTypeRefreshListEvent>() .on<OtherTypeRefreshListEvent>()
.listen((OtherTypeRefreshListEvent event) { .listen((OtherTypeRefreshListEvent event) async {
getFaceListData(isRefresh: true); await getFaceListData(isRefresh: true);
}); });
} }
@ -434,6 +444,7 @@ class FaceListLogic extends BaseGetXController {
// senderCheckingUserInfoCount(); // senderCheckingUserInfoCount();
} }
getFaceListData(isRefresh: true);
} }
@override @override

View File

@ -1,4 +1,3 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -31,24 +30,6 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
final FaceListLogic logic = Get.put(FaceListLogic()); final FaceListLogic logic = Get.put(FaceListLogic());
final FaceListState state = Get.find<FaceListLogic>().state; final FaceListState state = Get.find<FaceListLogic>().state;
Future<void> getHttpData({required bool isRefresh}) async {
final bool? isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
if (isDemoMode == false) {
logic.getFaceListData(isRefresh: isRefresh).then((FingerprintListDataEntity value) {
if (mounted) {
setState(() {});
}
});
}
}
@override
void initState() {
super.initState();
getHttpData(isRefresh: true);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -92,17 +73,17 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
), ),
body: EasyRefreshTool( body: EasyRefreshTool(
onRefresh: () { onRefresh: () {
getHttpData(isRefresh: true); logic.getFaceListData(isRefresh: true);
}, },
onLoad: () { onLoad: () {
getHttpData(isRefresh: false); logic.getFaceListData(isRefresh: false);
}, },
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
KeySearchWidget( KeySearchWidget(
editingController: state.searchController, editingController: state.searchController,
onSubmittedAction: () { onSubmittedAction: () {
getHttpData(isRefresh: true); logic.getFaceListData(isRefresh: true);
}, },
), ),
SizedBox( SizedBox(
@ -110,14 +91,15 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
), ),
Expanded(child: _buildMainUI()), Expanded(child: _buildMainUI()),
AddBottomWhiteBtn( AddBottomWhiteBtn(
btnName: btnName: '添加人脸'.tr,
'添加人脸'.tr,
onClick: () async { onClick: () async {
await Get.toNamed(Routers.addFaceTypePage, arguments: <String, int>{ await Get.toNamed(Routers.addFaceTypePage,
arguments: <String, int>{
'lockId': state.lockId.value, 'lockId': state.lockId.value,
'fromType': 1 // 1 2 'fromType': 1 // 1 2
})!.then((value) { })!
getHttpData(isRefresh: true); .then((value) {
logic.getFaceListData(isRefresh: true);
}); });
}, },
), ),
@ -154,9 +136,11 @@ class _FaceListPageState extends State<FaceListPage> with RouteAware {
logic.getKeyType(getFaceItemData), logic.getKeyType(getFaceItemData),
logic.getKeyDateType(getFaceItemData), () async { logic.getKeyDateType(getFaceItemData), () async {
await Get.toNamed(Routers.faceDetailPage, await Get.toNamed(Routers.faceDetailPage,
arguments: <String, FingerprintItemData>{ arguments: <String, FingerprintItemData>{
'faceItemData': getFaceItemData, 'faceItemData': getFaceItemData,
})!.then((value) => getHttpData(isRefresh: true)); })!
.then((value) =>
logic.getFaceListData(isRefresh: true));
}), }),
); );
} }

View File

@ -105,6 +105,13 @@ class AddFingerprintLogic extends BaseGetXController {
token: token, token: token,
isBeforeAddUser: false); isBeforeAddUser: false);
break; break;
case 0xFE:
//
state.ifAddState.value = false;
showToast('管理员已满'.tr, something: () {
Get.back();
});
break;
default: default:
// //
state.ifAddState.value = false; state.ifAddState.value = false;

View File

@ -285,7 +285,7 @@ class LockDetailLogic extends BaseGetXController {
final List<int> publicKeyData = final List<int> publicKeyData =
state.keyInfos.value.bluetooth!.publicKey!.cast<int>(); state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
final List<String> saveStrList = changeIntListToStringList(publicKeyData); final List<String> saveStrList = changeIntListToStringList(publicKeyData);
await Storage.setStringList(saveBluePublicKey, saveStrList); await Storage.setStringList(saveBluePublicKey, saveStrList);
// //
final List<int> privateKeyData = final List<int> privateKeyData =
@ -298,7 +298,7 @@ class LockDetailLogic extends BaseGetXController {
final List<int> signKeyData = final List<int> signKeyData =
state.keyInfos.value.bluetooth!.signKey!.cast<int>(); state.keyInfos.value.bluetooth!.signKey!.cast<int>();
final List<String> saveSignKeyList = changeIntListToStringList(signKeyData); final List<String> saveSignKeyList = changeIntListToStringList(signKeyData);
await Storage.setStringList(saveBlueSignKey, saveSignKeyList); await Storage.setStringList(saveBlueSignKey, saveSignKeyList);
final bool ifHaveKey = await Storage.ifHaveKey(saveBlueToken); final bool ifHaveKey = await Storage.ifHaveKey(saveBlueToken);
if (!ifHaveKey) { if (!ifHaveKey) {
@ -838,5 +838,12 @@ class LockDetailLogic extends BaseGetXController {
state.keyInfos.refresh(); state.keyInfos.refresh();
} }
}); });
eventBus
.on<SuccessfulDistributionNetwork>()
.listen((SuccessfulDistributionNetwork event) {
//
requestDeviceNetworkInfo();
});
} }
} }

View File

@ -89,7 +89,6 @@ class _LockDetailPageState extends State<LockDetailPage>
AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!); AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!);
state.isOpenLockNeedOnline.refresh(); state.isOpenLockNeedOnline.refresh();
logic.requestDeviceNetworkInfo();
} }
StreamSubscription? _lockRefreshLockDetailInfoDataEvent; StreamSubscription? _lockRefreshLockDetailInfoDataEvent;
@ -1024,7 +1023,7 @@ class _LockDetailPageState extends State<LockDetailPage>
Widget widget = getBottomWidget()[index]; Widget widget = getBottomWidget()[index];
return widget; return widget;
}, },
physics: const NeverScrollableScrollPhysics(), // physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
) )

View File

@ -62,10 +62,8 @@ class ConfiguringWifiLogic extends BaseGetXController {
peerId: peerId, peerId: peerId,
); );
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
await _getUploadLockSet();
showToast('配网成功'.tr, something: () async { showToast('配网成功'.tr, something: () async {
eventBus
.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
// peerID // peerID
StartChartManage().lockNetworkInfo = DeviceNetworkInfo( StartChartManage().lockNetworkInfo = DeviceNetworkInfo(
wifiName: wifiName, wifiName: wifiName,
@ -74,6 +72,7 @@ class ConfiguringWifiLogic extends BaseGetXController {
peerId: peerId, peerId: peerId,
); );
}); });
_getUploadLockSet();
} }
} }
@ -135,7 +134,7 @@ class ConfiguringWifiLogic extends BaseGetXController {
// //
await Storage.saveLockNetWorkInfo(jsonMap); await Storage.saveLockNetWorkInfo(jsonMap);
// //
updateNetworkInfo( updateNetworkInfo(
peerId: peerId ?? '', peerId: peerId ?? '',
wifiName: wifiName ?? '', wifiName: wifiName ?? '',
secretKey: secretKey ?? '', secretKey: secretKey ?? '',
@ -231,6 +230,13 @@ class ConfiguringWifiLogic extends BaseGetXController {
password: state.wifiPWDController.text, password: state.wifiPWDController.text,
gatewayConfigurationStr: state.getGatewayConfigurationStr, gatewayConfigurationStr: state.getGatewayConfigurationStr,
); );
} else if (connectionState == BluetoothConnectionState.disconnected) {
dismissEasyLoading();
cancelBlueConnetctToastTimer();
state.sureBtnState.value = 0;
if (state.ifCurrentScreen.value == true) {
showBlueConnetctToast();
}
} }
}, },
isAddEquipment: true, isAddEquipment: true,
@ -391,10 +397,10 @@ class ConfiguringWifiLogic extends BaseGetXController {
// //
Future<void> _getUploadLockSet() async { Future<void> _getUploadLockSet() async {
showEasyLoading(); // showEasyLoading();
showBlueConnetctToastTimer(action: () { // showBlueConnetctToastTimer(action: () {
dismissEasyLoading(); // dismissEasyLoading();
}); // });
BlueManage().blueSendData(BlueManage().connectDeviceName, BlueManage().blueSendData(BlueManage().connectDeviceName,
(BluetoothConnectionState connectionState) async { (BluetoothConnectionState connectionState) async {
if (connectionState == BluetoothConnectionState.connected) { if (connectionState == BluetoothConnectionState.connected) {
@ -476,6 +482,10 @@ class ConfiguringWifiLogic extends BaseGetXController {
Get.offAllNamed(Routers.starLockMain); Get.offAllNamed(Routers.starLockMain);
} }
dismissEasyLoading(); dismissEasyLoading();
eventBus
.fire(PassCurrentLockInformationEvent(state.lockSetInfoData.value));
eventBus
.fire(SuccessfulDistributionNetwork());
if (state.loadingTimer != null) { if (state.loadingTimer != null) {
state.loadingTimer!.cancel(); state.loadingTimer!.cancel();
state.loadingTimer = null; state.loadingTimer = null;
@ -493,6 +503,5 @@ class ConfiguringWifiLogic extends BaseGetXController {
state.loadingTimer!.cancel(); state.loadingTimer!.cancel();
state.loadingTimer = null; state.loadingTimer = null;
} }
} }
} }

View File

@ -456,10 +456,10 @@ class _MineSetPageState extends State<MineSetPage>
// showLoginOutAlertTipDialog(); // showLoginOutAlertTipDialog();
}), }),
Container( Container(
padding: EdgeInsets.only(right: 30.w, top: 30.h), padding: EdgeInsets.only(left: 30.w, top: 30.h),
// color: Colors.red, // color: Colors.red,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
TextButton( TextButton(
child: Text( child: Text(

View File

@ -25,8 +25,24 @@ class UdpTalkRequestHandler extends ScpMessageBaseHandle
RxString currentLanguage = RxString currentLanguage =
CurrentLocaleTool.getCurrentLocaleString().obs; // CurrentLocaleTool.getCurrentLocaleString().obs; //
//
int _lastRequestTime = 0;
@override @override
void handleReq(ScpMessage scpMessage) async { void handleReq(ScpMessage scpMessage) async {
final currentTime = DateTime.now().millisecondsSinceEpoch;
// 1
if (currentTime - _lastRequestTime < 1000) {
// 1
replyErrorMessage(scpMessage);
AppLog.log('对讲请求过于频繁,已拒绝');
return;
}
//
_lastRequestTime = currentTime;
// //
final loginData = await Storage.getLoginData(); final loginData = await Storage.getLoginData();
@ -47,6 +63,7 @@ class UdpTalkRequestHandler extends ScpMessageBaseHandle
} else { } else {
// , // ,
replyErrorMessage(scpMessage); replyErrorMessage(scpMessage);
AppLog.log('正在接听,回复拒绝');
} }
} }

View File

@ -28,17 +28,16 @@ class AppLifecycleObserver extends WidgetsBindingObserver {
void onAppPaused() { void onAppPaused() {
// //
print('App has entered the background.');
if (StartChartManage().talkStatus.status == final status = StartChartManage().talkStatus.status;
TalkStatus.passiveCallWaitingAnswer ||
StartChartManage().talkStatus.status == if (status == TalkStatus.passiveCallWaitingAnswer ||
TalkStatus.proactivelyCallWaitingAnswer) { status == TalkStatus.proactivelyCallWaitingAnswer ||
StartChartManage().startTalkHangupMessageTimer(); status == TalkStatus.answeredSuccessfully ||
StartChartManage().startTalkRejectMessageTimer(); status == TalkStatus.uninitialized) {
// 退 StartChartManage().destruction();
Get.back(); Get.back();
} }
StartChartManage().destruction();
} }
void onAppResumed() async { void onAppResumed() async {

View File

@ -56,6 +56,9 @@ class TalkViewLogic extends BaseGetXController {
final Map<String, ui.Image> _imageCache = {}; final Map<String, ui.Image> _imageCache = {};
//
int _lastFrameTimestamp = 0; // 0
// //
int _frameCount = 0; int _frameCount = 0;
int _lastFpsUpdateTime = 0; int _lastFpsUpdateTime = 0;
@ -100,11 +103,11 @@ class TalkViewLogic extends BaseGetXController {
// //
switch (contentType) { switch (contentType) {
case TalkData_ContentTypeE.G711: case TalkData_ContentTypeE.G711:
// // //
if (_isFirstAudioFrame) { // if (_isFirstAudioFrame) {
_startAudioTime = currentTime; // _startAudioTime = currentTime;
_isFirstAudioFrame = false; // _isFirstAudioFrame = false;
} // }
// //
final expectedTime = _startAudioTime + talkData.durationMs; final expectedTime = _startAudioTime + talkData.durationMs;
@ -130,15 +133,16 @@ class TalkViewLogic extends BaseGetXController {
if (_isFirstFrame) { if (_isFirstFrame) {
_startTime = currentTime; _startTime = currentTime;
_isFirstFrame = false; _isFirstFrame = false;
// AppLog.log('记录第一帧的时间戳${currentTime},${talkData.durationMs}'); AppLog.log('第一帧帧的时间戳:${talkData.durationMs}');
} }
// AppLog.log('其他帧的时间戳:${talkData.durationMs}');
//
if (_lastFrameTimestamp != 0) {
final int frameInterval = talkData.durationMs - _lastFrameTimestamp;
_adjustBufferSize(frameInterval); //
}
_lastFrameTimestamp = talkData.durationMs; //
// -
final expectedTime = _startTime + talkData.durationMs;
final videoDelay = currentTime - expectedTime; //
//
_adjustBufferSize(videoDelay);
// //
if (state.videoBuffer.length >= bufferSize) { if (state.videoBuffer.length >= bufferSize) {
state.videoBuffer.removeAt(0); state.videoBuffer.removeAt(0);
@ -257,19 +261,21 @@ class TalkViewLogic extends BaseGetXController {
} }
// //
void _adjustBufferSize(int delay) { void _adjustBufferSize(int frameInterval) {
const int delayThresholdHigh = 250; // 3 const int frameDuration = 83; // 83ms12fps
const int delayThresholdLow = 166; // 2 const int delayThresholdHigh = frameDuration * 2; // 2
const int delayThresholdLow = frameDuration; // 1
const int adjustInterval = 1; // 1 const int adjustInterval = 1; // 1
if (delay > delayThresholdHigh && bufferSize < maxBufferSize) { if (frameInterval > delayThresholdHigh && bufferSize < maxBufferSize) {
// //
bufferSize = min(bufferSize + adjustInterval, maxBufferSize); bufferSize = min(bufferSize + adjustInterval, maxBufferSize);
// AppLog.log('📈 增加缓冲区 - 当前大小: $bufferSize, 延迟: ${delay}ms'); AppLog.log('📈 增加缓冲区 - 当前大小: $bufferSize, 帧间间隔: ${frameInterval}ms');
} else if (delay < delayThresholdLow && bufferSize > minBufferSize) { } else if (frameInterval < delayThresholdLow &&
// bufferSize > minBufferSize) {
//
bufferSize = max(bufferSize - adjustInterval, minBufferSize); bufferSize = max(bufferSize - adjustInterval, minBufferSize);
// AppLog.log('📉 减少缓冲区 - 当前大小: $bufferSize, 延迟: ${delay}ms'); AppLog.log('📉 减少缓冲区 - 当前大小: $bufferSize, 帧间间隔: ${frameInterval}ms');
} }
} }

View File

@ -195,3 +195,12 @@ class RogerThatLockInfoDataEvent {
class GetGatewayListRefreshUI { class GetGatewayListRefreshUI {
GetGatewayListRefreshUI(); GetGatewayListRefreshUI();
} }
///
class AgreePrivacyAgreement {
AgreePrivacyAgreement();
}
///
class SuccessfulDistributionNetwork {
SuccessfulDistributionNetwork();
}