This commit is contained in:
魏少阳 2024-04-09 15:21:16 +08:00
commit 5a2705aac2
47 changed files with 709 additions and 338 deletions

View File

@ -0,0 +1,2 @@
FLUTTER_STORAGE_BASE_URL="https://mirrors.tuna.tsinghua.edu.cn/flutter"
PUB_HOSTED_URL="https://mirrors.tuna.tsinghua.edu.cn/dart-pub"

1
star_lock/.docker/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.env

View File

@ -0,0 +1,28 @@
# docker持续部署
构建镜像来自https://github.com/MobileDevOps/flutter-sdk-image/
## 使用方法
1. 复制.env文件并编辑其中的代理设置
```bash
cp .docker/.env.example .docker/.env
```
2. 构建命令
```bash
cd <path-to-this-repo>
# 构建sky版本APK
docker run --env-file .docker/.env --rm -it -v .:/home/mobiledevops/app mobiledevops/flutter-sdk-image:3.16.4 \
flutter build apk --release --flavor sky -t lib/main_sky_full.dart
```
3. 构建完成后APK文件在build/app/outputs/flutter-apk目录下
## 排除故障
测试谷歌连接
```bash
# flutter以及maven 下载地址是否正常
curl -i https://storage.googleapis.com/flutter_infra_release/
```

2
star_lock/.run/README.md Normal file
View File

@ -0,0 +1,2 @@
# IDE启动文件
使用方法:将.run 文件夹下的文件复制到 .idea/runConfigurations文件夹重新打开项目即可

View File

@ -0,0 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="main_local.dart" type="FlutterRunConfigurationType" factoryName="Flutter">
<option name="buildFlavor" value="local"/>
<option name="filePath" value="$PROJECT_DIR$/lib/main_local.dart"/>
<method v="2"/>
</configuration>
</component>

View File

@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="main_sky.dart" type="FlutterRunConfigurationType" factoryName="Flutter">
<configuration default="false" name="main_sky_full.dart" type="FlutterRunConfigurationType" factoryName="Flutter">
<option name="buildFlavor" value="sky"/>
<option name="filePath" value="$PROJECT_DIR$/lib/main_sky.dart"/>
<option name="filePath" value="$PROJECT_DIR$/lib/main_sky_full.dart"/>
<method v="2"/>
</configuration>
</component>
</component>

View File

@ -66,7 +66,7 @@ keytool -list -v -keystore android/app/sky.jks
## 编译
```bash
flutter build apk --split-per-abi --release --flavor sky -t lib/main_sky.dart
flutter build apk --release --flavor sky -t lib/main_sky_full.dart
```
编译后的包:
通用build/app/outputs/apk/sky/release/app-sky-universal-release.apk

View File

