Merge remote-tracking branch 'origin/master'

This commit is contained in:
葛佳祥 2024-04-09 11:56:51 +08:00
commit 96f7dd0338
13 changed files with 191 additions and 156 deletions

View File

@ -12,8 +12,7 @@ class SendEmailNotificationPage extends StatefulWidget {
const SendEmailNotificationPage({Key? key}) : super(key: key);
@override
State<SendEmailNotificationPage> createState() =>
_SendEmailNotificationPageState();
State<SendEmailNotificationPage> createState() => _SendEmailNotificationPageState();
}
class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
@ -21,87 +20,80 @@ class _SendEmailNotificationPageState extends State<SendEmailNotificationPage> {
@override
Widget build(BuildContext context) {
_emailController.text =
"亲爱的用户 \n\n你收到电子钥匙请试用APP(www.baidu.com)或小程序开锁 \n\n星锁";
_emailController.text = "亲爱的用户 \n\n你收到电子钥匙请试用APP(www.baidu.com)或小程序开锁 \n\n星锁";
return Scaffold(
backgroundColor: AppColors.mainBackgroundColor,
appBar: TitleAppBar(
barTitle: "邮件通知",
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
children: [
CommonItem(
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
rightTitle: "786612630@qq.com",
isHaveLine: true,
),
CommonItem(
leftTitel: "类型",
rightTitle: "个人邮件",
isHaveDirection: true,
),
Container(height: 10.h),
CommonItem(
leftTitel: "模板",
rightTitle: "默认模板",
appBar: TitleAppBar(barTitle: "邮件通知", haveBack: true, backgroundColor: AppColors.mainColor),
body: SingleChildScrollView(
child: Column(
children: [
CommonItem(
leftTitel: TranslationLoader.lanKeys!.receiver!.tr,
rightTitle: "786612630@qq.com",
isHaveLine: true,
),
CommonItem(
leftTitel: "类型",
rightTitle: "个人邮件",
isHaveDirection: true,
isHaveLine: true),
Container(
height: 360.h,
color: Colors.white,
padding: EdgeInsets.only(
left: 20.w, right: 20.w, top: 20.h, bottom: 20.h),
child: TextField(
maxLines: 8,
maxLength: 1000,
textAlign: TextAlign.start,
controller: _emailController,
style: TextStyle(
color: Colors.black,
fontSize: 22.sp,
),
decoration: InputDecoration(
border: OutlineInputBorder(
///
borderRadius: BorderRadius.all(Radius.circular(20.h)),
///
borderSide: const BorderSide(
///
color: Color(0xffB2B2B2),
///
width: 0.5,
),
),
Container(height: 10.h),
CommonItem(leftTitel: "模板", rightTitle: "默认模板", isHaveDirection: true, isHaveLine: true),
Container(
height: 360.h,
color: Colors.white,
padding: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.h, bottom: 20.h),
child: TextField(
maxLines: 8,
maxLength: 1000,
textAlign: TextAlign.start,
controller: _emailController,
style: TextStyle(
color: Colors.black,
fontSize: 22.sp,
),
decoration: InputDecoration(
border: OutlineInputBorder(
///
borderRadius: BorderRadius.all(Radius.circular(20.h)),
///
focusedBorder: OutlineInputBorder(
///
borderRadius: BorderRadius.all(Radius.circular(20.h)),
///
borderSide: const BorderSide(
///
color: Color(0xffB2B2B2),
///
borderSide: const BorderSide(
///
color: Color(0xffB2B2B2),
///
width: 0.5,
),
),
///
width: 1,
///
focusedBorder: OutlineInputBorder(
///
borderRadius: BorderRadius.all(Radius.circular(20.h)),
///
borderSide: const BorderSide(
///
color: Color(0xffB2B2B2),
///
width: 1,
),
),
),
),
),
),
Container(height: 40.h),
SubmitBtn(
btnName: '发送',
fontSize: 28.sp,
borderRadius: 20.w,
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {}),
],
Container(height: 40.h),
SubmitBtn(
btnName: '发送',
fontSize: 28.sp,
borderRadius: 20.w,
margin: EdgeInsets.only(left: 30.w, right: 30.w, top: 30.w),
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
onClick: () {}),
],
),
),
);
}

View File

@ -71,7 +71,8 @@ class _LockDetailPageState extends State<LockDetailPage>
StreamSubscription? _lockRefreshLockDetailInfoDataEvent;
void _initRefreshLockDetailInfoDataEventAction() {
// eventBus
_lockRefreshLockDetailInfoDataEvent = eventBus.on<RefreshLockDetailInfoDataEvent>().listen((event) {
_lockRefreshLockDetailInfoDataEvent =
eventBus.on<RefreshLockDetailInfoDataEvent>().listen((event) {
setState(() {});
});
}
@ -110,12 +111,14 @@ class _LockDetailPageState extends State<LockDetailPage>
BlueManage().connectDeviceName =
state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
List<int> publicKeyData = state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
List<int> publicKeyData =
state.keyInfos.value.bluetooth!.publicKey!.cast<int>();
var saveStrList = changeIntListToStringList(publicKeyData);
Storage.setStringList(saveBluePublicKey, saveStrList);
//
List<int> privateKeyData = state.keyInfos.value.bluetooth!.privateKey!.cast<int>();
List<int> privateKeyData =
state.keyInfos.value.bluetooth!.privateKey!.cast<int>();
var savePrivateKeyList = changeIntListToStringList(privateKeyData);
Storage.setStringList(saveBluePrivateKey, savePrivateKeyList);
@ -138,9 +141,19 @@ class _LockDetailPageState extends State<LockDetailPage>
children: [
Visibility(
visible:
((state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime || state.keyInfos.value.keyType == XSConstantMacro.keyTypeLoop) && //
(DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) <= 15 && DateTool().compareTimeGetDaysFromNow(state.keyInfos.value.endDate!) >= 0) && // 030
(state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusNormalUse || state.keyInfos.value.keyStatus == XSConstantMacro.keyStatusWaitReceive) // 使
((state.keyInfos.value.keyType == XSConstantMacro.keyTypeTime ||
state.keyInfos.value.keyType ==
XSConstantMacro.keyTypeLoop) && //
(DateTool().compareTimeGetDaysFromNow(
state.keyInfos.value.endDate!) <=
15 &&
DateTool().compareTimeGetDaysFromNow(
state.keyInfos.value.endDate!) >=
0) && // 030
(state.keyInfos.value.keyStatus ==
XSConstantMacro.keyStatusNormalUse ||
state.keyInfos.value.keyStatus ==
XSConstantMacro.keyStatusWaitReceive) // 使
)
? true
: false,
@ -234,9 +247,8 @@ class _LockDetailPageState extends State<LockDetailPage>
GestureDetector(
onTap: () {
// logic.getStarLockStatus();
ShowTipView().showSureAlertDialog("${"锁更新时间:".tr}${DateTool().dateToYMDHNString(state
.keyInfos.value.electricQuantityDate!
.toString())}");
ShowTipView().showSureAlertDialog(
"${"锁更新时间:".tr}${DateTool().dateToYMDHNString(state.keyInfos.value.electricQuantityDate!.toString())}");
},
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
@ -263,11 +275,16 @@ class _LockDetailPageState extends State<LockDetailPage>
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Image.asset(showElectricIcon(state.electricQuantity.value), width: 30.w, height: 24.w),
Image.asset(showElectricIcon(state.electricQuantity.value),
width: 30.w, height: 24.w),
SizedBox(width: 2.w),
Text("--%", style: TextStyle(fontSize: 18.sp, color: AppColors.darkGrayTextColor)),
Text("--%",
style: TextStyle(
fontSize: 18.sp,
color: AppColors.darkGrayTextColor)),
SizedBox(width: 2.w),
Icon(Icons.info, // 使 warning
Icon(
Icons.info, // 使 warning
color: AppColors.mainColor, //
size: 25.w, // 30
),
@ -561,11 +578,8 @@ class _LockDetailPageState extends State<LockDetailPage>
}));
//
showWidgetArr.add(bottomItem(
'images/main/icon_main_set.png',
TranslationLoader.lanKeys!.set!.tr,
true,
true, () {
showWidgetArr.add(bottomItem('images/main/icon_main_set.png',
TranslationLoader.lanKeys!.set!.tr, true, true, () {
Get.toNamed(Routers.lockSetPage, arguments: {
"lockId": state.keyInfos.value.lockId,
"isOnlyOneData": state.isOnlyOneData
@ -729,17 +743,16 @@ class _LockDetailPageState extends State<LockDetailPage>
TranslationLoader.lanKeys!.messageReminding!.tr,
state.openDoorBtnisUneable.value,
state.bottomBtnisEable.value, () {
Get.toNamed(Routers.msgNotificationPage);
Get.toNamed(Routers.msgNotificationPage, arguments: {
"lockId": state.keyInfos.value.lockId,
});
}),
);
endWiddget.add(
//
bottomItem(
'images/main/icon_main_set.png',
TranslationLoader.lanKeys!.set!.tr,
true,
true, () {
bottomItem('images/main/icon_main_set.png',
TranslationLoader.lanKeys!.set!.tr, true, true, () {
// logic.clickItemBtnAction(10);
Get.toNamed(Routers.lockSetPage, arguments: {
"lockId": state.keyInfos.value.lockId,
@ -752,7 +765,8 @@ class _LockDetailPageState extends State<LockDetailPage>
}
//
Widget bottomItem(String iconUrl, String name, bool openDoorBtnisUneable, bool bottomBtnisEable, Function() onClick) {
Widget bottomItem(String iconUrl, String name, bool openDoorBtnisUneable,
bool bottomBtnisEable, Function() onClick) {
var width = 42.w;
var height = 42.h;
return GestureDetector(

View File

@ -371,7 +371,9 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.msgNotificationPage);
Get.toNamed(Routers.msgNotificationPage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value
});
})),
//
Visibility(

View File

@ -67,11 +67,13 @@ class _MsgNotificationPageState extends State<MsgNotificationPage> {
// ),
CommonItem(
leftTitel: '开门通知',
rightTitle: "已启用",
rightTitle: "",
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.openDoorNotifyPage);
Get.toNamed(Routers.openDoorNotifyPage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value,
});
},
),
CommonItem(

View File

@ -1,9 +1,18 @@
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
class MsgNotificationState {
var lockSetInfoData = LockSetInfoData().obs;
var isCheck = false.obs;
var isLeaveHomeOpenDoor = false.obs; //
var isDoorNotShut = false.obs; //
var isSomeoneRing = false.obs; //
var isSomeoneAppeared = false.obs; //
MsgNotificationState() {
Map map = Get.arguments;
if (map['lockSetInfoData'] != null) {
lockSetInfoData.value = map['lockSetInfoData'];
}
}
}

View File

@ -1,7 +1,16 @@
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/versionUndate/versionUndate_entity.dart';
import 'openDoorNotify_state.dart';
class OpenDoorNotifyLogic extends BaseGetXController {
final OpenDoorNotifyState state = OpenDoorNotifyState();
//
void getLockNoticeSetting() async {
VersionUndateEntity entity = await ApiRepository.to.getLockNoticeSetting(
lockId: state.lockSetInfoData.value.lockId!,
);
if (entity.errorCode!.codeIsSuccessful) {}
}
}

View File

@ -22,6 +22,8 @@ class _OpenDoorNotifyPageState extends State<OpenDoorNotifyPage> {
@override
void initState() {
super.initState();
logic.getLockNoticeSetting();
}
@override

View File

@ -1,7 +1,16 @@
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
class OpenDoorNotifyState {
var lockSetInfoData = LockSetInfoData().obs;
var pageNum = 1.obs; //
final pageSize = 20.obs; //
final itemDataList = [].obs;
OpenDoorNotifyState() {
Map map = Get.arguments;
if (map['lockSetInfoData'] != null) {
lockSetInfoData.value = map['lockSetInfoData'];
}
}
}

View File

@ -7,6 +7,7 @@ import 'package:get/get.dart';
import 'package:image_picker/image_picker.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/app_settings/app_settings.dart';
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_logic.dart';
import 'package:star_lock/tools/appFirstEnterHandle.dart';
import 'package:star_lock/tools/custom_bottom_sheet.dart';
@ -23,8 +24,7 @@ class MinePersonInfoPage extends StatefulWidget {
State<MinePersonInfoPage> createState() => _MinePersonInfoPageState();
}
class _MinePersonInfoPageState extends State<MinePersonInfoPage>
with WidgetsBindingObserver {
class _MinePersonInfoPageState extends State<MinePersonInfoPage> with WidgetsBindingObserver {
final logic = Get.put(MinePersonInfoLogic());
final state = Get.find<MinePersonInfoLogic>().state;
@ -88,8 +88,7 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
action: () async {
//
if (Platform.isAndroid) {
AppFirstEnterHandle()
.getAppFirstEnter(context, isAgreeCamera);
AppFirstEnterHandle().getAppFirstEnter(context, isAgreeCamera);
var getFlag = await Storage.getString(isAgreeCamera);
if (getFlag == isAgreeCamera) {
_openModalBottomSheet();
@ -101,16 +100,13 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.nickName!.tr,
rightTitle: state.mineInfoData.value.nickname != null
? state.mineInfoData.value.nickname!
: "",
rightTitle: state.mineInfoData.value.nickname != null ? state.mineInfoData.value.nickname! : "",
isHaveLine: true,
isHaveDirection: true,
action: () {
Navigator.pushNamed(
context, Routers.minePersonInfoEditNamePage, arguments: {
'nickName': state.mineInfoData.value.nickname
}).then((value) => logic.getUserInfoRequest());
Navigator.pushNamed(context, Routers.minePersonInfoEditNamePage,
arguments: {'nickName': state.mineInfoData.value.nickname})
.then((value) => logic.getUserInfoRequest());
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.mobileNumber!.tr,
@ -122,16 +118,13 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
action: () {
// isFrom1 2
if (state.mineInfoData.value.mobile!.isNotEmpty) {
Navigator.pushNamed(context, Routers.mineUnbindPhoneOrEmailPage, arguments: {
'mobile': state.mineInfoData.value.mobile!,
'isFrom': '1'
}).then((value) => logic.getUserInfoRequest());
Navigator.pushNamed(context, Routers.mineUnbindPhoneOrEmailPage,
arguments: {'mobile': state.mineInfoData.value.mobile!, 'isFrom': '1'})
.then((value) => logic.getUserInfoRequest());
} else {
Navigator.pushNamed(
context, Routers.mineBindPhoneOrEmailPage, arguments: {
'mobile': state.mineInfoData.value.mobile!,
'isFrom': '1'
}).then((value) => logic.getUserInfoRequest());
Navigator.pushNamed(context, Routers.mineBindPhoneOrEmailPage,
arguments: {'mobile': state.mineInfoData.value.mobile!, 'isFrom': '1'})
.then((value) => logic.getUserInfoRequest());
}
})),
Obx(() => CommonItem(
@ -144,18 +137,13 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
action: () {
// isFrom1 2
if (state.mineInfoData.value.email!.isNotEmpty) {
Navigator.pushNamed(
context, Routers.mineUnbindPhoneOrEmailPage,
arguments: {
'isFrom': '2',
'email': state.mineInfoData.value.email!
}).then((value) => logic.getUserInfoRequest());
Navigator.pushNamed(context, Routers.mineUnbindPhoneOrEmailPage,
arguments: {'isFrom': '2', 'email': state.mineInfoData.value.email!})
.then((value) => logic.getUserInfoRequest());
} else {
Navigator.pushNamed(
context, Routers.mineBindPhoneOrEmailPage, arguments: {
'isFrom': '2',
'email': state.mineInfoData.value.email!
}).then((value) => logic.getUserInfoRequest());
Navigator.pushNamed(context, Routers.mineBindPhoneOrEmailPage,
arguments: {'isFrom': '2', 'email': state.mineInfoData.value.email!})
.then((value) => logic.getUserInfoRequest());
}
})),
CommonItem(
@ -164,30 +152,24 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
isHaveLine: true,
isHaveDirection: true,
action: () {
Navigator.pushNamed(
context, Routers.minePersonInfoResetPasswordPage);
Navigator.pushNamed(context, Routers.minePersonInfoResetPasswordPage);
}),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.safetyProblem!.tr,
rightTitle:
state.mineInfoData.value.haveSafeAnswer == 0 ? "去设置" : "",
rightTitle: state.mineInfoData.value.haveSafeAnswer == 0 ? "去设置" : "",
isHaveLine: true,
isHaveDirection: true,
action: () {
if (state.mineInfoData.value.haveSafeAnswer == 0) {
Navigator.pushNamed(
context, Routers.minePersonInfoSetSafetyProblemPage)
Navigator.pushNamed(context, Routers.minePersonInfoSetSafetyProblemPage)
.then((value) => logic.getUserInfoRequest());
} else {
Navigator.pushNamed(
context, Routers.minePersonInfoViewSafetyProblemPage);
Navigator.pushNamed(context, Routers.minePersonInfoViewSafetyProblemPage);
}
})),
Obx(() => CommonItem(
leftTitel: TranslationLoader.lanKeys!.countryAndRegion!.tr,
rightTitle: state.mineInfoData.value.countryName != null
? state.mineInfoData.value.countryName!
: "",
rightTitle: state.mineInfoData.value.countryName != null ? state.mineInfoData.value.countryName! : "",
isHaveLine: false,
isHaveDirection: false)),
],
@ -221,7 +203,9 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
}
Future<void> _requestPhotoPermission() async {
var status = await Permission.photos.request();
//andriud33以下的设备兼容
bool isAndroid33 = AppPlatform.isAndroid && AppPlatform.getSdkIntValue() >= 33;
var status = isAndroid33 ? await Permission.photos.request() : await Permission.storage.request();
if (status.isGranted) {
setState(() {
state.hasPhotoPermission.value = true; //
@ -271,8 +255,7 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
Future _openModalBottomSheet() async {
showModalBottomSheet(
context: context,
shape: RoundedRectangleBorder(
borderRadius: BorderRadiusDirectional.circular(10)),
shape: RoundedRectangleBorder(borderRadius: BorderRadiusDirectional.circular(10)),
builder: (BuildContext context) {
return AlertBottomWidget(
topTitle: '',
@ -281,13 +264,9 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
int getSelectIndex = value;
if (getSelectIndex == 0) {
//
state.hasCameraPermission.value == true
? selectCamera()
: _requestCameraPermission();
state.hasCameraPermission.value == true ? selectCamera() : _requestCameraPermission();
} else if (getSelectIndex == 1) {
state.hasPhotoPermission.value == true
? selectImage()
: _requestPhotoPermission();
state.hasPhotoPermission.value == true ? selectImage() : _requestPhotoPermission();
}
},
);
@ -296,8 +275,8 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
///
selectCamera() async {
XFile? photo = await state.imagePicker.pickImage(
source: ImageSource.camera, preferredCameraDevice: CameraDevice.rear);
XFile? photo =
await state.imagePicker.pickImage(source: ImageSource.camera, preferredCameraDevice: CameraDevice.rear);
if (photo != null) {
state.image = photo;
// logic.getUpTokenRequest();

View File

@ -190,4 +190,7 @@ abstract class Api {
'/lockSetting/updateCatEyeConfig'; //
final String updateFaceConfigURL = '/lockSetting/updateFaceConfig'; //
final String getLockNoticeSettingURL =
'/lockSetting/getLockNoticeSetting'; //
}

View File

@ -1747,6 +1747,13 @@ class ApiProvider extends BaseProvider {
'lockId': lockId,
'faceAutoLightScreen': faceAutoLightScreen,
}));
//
Future<Response> getLockNoticeSetting(int lockId) => post(
getLockNoticeSettingURL.toUrl,
jsonEncode({
'lockId': lockId,
}));
}
extension ExtensionString on String {

View File

@ -1779,4 +1779,11 @@ class ApiRepository {
lockId, faceAutoLightScreen);
return VersionUndateEntity.fromJson(res.body);
}
//
Future<VersionUndateEntity> getLockNoticeSetting(
{required int lockId}) async {
final res = await apiProvider.getLockNoticeSetting(lockId);
return VersionUndateEntity.fromJson(res.body);
}
}

View File

@ -60,7 +60,7 @@ class CallTalk {
}
//
else {
print('********视频数据来了');
// print('********视频数据来了');
//
var bagLen = bb[POS_blen + 2] + bb[POS_blen + 3] * 256;
// print('音视频数据开始下标 bagLen$bagLen');
@ -101,8 +101,8 @@ class CallTalk {
var getList = bb.sublist(POS_data, bb.length);
iframe!.bb!.addAll(getList);
}
print(
'iframe.bagNum: ${iframe!.bagNum} iframe.bagReceive: ${iframe!.bagReceive}');
// print(
// 'iframe.bagNum: ${iframe!.bagNum} iframe.bagReceive: ${iframe!.bagReceive}');
//
if (iframe!.bagNum == iframe!.bagReceive) {