diff --git a/.DS_Store b/.DS_Store index 4b155f0a..46477568 100755 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/android/app/build.gradle b/android/app/build.gradle index d7c56a09..94b98531 100755 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -198,6 +198,18 @@ android { } buildTypes { + debug { + // 高德地图导致release编译模式下应用闪退,根据:[高德地图在Debug模式下运行正常但是打Release包时则闪退解决办法](https://blog.csdn.net/weixin_39370093/article/details/109631210) + // 为release模式设置混淆可以解决地图闪退问题 + // 真实的解决办法 + minifyEnabled false + shrinkResources false + productFlavors.local.signingConfig signingConfigs.debug + productFlavors.dev.signingConfig signingConfigs.debug + productFlavors.pre.signingConfig signingConfigs.debug + productFlavors.sky.signingConfig signingConfigs.sky + productFlavors.xhj.signingConfig signingConfigs.xhj + } release { // 高德地图导致release编译模式下应用闪退,根据:[高德地图在Debug模式下运行正常但是打Release包时则闪退解决办法](https://blog.csdn.net/weixin_39370093/article/details/109631210) // 为release模式设置混淆可以解决地图闪退问题 diff --git a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index 22609de7..b0728bf9 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -179,6 +179,7 @@ class LockDetailLogic extends BaseGetXController { Future loadData({ required LockListInfoItemEntity lockListInfoItemEntity,required bool isOnlyOneData}) async { state.keyInfos.value = lockListInfoItemEntity; CommonDataManage().currentLockUserNo = state.keyInfos.value.lockUserNo!; + CommonDataManage().initUserNo = state.keyInfos.value.initUserNo!; CommonDataManage().currentKeyInfo = state.keyInfos.value; state.lockUserNo = state.keyInfos.value.lockUserNo!; diff --git a/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/lib/main/lockDetail/lockDetail/lockDetail_page.dart index 79e27ef0..19502741 100755 --- a/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -60,6 +61,9 @@ class _LockDetailPageState extends State _initRefreshLockDetailInfoDataEventAction(); logic.initReplySubscription(); logic.initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction(); + logic.loadData( + lockListInfoItemEntity: widget.lockListInfoItemEntity, + isOnlyOneData: widget.isOnlyOneData); } @override @@ -68,6 +72,7 @@ class _LockDetailPageState extends State /// 路由订阅 AppRouteObserver().routeObserver.subscribe(this, ModalRoute.of(context)!); + state.isOpenLockNeedOnline.refresh(); } StreamSubscription? _lockRefreshLockDetailInfoDataEvent; @@ -81,69 +86,8 @@ class _LockDetailPageState extends State }); } - Future loadData() async { - state.keyInfos.value = widget.lockListInfoItemEntity; - CommonDataManage().currentLockUserNo = state.keyInfos.value.lockUserNo!; - CommonDataManage().initUserNo = state.keyInfos.value.initUserNo!; - CommonDataManage().currentKeyInfo = state.keyInfos.value; - - state.lockUserNo = state.keyInfos.value.lockUserNo!; - - if (state.keyInfos.value.keyStatus == - XSConstantMacro.keyStatusWaitIneffective || - state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusFrozen || - state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusExpired || - state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusDeleted || - state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusReset) { - state.openDoorBtnisUneable.value = false; - state.bottomBtnisEable.value = false; - } else { - state.openDoorBtnisUneable.value = true; - state.bottomBtnisEable.value = true; - } - - state.isOnlyOneData = widget.isOnlyOneData; - state.senderUserId = state.keyInfos.value.senderUserId!; - state.isAttendance.value = state.keyInfos.value.lockSetting!.attendance!; - state.isOpenLockNeedOnline.value = - state.keyInfos.value.lockSetting!.appUnlockOnline!; - state.electricQuantity.value = state.keyInfos.value.electricQuantity!; - state.isOpenPassageMode.value = state.keyInfos.value.passageMode!; - state.lockAlias.value = state.keyInfos.value.lockAlias!; - Storage.setString(saveLockAlias, state.lockAlias.value); - - BlueManage().connectDeviceName = - state.keyInfos.value.bluetooth!.bluetoothDeviceName!; - - final List publicKeyData = - state.keyInfos.value.bluetooth!.publicKey!.cast(); - final List saveStrList = changeIntListToStringList(publicKeyData); - Storage.setStringList(saveBluePublicKey, saveStrList); - - // 私钥 - final List privateKeyData = - state.keyInfos.value.bluetooth!.privateKey!.cast(); - final List savePrivateKeyList = - changeIntListToStringList(privateKeyData); - Storage.setStringList(saveBluePrivateKey, savePrivateKeyList); - - // signKey - final List signKeyData = - state.keyInfos.value.bluetooth!.signKey!.cast(); - final List saveSignKeyList = changeIntListToStringList(signKeyData); - Storage.setStringList(saveBlueSignKey, saveSignKeyList); - - final bool ifHaveKey = await Storage.ifHaveKey(saveBlueToken); - if (!ifHaveKey) { - final List saveTokenList = - changeIntListToStringList([0, 0, 0, 0]); - Storage.setStringList(saveBlueToken, saveTokenList); - } - } - @override Widget build(BuildContext context) { - loadData(); return F.sw(skyCall: skWidget, xhjCall: xhjWidget); } @@ -155,35 +99,50 @@ class _LockDetailPageState extends State final String lockAlias = state.keyInfos.value.lockAlias!; return Stack( children: [ - Column( - children: [ - SizedBox( - height: 15.h, - ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 24.w), - child: Text( - lockAlias, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 24.sp, color: Colors.black), + SingleChildScrollView( + child: Column( + children: [ + SizedBox( + height: 15.h, ), - ), - SizedBox( - height: 35.h, - ), - xhjInfoView(), - SizedBox( - height: 35.h, - ), - labelText('images/icon_slider_horizontal.png', '功能'.tr, () { - Get.to(LockDetailListPage( - title: '功能'.tr, items: getBottomWidget())); - }), - labelText('images/icon_puzzlepiece_extension.png', '配件'.tr, () { - Get.to(LockDetailListPage( - title: '配件'.tr, items: getAttachmentWidget())); - }), - ], + Padding( + padding: EdgeInsets.symmetric(horizontal: 24.w), + child: Text( + lockAlias, + textAlign: TextAlign.center, + style: TextStyle(fontSize: 24.sp, color: Colors.black), + ), + ), + SizedBox( + height: 35.h, + ), + xhjInfoView(), + SizedBox( + height: 35.h, + ), + labelText( + img: 'images/icon_slider_horizontal.png', + text: '功能'.tr, + child: bottomWidget()), + labelText( + img: 'images/icon_puzzlepiece_extension.png', + text: '配件'.tr, + child: attachmentWidget()), + btnText( + img: 'images/main/icon_main_set.png', + text: TranslationLoader.lanKeys!.set!.tr, + onTap: () { + if (state.openDoorBtnisUneable.value == false) { + return; + } + Get.toNamed(Routers.lockSetPage, + arguments: { + 'lockId': state.keyInfos.value.lockId, + 'isOnlyOneData': state.isOnlyOneData + }); + }), + ], + ), ), Visibility( visible: state.iSClosedUnlockSuccessfulPopup.value, @@ -199,7 +158,8 @@ class _LockDetailPageState extends State ); } - Widget labelText(String img, String text, var onTap) { + Widget btnText( + {required String img, required String text, required var onTap}) { return GestureDetector( onTap: onTap, child: Container( @@ -212,16 +172,19 @@ class _LockDetailPageState extends State BoxShadow( color: Colors.black.withOpacity(0.15), offset: const Offset(0, 0), - blurRadius: 10.r, + blurRadius: 5.r, spreadRadius: 0, ), ]), child: Row( children: [ - Image.asset( - img, - width: 32.r, - height: 32.r, + FlavorsImg( + black: true, + child: Image.asset( + img, + width: 32.r, + height: 32.r, + ), ), SizedBox( width: 15.w, @@ -241,6 +204,49 @@ class _LockDetailPageState extends State ); } + Widget labelText( + {required String img, required String text, required Widget child}) { + return Container( + margin: EdgeInsets.symmetric(horizontal: 0.05.sw, vertical: 15.h), + padding: EdgeInsets.symmetric(horizontal: 0.05.sw, vertical: 20.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16.r), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.15), + offset: const Offset(0, 0), + blurRadius: 5.r, + spreadRadius: 0, + ), + ]), + child: Column( + children: [ + Row( + children: [ + Image.asset( + img, + width: 32.r, + height: 32.r, + ), + SizedBox( + width: 15.w, + ), + Text( + text, + style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor), + ), + ], + ), + SizedBox( + height: 18.h, + ), + child, + ], + ), + ); + } + Widget xhjInfoView() { return Container( width: 0.9.sw, @@ -354,7 +360,7 @@ class _LockDetailPageState extends State BoxShadow( color: Colors.black.withOpacity(0.3), offset: const Offset(0, 0), - blurRadius: 10.r, + blurRadius: 15.r, spreadRadius: 0, ), ]), @@ -777,7 +783,7 @@ class _LockDetailPageState extends State child: Image.asset('images/main/icon_lockDetail_needNetwork.png', width: 24.w, height: 20.w, - color: state.keyInfos.value.appUnlockOnline == 1 + color: state.isOpenLockNeedOnline.value == 1 ? AppColors.mainColor : AppColors.btnDisableColor), ), @@ -786,7 +792,7 @@ class _LockDetailPageState extends State '手机需联网', style: TextStyle( fontSize: 20.sp, - color: state.keyInfos.value.appUnlockOnline == 1 + color: state.isOpenLockNeedOnline.value == 1 ? AppColors.mainColor : AppColors.btnDisableColor), ), @@ -896,6 +902,7 @@ class _LockDetailPageState extends State // childAspectRatio: 3, crossAxisSpacing: 20.w, mainAxisSpacing: 0.h, + shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), children: getAttachmentWidget()), ); @@ -940,7 +947,8 @@ class _LockDetailPageState extends State crossAxisCount: 4, // childAspectRatio: 3, crossAxisSpacing: 25.h, - mainAxisSpacing: 0.h, + mainAxisSpacing: 5.h, + shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), children: getBottomWidget()), ); @@ -982,13 +990,15 @@ class _LockDetailPageState extends State })); // 设置 - showWidgetArr.add(bottomItem('images/main/icon_main_set.png', - TranslationLoader.lanKeys!.set!.tr, true, () { - Get.toNamed(Routers.lockSetPage, arguments: { - 'lockId': state.keyInfos.value.lockId, - 'isOnlyOneData': state.isOnlyOneData - }); - })); + if (F.isSKY) { + showWidgetArr.add(bottomItem('images/main/icon_main_set.png', + TranslationLoader.lanKeys!.set!.tr, true, () { + Get.toNamed(Routers.lockSetPage, arguments: { + 'lockId': state.keyInfos.value.lockId, + 'isOnlyOneData': state.isOnlyOneData + }); + })); + } return showWidgetArr; } @@ -1166,17 +1176,19 @@ class _LockDetailPageState extends State }), ); - endWiddget.add( - // 设置 - bottomItem('images/main/icon_main_set.png', - TranslationLoader.lanKeys!.set!.tr, true, () { - // logic.clickItemBtnAction(10); - Get.toNamed(Routers.lockSetPage, arguments: { - 'lockId': state.keyInfos.value.lockId, - 'isOnlyOneData': state.isOnlyOneData, - }); - }), - ); + if (F.isSKY) { + endWiddget.add( + // 设置 + bottomItem('images/main/icon_main_set.png', + TranslationLoader.lanKeys!.set!.tr, true, () { + // logic.clickItemBtnAction(10); + Get.toNamed(Routers.lockSetPage, arguments: { + 'lockId': state.keyInfos.value.lockId, + 'isOnlyOneData': state.isOnlyOneData, + }); + }), + ); + } showWidgetArr.addAll(endWiddget); return showWidgetArr; } @@ -1218,13 +1230,13 @@ class _LockDetailPageState extends State xhjCall: () => Container( color: Colors.white, margin: EdgeInsets.symmetric(vertical: 5.h), - padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.w), - child: Row( + child: Column( crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( width: 42.w, - height: 42.h, + height: 42.w, child: FlavorsImg( black: true, child: Image.asset(iconUrl, @@ -1236,7 +1248,7 @@ class _LockDetailPageState extends State fit: BoxFit.fitWidth), ), ), - SizedBox(width: 20.w), + SizedBox(height: 20.h), Text( name, style: TextStyle( diff --git a/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart b/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart index ccb615d3..2d75668b 100755 --- a/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart +++ b/lib/main/lockDetail/lockSet/lockSet/lockSet_logic.dart @@ -569,15 +569,10 @@ class LockSetLogic extends BaseGetXController { ); if (entity.errorCode!.codeIsSuccessful) { BlueManage().connectDeviceMacAddress = ''; - final bool isXHJ = F.isXHJ; final bool isOnlyOneData = state.isOnlyOneData.value == true; await Future.delayed(const Duration(milliseconds: 200)) .then((e) { - if (isXHJ) { - Get.close(3); - } else { - Get.close(isOnlyOneData ? 1 : 2); - } + Get.close(isOnlyOneData ? 1 : 2); }); SchedulerBinding.instance.addPostFrameCallback((_) { eventBus.fire(RefreshLockListInfoDataEvent()); @@ -594,17 +589,10 @@ class LockSetLogic extends BaseGetXController { state.deleteAdministratorIsHaveAllData.value == true ? 1 : 0); if (entity.errorCode!.codeIsSuccessful) { BlueManage().connectDeviceMacAddress = ''; - - final bool isXHJ = F.isXHJ; final bool isOnlyOneData = state.isOnlyOneData.value == true; await Future.delayed(const Duration(milliseconds: 200)) .then((e) { - if (isXHJ) { - Get.close(3); - } else { - final int onlyOneDataInt = isOnlyOneData ? 1 : 2; - Get.close(onlyOneDataInt); - } + Get.close(isOnlyOneData ? 1 : 2); }); SchedulerBinding.instance.addPostFrameCallback((_) { eventBus.fire(RefreshLockListInfoDataEvent()); diff --git a/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart b/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart index a1c8f50a..751c0e9c 100755 --- a/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart +++ b/lib/mine/addLock/nearbyLock/nearbyLock_logic.dart @@ -285,6 +285,9 @@ class NearbyLockLogic extends BaseGetXController { index = index + 20; AppLog.log('mac地址 macAddressStr:$macAddressStr'); + //时区偏移 + state.lockInfo['timezoneOffset'] = DateTime.now().timeZoneOffset.inSeconds; + // 锁特征值字符串长度 final int featureValueLength = reply.data[index]; index = index + 1; diff --git a/lib/network/api.dart b/lib/network/api.dart index b9ff02c2..620cb749 100755 --- a/lib/network/api.dart +++ b/lib/network/api.dart @@ -23,7 +23,7 @@ abstract class Api { final String getLockNetTokenURL = '/lock/getLockNetToken'; //获取手机联网token final String updateLockUserNoURL = '/key/updateLockUserNo'; //更新锁用户NO - final String bindingBlueAdminURL = '/lock/bindAdmin'; //绑定蓝牙管理员 + final String bindingBlueAdminURL = '/v2/lock/bindAdmin'; //绑定蓝牙管理员 final String modifyKeyNameURL = '/key/modifyKeyName'; //修改锁名称 final String updateLockNameURL = '/lock/updateLockName'; //修改锁名(新) final String modifyKeyNameForAdminURL = diff --git a/lib/tools/push/message_constant.dart b/lib/tools/push/message_constant.dart index c2e183fb..c81dd455 100644 --- a/lib/tools/push/message_constant.dart +++ b/lib/tools/push/message_constant.dart @@ -7,4 +7,6 @@ class MessageConstant { static const int lockReceive = 30; //收到钥匙(返回指定钥匙分组+钥匙数据〉 static const int keyReceive = 40; + //锁设置变更 + static const int lockSetChange = 50; } diff --git a/lib/tools/push/message_management.dart b/lib/tools/push/message_management.dart index 9ef49c7d..df2f6c01 100644 --- a/lib/tools/push/message_management.dart +++ b/lib/tools/push/message_management.dart @@ -71,6 +71,18 @@ class MessageManagement { final int lockId = data['lockId']; eventBus.fire(RogerThatLockInfoDataEvent(keyId: keyId, lockId: lockId)); break; + case MessageConstant.lockSetChange: + final int keyId = data['keyId']; + final int lockId = data['lockId']; + final Map extra = data['updateFieldList']; + if (extra['appUnlockOnline'] != null) { + final String appUnlockOnline = extra['appUnlockOnline']; + eventBus.fire( + LockSetChangeSetRefreshLockDetailWithType(1, appUnlockOnline)); + eventBus.fire(RefreshLockInfoDataEvent(keyId: keyId, lockId: lockId)); + } + break; + default: throw Exception('无法识别eventNo 参数:$eventNo'); } diff --git a/pubspec.yaml b/pubspec.yaml index 5f636a34..1e12ca07 100755 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -72,8 +72,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # 1.0.61+2024061103:xhj 线上环境,对外发布,提交测试:处理华为拒审 # 1.0.62+2024061301:xhj 线上环境,对外发布,提交测试:处理华为拒审 # 1.0.63+2024061302:xhj 线上环境,提交测试:回归 bug +# 1.0.65+2024061801:xhj 线上环境,提交测试:回归 bug -version: 1.0.63+2024061302 +version: 1.0.65+2024061801 environment: sdk: '>=2.12.0 <3.0.0'