@ -36,8 +36,8 @@ android {
keyAlias = 'starlock'
keyPassword '123456'
}
// xiepreskyxhj
xie {
// localpreskyxhj
local {
storeFile file("starlock.keystore")
storePassword '123456'
keyAlias = 'starlock'
@ -68,12 +68,12 @@ android {
flavorDimensions "flavor-type"
productFlavors {
xie {
local {
dimension "flavor-type"
applicationId "com.starlock.lock.xie"
applicationId "com.starlock.lock.local"
signingConfig signingConfigs.pre
resValue "string", "app_name", "星锁-xie"
manifestPlaceholders.JPUSH_PKGNAME = "com.starlock.lock.xie"
resValue "string", "app_name", "星锁-local"
manifestPlaceholders.JPUSH_PKGNAME = "com.starlock.lock.local"
}
dev {
dimension "flavor-type"
@ -182,7 +182,7 @@ android {
//
minifyEnabled false
shrinkResources false
productFlavors.xie.signingConfig signingConfigs.pre
productFlavors.local.signingConfig signingConfigs.pre
productFlavors.dev.signingConfig signingConfigs.pre
productFlavors.pre.signingConfig signingConfigs.pre
productFlavors.sky.signingConfig signingConfigs.sky

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -53,16 +53,16 @@ app:
flavorDimensions: "flavor-type"
flavors:
xie:
local:
app:
name: "星锁-xie"
name: "星锁-local"
icon: "assets/icon/dev.png"
android:
applicationId: "com.starlock.lock.xie"
applicationId: "com.starlock.lock.local"
customConfig:
signingConfig: signingConfigs.pre
ios:
bundleId: "com.starlock.lock.xie"
bundleId: "com.starlock.lock.local"
dev:
app:
name: "星锁-dev"

View File

@ -4,6 +4,8 @@
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.associated-domains</key>
<array/>
<key>com.apple.external-accessory.wireless-configuration</key>
<true/>
</dict>

View File

@ -1,7 +1,7 @@
import 'package:get/get.dart';
enum Flavor {
xie,
local,
dev,
pre,
sky,
@ -11,13 +11,16 @@ enum Flavor {
class StarLockAMapKey {
//iOS平台的key
final String iosKey;
//Android平台的key
final String androidKey;
const StarLockAMapKey({required this.iosKey, required this.androidKey});
}
class F {
static Flavor? appFlavor;
// ()
static bool isLite = false;
@ -25,8 +28,8 @@ class F {
static String get title {
switch (appFlavor) {
case Flavor.xie:
return '星锁-xie';
case Flavor.local:
return '星锁-local';
case Flavor.dev:
return '星锁-dev';
case Flavor.pre:
@ -42,8 +45,8 @@ class F {
static String get navTitle {
switch (appFlavor) {
case Flavor.xie:
return '${"starLock".tr}-xie';
case Flavor.local:
return '${"starLock".tr}-local';
case Flavor.dev:
return '${"starLock".tr}-dev';
case Flavor.pre:
@ -59,10 +62,8 @@ class F {
static String get apiPrefix {
switch (appFlavor) {
// case Flavor.ge:
// return 'https://ge.lock.star-lock.cn';
case Flavor.xie:
return 'http://192.168.1.15:8022';
case Flavor.local:
return 'https://ge.lock.star-lock.cn';
case Flavor.dev:
return 'https://dev.lock.star-lock.cn';
case Flavor.pre:
@ -77,22 +78,20 @@ class F {
throw Exception('flavor[$name] apiPrefix not found');
}
}
// StarLockAMapKey
static StarLockAMapKey get aMapKey {
switch (appFlavor) {
case Flavor.xie:
case Flavor.local:
case Flavor.dev:
return const StarLockAMapKey(
androidKey: 'b56b681ee89f4db43a5aa1879ae8cbfe',
iosKey: 'bd4496e6598ef49796e3a80715035b4d');
androidKey: 'b56b681ee89f4db43a5aa1879ae8cbfe', iosKey: 'bd4496e6598ef49796e3a80715035b4d');
case Flavor.pre:
return const StarLockAMapKey(
androidKey: '11d49b3f4fc09c04a02bbb7500925ba2',
iosKey: '883a3355d2d77c2fdc2667030dc97ffe');
androidKey: '11d49b3f4fc09c04a02bbb7500925ba2', iosKey: '883a3355d2d77c2fdc2667030dc97ffe');
case Flavor.sky:
return const StarLockAMapKey(
androidKey: 'fb0d2a3e4208b36452cf636aa025a24f',
iosKey: '86ca725a12a629c280e116a317aaba19');
androidKey: 'fb0d2a3e4208b36452cf636aa025a24f', iosKey: '86ca725a12a629c280e116a317aaba19');
// case Flavor.xhj:
// return const StarLockAMapKey(
// androidKey: 'todo',
@ -101,5 +100,4 @@ class F {
throw Exception('flavor[$name] aMapKey not found');
}
}
}

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

@ -39,26 +39,30 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
backgroundColor: AppColors.mainColor),
body: Obx(() => Column(
children: [
CommonItem(
leftTitel: TranslationLoader.lanKeys!.videoSlot!.tr,
rightTitle: "",
isHaveLine: false,
isHaveDirection: true,
isHaveRightWidget: true,
rightWidget: Text(state.selectVideoSlot.value,
style: TextStyle(
fontSize: 22.sp, color: AppColors.darkGrayTextColor)),
action: () {
Navigator.pushNamed(context, Routers.videoSlotPage,
arguments: {
'lockSetInfoData': state.lockSetInfoData.value,
'catEyeConfigData': state.lockSetInfoData.value
.lockSettingInfo!.catEyeConfig!.isNotEmpty
? state.lockSetInfoData.value.lockSettingInfo!
.catEyeConfig![0]
: null
}).then((value) => {logic.getLockSettingInfoData()});
},
Container(
margin: EdgeInsets.only(left: 20.w),
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.videoSlot!.tr,
rightTitle: '',
isHaveLine: false,
isHaveDirection: true,
isHaveRightWidget: true,
rightWidget: Text(state.selectVideoSlot.value,
style: TextStyle(
fontSize: 22.sp,
color: AppColors.darkGrayTextColor)),
action: () {
Navigator.pushNamed(context, Routers.videoSlotPage,
arguments: {
'lockSetInfoData': state.lockSetInfoData.value,
'catEyeConfigData': state.lockSetInfoData.value
.lockSettingInfo!.catEyeConfig!.isNotEmpty
? state.lockSetInfoData.value.lockSettingInfo!
.catEyeConfig![0]
: null
}).then((value) => {logic.getLockSettingInfoData()});
},
),
),
_buildSubTitleItem('有人出现时录像', '有人在门口出现10秒后开始录像。\n有人按门铃时立即录像',
state.recordTime.value, () {
@ -74,23 +78,26 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
SizedBox(
height: 30.h,
),
CommonItem(
leftTitel: '实时画面',
rightTitle: state.realTimeMode.value,
isHaveLine: false,
isHaveDirection: true,
isHaveRightWidget: false,
action: () {
Navigator.pushNamed(context, Routers.liveVideoPage,
arguments: {
'lockSetInfoData': state.lockSetInfoData.value,
'catEyeConfigData': state.lockSetInfoData.value
.lockSettingInfo!.catEyeConfig!.isNotEmpty
? state.lockSetInfoData.value.lockSettingInfo!
.catEyeConfig![0]
: null
}).then((value) => {logic.getLockSettingInfoData()});
},
Container(
margin: EdgeInsets.only(left: 20.w),
child: CommonItem(
leftTitel: '实时画面',
rightTitle: state.realTimeMode.value,
isHaveLine: false,
isHaveDirection: true,
isHaveRightWidget: false,
action: () {
Navigator.pushNamed(context, Routers.liveVideoPage,
arguments: {
'lockSetInfoData': state.lockSetInfoData.value,
'catEyeConfigData': state.lockSetInfoData.value
.lockSettingInfo!.catEyeConfig!.isNotEmpty
? state.lockSetInfoData.value.lockSettingInfo!
.catEyeConfig![0]
: null
}).then((value) => {logic.getLockSettingInfoData()});
},
),
)
],
)));
@ -102,7 +109,7 @@ class _CatEyeCustomModePageState extends State<CatEyeCustomModePage> {
onTap: action,
child: Container(
color: Colors.white,
margin: EdgeInsets.only(left: 20.sp, right: 20.sp, top: 20.h),
margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [

View File

@ -3,6 +3,7 @@ import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/dateTool.dart';
class VideoSlotLogic extends BaseGetXController {
final VideoSlotState state = VideoSlotState();
@ -23,6 +24,13 @@ class VideoSlotLogic extends BaseGetXController {
} else {
state.isCustom.value = false;
}
state.startDate.value = DateTool().dateToHNString(state
.catEyeConfigData.value.catEyeModeConfig!.recordStartTime!
.toString());
state.endDate.value = DateTool().dateToHNString(state
.catEyeConfigData.value.catEyeModeConfig!.recordEndTime!
.toString());
}
}
return entity;
@ -30,6 +38,20 @@ class VideoSlotLogic extends BaseGetXController {
//
void updateCatEyeModeConfig() async {
state.isCustom.value == false
? state.recordMode.value = 0
: state.recordMode.value = 1;
if (state.recordMode.value == 1) {
state.recordStartTime.value =
DateTool().dateToTimestamp(state.startDate.value, 0);
//
DateTime tomorrow =
DateTime(DateTool().dateToTimestamp(state.startDate.value, 0))
.add(const Duration(days: 1));
//
state.recordEndTime.value = tomorrow.millisecondsSinceEpoch;
}
var entity = await ApiRepository.to.updateCatEyeModeConfig(
lockId: state.lockSetInfoData.value.lockId!,
catEyeConfig: [

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/videoSlot/videoSlot_logic.dart';
import 'package:star_lock/tools/dateTool.dart';
import 'package:star_lock/tools/pickers/pickers.dart';
import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/translations/trans_lib.dart';
@ -44,15 +45,6 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
style: TextStyle(color: Colors.white, fontSize: 24.sp),
),
onPressed: () {
state.isCustom.value == false
? state.recordMode.value = 0
: state.recordMode.value = 1;
if (state.recordMode.value == 1) {
state.recordStartTime.value =
state.startDateTime.value.millisecondsSinceEpoch;
state.recordEndTime.value =
state.endDateTime.value.millisecondsSinceEpoch;
}
logic.updateCatEyeModeConfig();
},
),
@ -238,10 +230,9 @@ class _VideoSlotPageState extends State<VideoSlotPage> {
onTap: () {
Pickers.showDatePicker(context, mode: DateMode.HM, onConfirm: (p) {
if (isEndTime == false) {
state.startDate.value =
'${intToStr(p.hour!)}:${intToStr(p.minute!)}';
state.startDate.value = DateTool().getYMDHNDateString(p, 3);
} else {
state.endDate.value = '${intToStr(p.hour!)}:${intToStr(p.minute!)}';
state.endDate.value = DateTool().getYMDHNDateString(p, 3);
}
});
},

View File

@ -1,5 +1,6 @@
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
import 'package:star_lock/tools/dateTool.dart';
class VideoSlotState {
var lockSetInfoData = LockSetInfoData().obs;
@ -7,12 +8,8 @@ class VideoSlotState {
var isCustom = false.obs; //
DateTime dateTime = DateTime.now();
final startDateTime = DateTime.now().obs; //
final endDateTime = DateTime.now().obs; //
var startDate =
'${DateTime.now().hour}:${DateTime.now().minute}'.obs; //
var endDate = '${DateTime.now().hour}:${DateTime.now().minute}'.obs; //
var startDate = DateTool().getNowDateWithType(6).obs; //
var endDate = DateTool().getNowDateWithType(6).obs; //
var recordMode = 0.obs; // 0 1

View File

@ -1,6 +1,73 @@
import 'package:star_lock/main/lockDetail/lockSet/faceUnlock/faceUnlock_state.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
class FaceUnlockLogic extends BaseGetXController {
final FaceUnlockState state = FaceUnlockState();
//
Future<LockSetInfoEntity> getLockSettingInfoData() async {
LockSetInfoEntity entity = await ApiRepository.to.getLockSettingInfoData(
lockId: state.lockSetInfoData.value.lockId.toString(),
);
if (entity.errorCode!.codeIsSuccessful) {
state.lockSetInfoData.value = entity.data!;
state.faceOn.value =
entity.data!.lockSettingInfo!.faceSwitch == 0 ? false : true;
state.autoBright.value =
entity.data!.lockSettingInfo!.faceAutoLightScreen == 0 ? false : true;
state.senseDistance.value =
entity.data!.lockSettingInfo!.faceInductionDistance! == 0
? '远距离'
: '近距离';
state.antiMisoperation.value =
entity.data!.lockSettingInfo!.faceAntiMistakeOpen!;
}
return entity;
}
//
void updateFaceSwitch() async {
var entity = await ApiRepository.to.updateFaceSwitch(
lockId: state.lockSetInfoData.value.lockId ?? 0,
faceSwitch: state.faceOn.value == false ? 0 : 1,
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('设置成功');
}
}
//
void updateFaceConfig() async {
var entity = await ApiRepository.to.updateFaceAutoLightScreen(
lockId: state.lockSetInfoData.value.lockId ?? 0,
faceAutoLightScreen: state.autoBright.value == false ? 0 : 1,
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('设置成功');
}
}
//
void updateFaceSenseDistance() async {
var entity = await ApiRepository.to.updateFaceSenseDistance(
lockId: state.lockSetInfoData.value.lockId ?? 0,
faceInductionDistance: state.senseDistance.value == '远距离' ? 0 : 1,
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('设置成功');
}
}
//
void updateFacePreventMisrun() async {
var entity = await ApiRepository.to.updateFacePreventMisrun(
lockId: state.lockSetInfoData.value.lockId ?? 0,
faceAntiMistakeOpen: state.antiMisoperation.value,
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('设置成功');
}
}
}

View File

@ -21,6 +21,12 @@ class _FaceUnlockPageState extends State<FaceUnlockPage> {
final logic = Get.put(FaceUnlockLogic());
final state = Get.find<FaceUnlockLogic>().state;
@override
void initState() {
super.initState();
logic.getLockSettingInfoData();
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -29,45 +35,57 @@ class _FaceUnlockPageState extends State<FaceUnlockPage> {
barTitle: TranslationLoader.lanKeys!.faceUnlocksSet!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
body: Column(
children: [
CommonItem(
leftTitel: TranslationLoader.lanKeys!.faceUnlocks!.tr,
rightTitle: "",
allHeight: 70.h,
isHaveLine: true,
isHaveRightWidget: true,
rightWidget:
SizedBox(width: 60.w, height: 50.h, child: _switch(1))),
CommonItem(
leftTitel: TranslationLoader.lanKeys!.automaticBrighteningScreen!.tr,
rightTitle: "",
isHaveLine: true,
isHaveRightWidget: true,
rightWidget:
SizedBox(width: 60.w, height: 50.h, child: _switch(2))),
_buildSubTitleItem(
TranslationLoader.lanKeys!.sensingDistance!.tr, TranslationLoader.lanKeys!.sensingDistanceTip!.tr, state.senseDistance.value,
() {
_openBottomItemSheet(state.senseDistanceList.value, 0);
}),
SizedBox(
height: 30.h,
),
_buildSubTitleItem(
TranslationLoader.lanKeys!.preventWrongOpening!.tr, TranslationLoader.lanKeys!.preventWrongOpeningTip!.tr, state.antiMisoperation.value, () {
_openBottomItemSheet(state.antiMisoperationList.value, 1);
}),
Expanded(
child: SizedBox(
height: 30.h,
)),
_buildTipsView(),
SizedBox(
height: 60.h,
)
],
));
body: Obx(() => Column(
children: [
Container(
margin: EdgeInsets.only(left: 20.w),
child: CommonItem(
leftTitel: TranslationLoader.lanKeys!.faceUnlocks!.tr,
rightTitle: "",
allHeight: 70.h,
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: SizedBox(
width: 60.w, height: 50.h, child: _switch(1))),
),
Container(
margin: EdgeInsets.only(left: 20.w),
child: CommonItem(
leftTitel: TranslationLoader
.lanKeys!.automaticBrighteningScreen!.tr,
rightTitle: "",
isHaveLine: true,
isHaveRightWidget: true,
rightWidget: SizedBox(
width: 60.w, height: 50.h, child: _switch(2))),
),
_buildSubTitleItem(
TranslationLoader.lanKeys!.sensingDistance!.tr,
TranslationLoader.lanKeys!.sensingDistanceTip!.tr,
state.senseDistance.value, () {
_openBottomItemSheet(state.senseDistanceList.value, 0);
}),
SizedBox(
height: 30.h,
),
_buildSubTitleItem(
TranslationLoader.lanKeys!.preventWrongOpening!.tr,
TranslationLoader.lanKeys!.preventWrongOpeningTip!.tr,
state.antiMisoperation.value == 0
? '关闭'
: '${state.antiMisoperation.value}', () {
_openBottomItemSheet(state.antiMisoperationStrList.value, 1);
}),
Expanded(
child: SizedBox(
height: 30.h,
)),
_buildTipsView(),
SizedBox(
height: 60.h,
)
],
)));
}
Widget _buildSubTitleItem(
@ -76,6 +94,7 @@ class _FaceUnlockPageState extends State<FaceUnlockPage> {
onTap: action,
child: Container(
margin: EdgeInsets.only(left: 20.sp, right: 20.sp, top: 20.h),
color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
@ -152,19 +171,20 @@ class _FaceUnlockPageState extends State<FaceUnlockPage> {
thumbColor: CupertinoColors.white,
value: getIndex == 1 ? state.faceOn.value : state.autoBright.value,
onChanged: (value) {
setState(() {
if (getIndex == 1) {
state.faceOn.value = value;
} else {
state.autoBright.value = value;
}
});
if (getIndex == 1) {
//
state.faceOn.value = value;
logic.updateFaceSwitch();
} else {
//
state.autoBright.value = value;
logic.updateFaceConfig();
}
},
);
}
Future _openBottomItemSheet(
List<String> bottomItemList, int clickIndex) async {
Future _openBottomItemSheet(List bottomItemList, int clickIndex) async {
showModalBottomSheet(
context: context,
shape: RoundedRectangleBorder(
@ -178,13 +198,13 @@ class _FaceUnlockPageState extends State<FaceUnlockPage> {
//
state.senseDistance.value =
state.senseDistanceList.value[value];
logic.updateFaceSenseDistance();
} else if (clickIndex == 1) {
//
state.antiMisoperation.value =
state.antiMisoperationList.value[value];
logic.updateFacePreventMisrun();
}
setState(() {});
},
);
});

View File

@ -1,20 +1,32 @@
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
import '../../../../translations/trans_lib.dart';
class FaceUnlockState {
var lockSetInfoData = LockSetInfoData().obs;
var isCheck = false.obs;
var faceOn = false.obs; //
var autoBright = false.obs; //
var senseDistance = TranslationLoader.lanKeys!.remote!.tr.obs; //
var antiMisoperation = TranslationLoader.lanKeys!.close!.tr.obs; //
var senseDistanceList = [TranslationLoader.lanKeys!.remote!.tr, TranslationLoader.lanKeys!.closeRange!.tr].obs;
var antiMisoperationList = [TranslationLoader.lanKeys!.close!.tr, '5${TranslationLoader.lanKeys!.second!.tr}', '10${TranslationLoader.lanKeys!.second!.tr}', '15${TranslationLoader.lanKeys!.second!.tr}', '30${TranslationLoader.lanKeys!.second!.tr}', '60${TranslationLoader.lanKeys!.second!.tr}'].obs;
var antiMisoperation = 0.obs; //
var senseDistanceList = [
TranslationLoader.lanKeys!.remote!.tr,
TranslationLoader.lanKeys!.closeRange!.tr
].obs;
var antiMisoperationList = [0, 5, 10, 15, 30, 60].obs;
var antiMisoperationStrList = [
TranslationLoader.lanKeys!.close!.tr,
'5${TranslationLoader.lanKeys!.second!.tr}',
'10${TranslationLoader.lanKeys!.second!.tr}',
'15${TranslationLoader.lanKeys!.second!.tr}',
'30${TranslationLoader.lanKeys!.second!.tr}',
'60${TranslationLoader.lanKeys!.second!.tr}'
].obs;
//
final TextStyle titleStyle = TextStyle(
color: Colors.black, fontSize: 24.sp, fontWeight: FontWeight.w500);
@ -23,9 +35,18 @@ class FaceUnlockState {
TextStyle(color: AppColors.placeholderTextColor, fontSize: 22.sp);
late InlineSpan tipsPreviewSpan = TextSpan(children: [
TextSpan(text: '${TranslationLoader.lanKeys!.addAndUseFaceWhenUnlocking!.tr}:\n', style: titleStyle),
TextSpan(
text:TranslationLoader.lanKeys!.addAndUseFaceWhenUnlockingTip!.tr,
text: '${TranslationLoader.lanKeys!.addAndUseFaceWhenUnlocking!.tr}:\n',
style: titleStyle),
TextSpan(
text: TranslationLoader.lanKeys!.addAndUseFaceWhenUnlockingTip!.tr,
style: subTipsStyle),
]);
FaceUnlockState() {
Map map = Get.arguments;
if (map['lockSetInfoData'] != null) {
lockSetInfoData.value = map['lockSetInfoData'];
}
}
}

View File

@ -357,7 +357,9 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
isHaveLine: true,
isHaveDirection: true,
action: () {
Get.toNamed(Routers.faceUnlockPage);
Get.toNamed(Routers.faceUnlockPage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value
});
})),
// ),
//
@ -369,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

@ -27,8 +27,9 @@ class LockMonitoringLogic extends BaseGetXController {
void _getTVDataRefreshUIAction() {
// eventBus
_getTVDataRefreshUIEvent =
eventBus.on<GetTVDataRefreshUI>().listen((event) {
eventBus.on<GetTVDataRefreshUI>().listen((event) async {
if (event.tvList.isNotEmpty) {
print('收到图片了啦啦啦啦啦啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊');
//
Uint8List imageData = Uint8List.fromList(event.tvList);
//

View File

@ -3,6 +3,6 @@ import 'flavors.dart';
import 'main.dart' as runner;
Future<void> main() async {
F.appFlavor = Flavor.xie;
F.appFlavor = Flavor.local;
await runner.main();
}

View File

@ -1,6 +1,13 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:fluwx/fluwx.dart';
import 'package:get/get.dart';
import 'package:star_lock/mine/mall/lockMall_entity.dart';
import 'package:star_lock/mine/mall/lockMall_state.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/pay/wx_pay_tool.dart';
import 'package:star_lock/webview/webview_logic.dart';
import 'package:webview_flutter/webview_flutter.dart';
import '../../tools/baseGetXController.dart';
@ -26,18 +33,74 @@ class LockMallLogic extends BaseGetXController {
state.webProgress.value = 1.0;
},
onWebResourceError: (WebResourceError error) {},
onNavigationRequest: (NavigationRequest request) {
// if (request.url.startsWith('https://www.youtube.com/')) {
// return NavigationDecision.prevent;
// }
onNavigationRequest: (NavigationRequest request) async {
//
if (WebViewLogic.judgePaySchemes(request.url)) {
await WebViewLogic.runScheme(request.url);
return NavigationDecision.prevent;
}
return NavigationDecision.navigate;
},
),
);
state.mallWebView.loadRequest(Uri.parse(state.lockMallUrl.value));
// FlutterBridge.postMessage({action:'',data:'{}',callFun:'回调给js的方法'})
state.mallWebView.addJavaScriptChannel(
"FlutterBridge",
onMessageReceived: (JavaScriptMessage message) async {
flutterBridge(message);
},
);
// onMessageReceived
}
}
//webview的调用
Future<void> flutterBridge(JavaScriptMessage message) async {
final dynamic obj = jsonDecode(message.message);
print(obj);
if (obj is! Map && obj['action'] is String) {
return;
}
String action = obj['action'];
dynamic data = obj['data'];
String? callFun = obj['callFun'];
switch (action) {
case 'WechatPayParams':
//
wxPay(data, callFun);
break;
}
}
//
Future<void> wxPay(dynamic data, String? callFun) async {
WxPayTool.pay(WxPayTool.mapToPayment(data), (response) {
if (response is WeChatPaymentResponse) {
Map data = {
'type': response.type,
'extData': response.extData,
'errCode': response.errCode,
'errStr': response.errStr,
};
state.mallWebView.runJavaScript(
'window.$callFun(`${json.encode(data)}`)',
);
}
});
}
//webview 退退
Future<bool> canGoBack(bool didPop) async {
bool canGoBack = await state.mallWebView.canGoBack();
if (canGoBack) {
await state.mallWebView.goBack();
} else {
Get.back();
}
return false;
}
@override
Future<void> onReady() async {
print("ready home");
@ -48,7 +111,6 @@ class LockMallLogic extends BaseGetXController {
void onInit() {
print("init home");
super.onInit();
getMallURLRequest();
}

View File

@ -6,8 +6,6 @@ import 'package:star_lock/mine/mall/lockMall_logic.dart';
import 'package:star_lock/tools/titleAppBar.dart';
import 'package:webview_flutter/webview_flutter.dart';
import '../../translations/trans_lib.dart';
class LockMallPage extends StatefulWidget {
const LockMallPage({Key? key}) : super(key: key);
@ -29,30 +27,33 @@ class _LockMallPageState extends State<LockMallPage> {
// FIXME
// FIXME url应该使用接口获取 /mall/getUrl POST请求
// String url = 'https://ge.mall.star-lock.cn/quick_login?id=4&key=1ffb9d37109b8351ebb04ccfcca02c8e';
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: const Color(0xFFFFFFFF),
appBar: TitleAppBar(
barTitle: getWebTitle(),
haveBack: true,
backgroundColor: AppColors.mainColor,
),
body: Obx(() => Column(
children: <Widget>[
Container(
padding: EdgeInsets.only(bottom: 10.w),
child: LinearProgressIndicator(
value: state.webProgress.value,
backgroundColor: Colors.grey,
valueColor:
AlwaysStoppedAnimation<Color>(AppColors.mainColor),
return PopScope(
onPopInvoked: logic.canGoBack,
canPop: false,
child: Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: const Color(0xFFFFFFFF),
appBar: TitleAppBar(
barTitle: getWebTitle(),
haveBack: true,
backgroundColor: AppColors.mainColor,
),
body: Obx(() => Column(
children: <Widget>[
Container(
padding: EdgeInsets.only(bottom: 10.w),
child: LinearProgressIndicator(
value: state.webProgress.value,
backgroundColor: Colors.grey,
valueColor: AlwaysStoppedAnimation<Color>(AppColors.mainColor),
),
),
),
Expanded(
child: WebViewWidget(controller: state.mallWebView),
),
],
)));
Expanded(
child: WebViewWidget(controller: state.mallWebView),
),
],
))),
);
}
String getWebTitle() {

View File

@ -1,11 +1,20 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:star_lock/webview/webview_logic.dart';
import 'package:webview_flutter/webview_flutter.dart';
class LockMallState {
var lockMallUrl = "".obs;
var webProgress = 0.0.obs;
late WebViewController mallWebView = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setBackgroundColor(Colors.white);
late WebViewController mallWebView = initWebViewController();
//webView控制器
WebViewController initWebViewController() {
WebViewController allWebView = WebViewController();
allWebView.setJavaScriptMode(JavaScriptMode.unrestricted);
allWebView.setBackgroundColor(Colors.white);
allWebView.setUserAgent(WebViewLogic.userAgent);
return allWebView;
}
}

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';
@ -108,16 +109,13 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> with WidgetsBin
),
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,
@ -129,16 +127,13 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> with WidgetsBin
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(
@ -151,18 +146,13 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> with WidgetsBin
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(
@ -171,30 +161,24 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> with WidgetsBin
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)),
],
@ -228,7 +212,9 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> with WidgetsBin
}
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; //
@ -287,13 +273,9 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> with WidgetsBin
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();
}
},
);
@ -302,8 +284,8 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage> with WidgetsBin
///
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

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

View File

@ -1732,8 +1732,9 @@ class ApiProvider extends BaseProvider {
'faceSwitch': faceSwitch,
}));
//
Future<Response> updateFaceConfig(int lockId, int faceInductionDistance) =>
//
Future<Response> updateFaceSenseDistance(
int lockId, int faceInductionDistance) =>
post(
updateFaceConfigURL.toUrl,
jsonEncode({
@ -1760,6 +1761,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

@ -1769,10 +1769,10 @@ class ApiRepository {
}
//
Future<VersionUndateEntity> updateFaceConfig(
Future<VersionUndateEntity> updateFaceSenseDistance(
{required int lockId, required int faceInductionDistance}) async {
final res =
await apiProvider.updateFaceConfig(lockId, faceInductionDistance);
final res = await apiProvider.updateFaceSenseDistance(
lockId, faceInductionDistance);
return VersionUndateEntity.fromJson(res.body);
}
@ -1791,4 +1791,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

@ -7,9 +7,16 @@ import 'package:star_lock/login/login/entity/LoginData.dart';
import '../tools/platform_info_services.dart';
import '../tools/storage.dart';
FutureOr<Request> requestInterceptor(Request request) async {
request.headers['User-Agent'] =
//UA
String getUserAgent() {
//便
String ua =
'StarLock/${PlatformInfoService.to.info.version}/${PlatformInfoService.to.info.buildNumber}/${GetPlatform.isAndroid ? 'Android' : 'iOS'}';
return ua;
}
FutureOr<Request> requestInterceptor(Request request) async {
request.headers['User-Agent'] = getUserAgent();
request.headers['Accept-Language'] = 'zh-CN';
// request.headers['Content-Type'] = 'application/json';
// request.headers['token'] = StoreService.to.userToken!;

View File

@ -102,12 +102,15 @@ class CallTalk {
iframe!.bb!.addAll(getList);
}
// print(
// 'iframe.bagNum: ${iframe!.bagNum} iframe.bagReceive: ${iframe!.bagReceive}');
// 'iframe.bagNum: ${iframe!.bagNum} iframe.bagReceive: ${iframe!.bagReceive}');
//
if (iframe!.bagNum == iframe!.bagReceive) {
// print('播放第${iframe!.iframeIndex}帧 一帧图片的hexStringData: ${Uint8List.fromList(growableList)}');
// print('得到的一张图片的数据长度为${iframe!.bb!.length}');
DateTime now = DateTime.now();
String formattedTime = "${now.hour}:${now.minute}:${now.second}";
print('$formattedTime得到了一张图片共${iframe!.bagReceive}个数据包');
eventBus.fire(GetTVDataRefreshUI(iframe!.bb!));
} else {
// print('接收到的包数不等于总包数');

View File

@ -120,7 +120,7 @@ class CommandUDPReciverManager {
// UDPTalkClass().isEndCall = true;
// UDPTalkClass().stopLocalAudio();
// CallTalk().stopPcmSound();
// eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
// Get.back();
UDPTalkClass().callNoAnswer(3);
// print('挂断反馈刷新UI1');

View File

@ -170,6 +170,10 @@ class UDPTalkClass {
void stopLocalAudio() async {
audioPlayer.setReleaseMode(ReleaseMode.loop);
await audioPlayer.stop();
if (playLocalAudioTimer != null) {
playLocalAudioTimer.cancel();
playLocalAudioSecond = 0;
}
}
//

View File

@ -0,0 +1,44 @@
import 'package:fluwx/fluwx.dart';
///
///
///
///
class WxPayTool {
static bool isInit = false;
static Fluwx fluwx = Fluwx();
static init(String appId, String universalLink) {
fluwx.registerApi(appId: appId, universalLink: universalLink);
}
static Future<void> pay(Payment payment, WeChatResponseSubscriber listener) async {
if (!isInit) {
isInit = true;
await init(payment.appId, '123');
//
responseListener(WeChatResponse response) {
if (response is WeChatPaymentResponse) {
//
listener.call(response);
}
}
//
fluwx.addSubscriber(responseListener);
}
fluwx.pay(which: payment);
}
static Payment mapToPayment(dynamic data) {
Payment payment = Payment(
appId: data['appId'],
partnerId: data['partnerId'],
prepayId: data['prepayId'],
packageValue: data['packageValue'],
nonceStr: data['nonceStr'],
timestamp: int.tryParse(data['timeStamp']) ?? 0,
sign: data['sign'],
);
return payment;
}
}

View File

@ -0,0 +1,32 @@
import 'package:get/get_core/src/get_main.dart';
import 'package:star_lock/network/request_interceptor.dart';
import 'package:url_launcher/url_launcher.dart';
///
/// webview的工具类
///
/// * Schemes的跳转
/// * webview的UA表示
///
class WebViewLogic {
//pay的Scheme
static const List<String> paySchemes = ['weixin:', 'alipay:'];
//UA信息
static String get userAgent => getUserAgent();
//Scheme
static bool judgePaySchemes(String url) {
for (int i = 0, j = paySchemes.length; i < j; i++) {
if (url.contains(paySchemes[i])) {
return true;
}
}
return false;
}
//Scheme业务逻辑
static Future<void> runScheme(String url) async {
await launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication);
}
}

View File

@ -124,7 +124,8 @@ dependencies:
#网络图片缓存
cached_network_image: ^3.2.0
webview_flutter: ^4.2.3
webview_flutter: ^4.4.2
jpush_flutter: ^2.5.1
#视频播放器
@ -155,6 +156,7 @@ dependencies:
audio_service: ^0.18.12
app_settings: ^5.1.1
flutter_local_notifications: ^17.0.0
fluwx: ^4.5.5
system_settings: ^2.0.0
dev_dependencies: