Merge branch 'master' of gitee.com:starlock-cn/app-starlock

This commit is contained in:
Daisy 2024-05-03 11:24:41 +08:00
commit 2fbe5fcf51
11 changed files with 175 additions and 118 deletions

View File

@ -316,7 +316,7 @@ SPEC CHECKSUMS:
flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907 flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907
flutter_pcm_sound: de0572ca4f99091cc2abfcc31601b8a4ddd33c0e flutter_pcm_sound: de0572ca4f99091cc2abfcc31601b8a4ddd33c0e
flutter_voice_processor: 2b89b93d69b02227ae3fd58589ee0bcfa3ca2a82 flutter_voice_processor: 2b89b93d69b02227ae3fd58589ee0bcfa3ca2a82
fluttertoast: 9f2f8e81bb5ce18facb9748d7855bf5a756fe3db fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
fluwx: daa284756ce53442b3d0417ceeda66e981906811 fluwx: daa284756ce53442b3d0417ceeda66e981906811
google_maps_flutter_ios: d1318b4ff711612cab16862d7a87e31a7403d458 google_maps_flutter_ios: d1318b4ff711612cab16862d7a87e31a7403d458
GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4 GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4

View File

@ -28,6 +28,8 @@ class F {
static String get name => appFlavor?.name ?? ''; static String get name => appFlavor?.name ?? '';
static bool get isXHJ => appFlavor == Flavor.xhj;
//便 //便
static dynamic sw( static dynamic sw(
{required fCallFunction defaultCall, fCallFunction? xhjCall}) { {required fCallFunction defaultCall, fCallFunction? xhjCall}) {

View File

@ -61,7 +61,8 @@ class _LockEscalationPageState extends State<LockEscalationPage> {
width: 10.w, width: 10.w,
), ),
Text( Text(
TranslationLoader.lanKeys!.haveNewVersion!.tr, // TranslationLoader.lanKeys!.haveNewVersion!.tr,
"未发现新版本",
style: TextStyle( style: TextStyle(
fontSize: 24.sp, fontWeight: FontWeight.w600), fontSize: 24.sp, fontWeight: FontWeight.w600),
) )
@ -75,80 +76,6 @@ class _LockEscalationPageState extends State<LockEscalationPage> {
style: TextStyle( style: TextStyle(
fontSize: 18.sp, color: AppColors.darkGrayTextColor), fontSize: 18.sp, color: AppColors.darkGrayTextColor),
), ),
SizedBox(
height: 10.h,
),
Obx(() {
return !logic.state.otaUpdateIng.value
? Stack(
children: [
Container(
margin: EdgeInsets.only(top: 8, bottom: 8),
width: Get.width,
child: Center(
child: Text(
// "${TranslationLoader.lanKeys!.newVersion!.tr}1.0.1",
"未发现新版本",
style: TextStyle(
color: AppColors.mainColor,
fontSize: 18.sp),
),
),
),
Positioned(
right: 80.w,
child: GestureDetector(
onTap: () {
logic.otaUpdate();
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'手动升级',
style: TextStyle(
color: AppColors.mainColor,
fontSize: 18.sp,
fontWeight: FontWeight.w400),
),
),
),
)
],
)
: Padding(
padding: EdgeInsets.symmetric(
horizontal: 50.w, vertical: 15.h),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'固件传输中',
style: TextStyle(
color: AppColors.mainColor,
fontSize: 18.sp,
fontWeight: FontWeight.w400),
),
SizedBox(
width: 10.w,
),
Expanded(
child: ClipRRect(
borderRadius: BorderRadius.all(
Radius.circular(10.r)),
child: LinearProgressIndicator(
value: logic
.state.otaProgress.value, // 50%
backgroundColor: Colors.grey[200],
valueColor:
AlwaysStoppedAnimation<Color>(
AppColors.mainColor),
),
),
),
],
),
);
}),
SizedBox( SizedBox(
height: 40.h, height: 40.h,
), ),
@ -159,6 +86,78 @@ class _LockEscalationPageState extends State<LockEscalationPage> {
onClick: () {}) onClick: () {})
: SizedBox(); : SizedBox();
}), }),
SizedBox(
height: 10.h,
),
Obx(() {
return !logic.state.otaUpdateIng.value
? Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
// Container(
// margin: EdgeInsets.only(top: 8, bottom: 8),
// width: Get.width,
// child: Center(
// child: Text(
// // "${TranslationLoader.lanKeys!.newVersion!.tr}1.0.1",
// "未发现新版本",
// style: TextStyle(
// color: AppColors.mainColor,
// fontSize: 18.sp),
// ),
// ),
// ),
GestureDetector(
onTap: () {
logic.otaUpdate();
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'手动升级',
style: TextStyle(
color: AppColors.mainColor,
fontSize: 18.sp,
fontWeight: FontWeight.w400),
),
),
)
],
)
: Padding(
padding: EdgeInsets.symmetric(
horizontal: 50.w, vertical: 15.h),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'固件传输中',
style: TextStyle(
color: AppColors.mainColor,
fontSize: 18.sp,
fontWeight: FontWeight.w400),
),
SizedBox(
width: 10.w,
),
Expanded(
child: ClipRRect(
borderRadius: BorderRadius.all(
Radius.circular(10.r)),
child: LinearProgressIndicator(
value: logic
.state.otaProgress.value, // 50%
backgroundColor: Colors.grey[200],
valueColor:
AlwaysStoppedAnimation<Color>(
AppColors.mainColor),
),
),
),
],
),
);
}),
], ],
), ),
)); ));

View File

@ -143,17 +143,17 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
// //
if (state.isPermanent.value == false) { if (state.isPermanent.value == false) {
getKeyType = '3'; getKeyType = '3';
getEffectiveDateTime = DateTool().dateToTimestamp(state.beginTime.value, 1).toString(); getEffectiveDateTime = DateTool().dateToTimestamp(state.customBeginTime.value, 1).toString();
getFailureDateTime = DateTool().dateToTimestamp(state.endTime.value, 1).toString(); getFailureDateTime = DateTool().dateToTimestamp(state.customEndTime.value, 1).toString();
} }
var entity = await ApiRepository.to.addPasswordKey( var entity = await ApiRepository.to.addPasswordKey(
lockId, lockId:lockId,
state.nameController.text, keyboardPwdName:state.nameController.text,
state.pwdController.text, keyboardPwd:state.pwdController.text,
getKeyType, keyboardPwdType:getKeyType,
getEffectiveDateTime, startDate:getEffectiveDateTime,
getFailureDateTime, endDate:getFailureDateTime,
'1'); addType:'1');
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
state.isSendSuccess.value = true; state.isSendSuccess.value = true;
state.sendSucceedType.value = state.widgetType.value; state.sendSucceedType.value = state.widgetType.value;
@ -234,8 +234,8 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
pwdNo: state.isAdministrator.value == true ? 254 : 0, pwdNo: state.isAdministrator.value == true ? 254 : 0,
pwd:state.pwdController.text, pwd:state.pwdController.text,
useCountLimit: 0xff, useCountLimit: 0xff,
startTime: DateTool().dateToTimestamp(state.beginTime.value, 1)~/1000, startTime: DateTool().dateToTimestamp(state.customBeginTime.value, 1)~/1000,
endTime: DateTool().dateToTimestamp(state.endTime.value, 1)~/1000, endTime: DateTool().dateToTimestamp(state.customEndTime.value, 1)~/1000,
needAuthor: 1, needAuthor: 1,
isBeforeAddUser: false, isBeforeAddUser: false,
signKey: signKeyDataList, signKey: signKeyDataList,
@ -265,8 +265,8 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
// //
Future<void> senderCustomPasswords() async { Future<void> senderCustomPasswords() async {
var startDate = DateTool().dateToTimestamp(state.beginTime.value, 1); var startDate = DateTool().dateToTimestamp(state.customBeginTime.value, 1);
var endDate = DateTool().dateToTimestamp(state.endTime.value, 1); var endDate = DateTool().dateToTimestamp(state.customEndTime.value, 1);
// //
if (state.isPermanent.value == false) { if (state.isPermanent.value == false) {
if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) { if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
@ -359,7 +359,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
case 3: case 3:
// //
if (state.isPermanent.value == false) { if (state.isPermanent.value == false) {
'类型:自定义-限时\n有效期:${state.beginTime.value} -- ${state.endTime.value}'; '类型:自定义-限时\n有效期:${state.customBeginTime.value} -- ${state.customEndTime.value}';
} else { } else {
useDateStr = '类型:自定义-永久'; useDateStr = '类型:自定义-永久';
} }

View File

@ -139,7 +139,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
children: [ children: [
keyIfPerpetualWidget(), keyIfPerpetualWidget(),
state.isPermanent.value == false state.isPermanent.value == false
? keyTimeLimitWidget() ? keyCustomTimeLimitWidget()
: Container(), : Container(),
perpetualKeyWidget( perpetualKeyWidget(
false, false,
@ -228,14 +228,9 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
context, context,
maxDate: PDuration(year: DateTime.now().year + 3, month: DateTime.now().month, day: DateTime.now().day, hour: 24), maxDate: PDuration(year: DateTime.now().year + 3, month: DateTime.now().month, day: DateTime.now().day, hour: 24),
// minDate: PDuration.now(), // minDate: PDuration.now(),
mode: state.widgetType.value == 3 ? DateMode.YMDHM:DateMode.YMDH, mode: DateMode.YMDHM,
onConfirm: (p) { onConfirm: (p) {
if (state.widgetType.value == 3) { state.beginTime.value = DateTool().getYMDHNDateString(p, 4);
//
state.beginTime.value = DateTool().getYMDHNDateString(p, 1);
} else {
state.beginTime.value = DateTool().getYMDHNDateString(p, 4);
}
}); });
}), }),
), ),
@ -251,12 +246,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
minDate: PDuration(year: DateTime.now().year, month: DateTime.now().month, day: DateTime.now().day), minDate: PDuration(year: DateTime.now().year, month: DateTime.now().month, day: DateTime.now().day),
mode: DateMode.YMDH, mode: DateMode.YMDH,
onConfirm: (p) { onConfirm: (p) {
if (state.widgetType.value == 3) { state.endTime.value = DateTool().getYMDHNDateString(p, 4);
//
state.endTime.value = DateTool().getYMDHNDateString(p, 1);
} else {
state.endTime.value = DateTool().getYMDHNDateString(p, 4);
}
}); });
}), }),
Container(height: 10.h), Container(height: 10.h),
@ -264,6 +254,44 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
); );
} }
//
Widget keyCustomTimeLimitWidget() {
return Column(
children: [
CommonItem(
leftTitel: TranslationLoader.lanKeys!.effectiveTime!.tr,
rightTitle: state.customBeginTime.value,
isHaveLine: true,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(
context,
// maxDate: PDuration(year: DateTime.now().year + 3, month: DateTime.now().month, day: DateTime.now().day, hour: 24),
// minDate: PDuration.now(),
mode: DateMode.YMDHM,
onConfirm: (p) {
state.customBeginTime.value = DateTool().getYMDHNDateString(p, 1);
});
}),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.failureTime!.tr,
rightTitle: state.customEndTime.value,
isHaveDirection: true,
action: () {
Pickers.showDatePicker(context,
// maxDate传入三年以后得今天的时间
// maxDate: PDuration(year: DateTime.now().year + 3, month: DateTime.now().month, day: DateTime.now().day),
// minDate: PDuration(year: DateTime.now().year, month: DateTime.now().month, day: DateTime.now().day),
mode: DateMode.YMDHM,
onConfirm: (p) {
state.customEndTime.value = DateTool().getYMDHNDateString(p, 1);
});
}),
Container(height: 10.h),
],
);
}
// //
Widget keyIfPerpetualWidget() { Widget keyIfPerpetualWidget() {
return Column( return Column(

View File

@ -25,6 +25,9 @@ class PasswordKeyPerpetualState {
var loopEndHours = DateTime.now().hour.obs; var loopEndHours = DateTime.now().hour.obs;
var loopModeStr = '周末'.obs; // var loopModeStr = '周末'.obs; //
var customBeginTime = DateTool().getNowDateWithType(2).obs; //
var customEndTime = DateTool().getNowDateWithType(2).obs;//
final widgetType = 0.obs; final widgetType = 0.obs;
final sendSucceedType = 0.obs; final sendSucceedType = 0.obs;
final keyInfo = LockListInfoItemEntity().obs; final keyInfo = LockListInfoItemEntity().obs;

View File

@ -15,6 +15,8 @@ class LockMainXHJLogic extends BaseGetXController {
update(); update();
} }
bool get isMall => state.index ==1;
// //
void openEquipment() { void openEquipment() {
showModalBottomSheet( showModalBottomSheet(

View File

@ -25,6 +25,7 @@ class StarLockMainXHJPage extends StatefulWidget {
class _StarLockMainXHJPageState extends State<StarLockMainXHJPage> class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
with BaseWidget { with BaseWidget {
@override @override
void initState() { void initState() {
super.initState(); super.initState();

View File

@ -1,8 +1,12 @@
import 'dart:convert'; import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:fluwx/fluwx.dart'; import 'package:fluwx/fluwx.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/flavors.dart';
import 'package:star_lock/main/lockMian/lockMain/xhj/lockMain_xhj_logic.dart';
import 'package:star_lock/mine/mall/lockMall_entity.dart'; import 'package:star_lock/mine/mall/lockMall_entity.dart';
import 'package:star_lock/mine/mall/lockMall_state.dart'; import 'package:star_lock/mine/mall/lockMall_state.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
@ -16,8 +20,10 @@ import '../../tools/baseGetXController.dart';
class LockMallLogic extends BaseGetXController { class LockMallLogic extends BaseGetXController {
late LockMallState state; late LockMallState state;
DateTime? _lastPressedAt; //
LockMallLogic({required bool allowReturn}) LockMallLogic({required bool allowReturn})
: state = LockMallState(allowReturn: allowReturn ); : state = LockMallState(allowReturn: allowReturn);
// //
Future<void> getMallURLRequest() async { Future<void> getMallURLRequest() async {
@ -98,19 +104,33 @@ class LockMallLogic extends BaseGetXController {
//webview 退退 //webview 退退
Future<bool> canGoBack(bool didPop) async { Future<bool> canGoBack(bool didPop) async {
bool canGoBack = await state.mallWebView.canGoBack(); bool canGoBack = await state.mallWebView.canGoBack();
if (canGoBack) { bool isMall = true;
if (Get.isRegistered<LockMainXHJLogic>() && F.isXHJ) {
isMall = Get.find<LockMainXHJLogic>().isMall;
}
if (canGoBack && isMall) {
await state.mallWebView.goBack(); await state.mallWebView.goBack();
} else if (state.allowReturn) { } else if (state.allowReturn && isMall) {
Get.back(); Get.back();
} else {
if (_lastPressedAt == null ||
DateTime.now().difference(_lastPressedAt!) > Duration(seconds: 2)) {
// 2 退
_lastPressedAt = DateTime.now();
showToast('再返回一次退出${F.title}');
return false; //
}
SystemNavigator.pop();
return true;
} }
refreshGoBack(); refreshGoBack();
return false; return false;
} }
// //
void refreshGoBack(){ void refreshGoBack() {
//退 //退
if(state.allowReturn){ if (state.allowReturn) {
return; return;
} }
state.mallWebView.canGoBack().then((value) { state.mallWebView.canGoBack().then((value) {

View File

@ -466,14 +466,15 @@ class ApiRepository {
// //
Future<PasswordKeyEntity> addPasswordKey( Future<PasswordKeyEntity> addPasswordKey(
String lockId, {
String keyboardPwdName, required String lockId,
String keyboardPwd, required String keyboardPwdName,
String keyboardPwdType, required String keyboardPwd,
String startDate, required String keyboardPwdType,
String endDate, required String startDate,
String addType, required String endDate,
) async { required String addType,
}) async {
final res = await apiProvider.addKeyboardPwd(lockId, keyboardPwdName, final res = await apiProvider.addKeyboardPwd(lockId, keyboardPwdName,
keyboardPwd, keyboardPwdType, startDate, endDate, addType); keyboardPwd, keyboardPwdType, startDate, endDate, addType);
return PasswordKeyEntity.fromJson(res.body); return PasswordKeyEntity.fromJson(res.body);

View File

@ -38,8 +38,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# 1.0.28+2024042601 打包鑫锁提审华为 # 1.0.28+2024042601 打包鑫锁提审华为
# 1.0.29+2024042901 打包给欧阳测试 # 1.0.29+2024042901 打包给欧阳测试
# 1.0.30+2024043001 打包鑫锁提审ios # 1.0.30+2024043001 打包鑫锁提审ios
# 1.0.31+2024050301 打包鑫锁提审华为
version: 1.0.30+2024043001 version: 1.0.31+2024050301
environment: environment:
sdk: '>=2.12.0 <3.0.0' sdk: '>=2.12.0 <3.0.0'