# Conflicts:
#	star_lock/lib/network/api_provider.dart
This commit is contained in:
魏少阳 2024-03-28 13:50:23 +08:00
commit 186f92cbe1
35 changed files with 761 additions and 279 deletions

45
star_lock/VERSION.md Normal file
View File

@ -0,0 +1,45 @@
# 项目版本管理
在项目进行过程中,我们遇到过以下场景:
1. 对用户说“你用的包我们没有了,代码已经向前发展了,我们无法提供相同的安装包/另一个平台的该版本安装包”
2. 对用户说“功能有问题?我也不清楚你是不是版本太老了,要不你直接升级到最新版吧“
3. ”什么X.X.X版本有XX问题我不知道这个问题好像已经修复了啊要不你升级最新版试试“
4. 用户并不是总能升级到最新版、例如新版本引入了某个功能带来新的问题,我们需要在特定版本修复特定问题。
5. 例如对于应用商店当我提交审核1.1.1版本那么我将会根据反馈修复问题而此时主分支已经进化到1.2.0版本引入了更多的功能我现在并不像将1.2的新增功能提交测试我需要继续在1.0版本修复一些问题。(别想着这是应用商店,用户也是如此,例如你交付给某个客户进行测试,双方都不会想在测试-修复的循环中不断引入新功能【新问题】)
为了避免以上情况,我们必须对项目进行规范的版本管理。
具体来说,任何和内部协同,外部交付的构建,必须遵循此文档的规范。
## 分支管理
目前没有进行工作流分支管理,所有的开发都在`master`分支上进行。
在构建时需要拉出新分支来区分构建的版本的代码。具体来讲,当你现在需要构建,你需要进行如下操作:
1. 按规则修改pubspec.yaml中的版本号并添加对应的版本说明记录
2. 在master分支提交并push代码
3. 在master拉出新分支例如`build-1.0.18+2024032002`,其中的`1.0.18+2024032002`是你刚新增的版本
4. 在新分支构建
5. 如果构建过程需要修改代码提交在build-xx分支而不是master分支
6. 构建完成后如有必要可以合并到master分支保留build-xx分支已备后续可以再次构建此版本的其他构建平台或构建方式
7. 构建完成后记得切换回master分支
## 版本号
项目版本号遵循flutter规范`major.minor.patch+build`,例如`1.0.0+1`
其中的构建号必须在每一次构建都进行递增,具体的规则是年月日二位自增,例如`2024032701`
前面的版本号是由项目的业务需求决定的,例如`1.0.0``1.0.1``1.1.0`等。
具体来说,`major`是大版本号,`minor`是小版本号,`patch`是修订号
其中大版本号必须是完全不兼容的更新才可以使用,脱胎换骨,浴火重生级别的。
小版本号是功能差异,不一定完全兼容,用户可能需要升级否则无法使用某个功能,
例如增加了一个新功能,或者修改了一个已有的功能。
修订号是修复bug或者优化性能或者修改了一些细节但是不影响用户使用的。
## 构建物文件名
无论分发到什么渠道,通过自行发布页面或者通过即时通讯工具传递安装包,都必须使用规范的文件名以避免混淆。
文件名的格式为:`app-sky-64-release-VersionCode.apk`
其中`sky`是渠道名,`64`是CPU架构`release`是构建类型,`VersionCode`是版本号。

View File

@ -143,7 +143,12 @@ android {
// NDK配置使flutter run .apk包 // NDK配置使flutter run .apk包
ndk { ndk {
//SO库架构so //SO库架构so
abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64" // abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64"
// 2023164
// 32flutter或者说我们的项目本来就兼容不了老平台
abiFilters "arm64-v8a"
} }
manifestPlaceholders = [ manifestPlaceholders = [
@ -161,10 +166,11 @@ android {
abi { abi {
enable true enable true
reset() reset()
// x86_64,x86,armeabi-v7a,armeabi,arm64-v8a // 2023164
// x86_64,x86,armeabi-v7a,armeabi,arm64-v8a // 32flutter或者说我们的项目本来就兼容不了老平台
include "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64" // include "armeabi", "armeabi-v7a", "arm64-v8a", "x86","x86_64"
universalApk true // include "arm64-v8a"
universalApk false
} }
} }
} }

View File

@ -29,6 +29,7 @@
<!--允许麦克风权限,用于录音发送--> <!--允许麦克风权限,用于录音发送-->
<uses-permission android:name="android.permission.RECORD_AUDIO"/> <uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/> <uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS"/> <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.VIBRATE"/> <uses-permission android:name="android.permission.VIBRATE"/>
@ -37,6 +38,9 @@
<meta-data <meta-data
android:name="flutterEmbedding" android:name="flutterEmbedding"
android:value="2" /> android:value="2" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="1"/> <!-- 将您的通知渠道ID替换为您的实际ID -->
<!-- 配置定位Service --> <!-- 配置定位Service -->
<service android:name="com.amap.api.location.APSService"/> <service android:name="com.amap.api.location.APSService"/>
<activity android:name="com.skychip.lock.MainActivity" android:exported="true" android:screenOrientation="portrait" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize"> <activity android:name="com.skychip.lock.MainActivity" android:exported="true" android:screenOrientation="portrait" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -55,10 +55,17 @@ class XSConstantMacro {
return "未知"; return "未知";
} }
} }
// lockEventType 0-10-20-30-40- // lockEventType 0-10-20-30-40-
static int lockEventTypeAll = 0; static int lockEventTypeAll = 0;
static int lockEventTypeOpenDoor = 10; static int lockEventTypeOpenDoor = 10;
static int lockEventTypeAbnormal = 20; static int lockEventTypeAbnormal = 20;
static int lockEventTypeDoorbell = 30; static int lockEventTypeDoorbell = 30;
static int lockEventTypeVideo = 40; static int lockEventTypeVideo = 40;
//
static int catEyeWorkModePowerSaving = 1; //
static int catEyeWorkModeStayCapture = 2; //
static int catEyeWorkModeRealTimeMonitoring = 3; //
static int catEyeWorkModeCustom = 4; //
} }

View File

@ -16,6 +16,8 @@ class StarLockAMapKey {
class F { class F {
static Flavor? appFlavor; static Flavor? appFlavor;
// ()
static bool isLite = false;
static String get name => appFlavor?.name ?? ''; static String get name => appFlavor?.name ?? '';

View File

@ -207,8 +207,7 @@ class _StarLockLoginPageState extends State<StarLockLoginPage> {
child: SizedBox( child: SizedBox(
width: 10.sp, width: 10.sp,
)), )),
// Google暂时屏蔽 F.isLite
F.appFlavor == Flavor.sky
? Container() ? Container()
: GestureDetector( : GestureDetector(
child: SizedBox( child: SizedBox(

View File

@ -1,6 +1,7 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:star_lock/flavors.dart'; import 'package:star_lock/flavors.dart';
import 'package:star_lock/translations/trans_lib.dart'; import 'package:star_lock/translations/trans_lib.dart';
import 'app.dart'; import 'app.dart';
@ -17,6 +18,8 @@ FutureOr<void> main() async {
// //
await _initTranslation(); await _initTranslation();
initLocalNotification();
runApp(MyApp()); runApp(MyApp());
if (AppPlatform.isAndroid) { if (AppPlatform.isAndroid) {
@ -37,7 +40,7 @@ Future _initTranslation() async => TranslationLoader.loadTranslation(
Future _setCommonServices() async { Future _setCommonServices() async {
await Get.putAsync(() => StoreService().init()); await Get.putAsync(() => StoreService().init());
await Get.putAsync(() => PlatformInfoService().init()); await Get.putAsync(() => PlatformInfoService().init());
if (F.appFlavor == Flavor.sky) { if (F.isLite) {
// //
// await Get.putAsync(() => DeviceInfoService().init()); // await Get.putAsync(() => DeviceInfoService().init());
} else { } else {
@ -45,3 +48,14 @@ Future _setCommonServices() async {
} }
// Get.log(PlatformInfoService.to.info.version); // Get.log(PlatformInfoService.to.info.version);
} }
initLocalNotification() async {
WidgetsFlutterBinding.ensureInitialized();
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();
const AndroidInitializationSettings initializationSettingsAndroid =
AndroidInitializationSettings('app_icon');
const InitializationSettings initializationSettings =
InitializationSettings(android: initializationSettingsAndroid);
await flutterLocalNotificationsPlugin.initialize(initializationSettings);
}

View File

@ -744,6 +744,7 @@ class LockDetailLogic extends BaseGetXController {
// 3 // 3
state.lockAlias.value = event.setResult; state.lockAlias.value = event.setResult;
state.keyInfos.value.lockAlias = event.setResult; state.keyInfos.value.lockAlias = event.setResult;
Storage.setString(saveLockAlias, state.lockAlias.value);
} else if (event.type == 4) { } else if (event.type == 4) {
// 4 // 4
state.electricQuantity.value = int.parse(event.setResult); state.electricQuantity.value = int.parse(event.setResult);

View File

@ -109,6 +109,7 @@ class _LockDetailPageState extends State<LockDetailPage>
state.electricQuantity.value = state.keyInfos.value.electricQuantity!; state.electricQuantity.value = state.keyInfos.value.electricQuantity!;
state.isOpenPassageMode.value = state.keyInfos.value.passageMode!; state.isOpenPassageMode.value = state.keyInfos.value.passageMode!;
state.lockAlias.value = state.keyInfos.value.lockAlias!; state.lockAlias.value = state.keyInfos.value.lockAlias!;
Storage.setString(saveLockAlias, state.lockAlias.value);
BlueManage().connectDeviceName = BlueManage().connectDeviceName =
state.keyInfos.value.bluetooth!.bluetoothDeviceName!; state.keyInfos.value.bluetooth!.bluetoothDeviceName!;
@ -178,7 +179,7 @@ class _LockDetailPageState extends State<LockDetailPage>
SizedBox( SizedBox(
height: 10.h, height: 10.h,
), ),
buildPageIndicator(), Obx(() => buildPageIndicator()),
Expanded( Expanded(
child: Container( child: Container(
margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 30.h), margin: EdgeInsets.only(left: 10.w, right: 10.w, top: 30.h),
@ -992,7 +993,8 @@ class _LockDetailPageState extends State<LockDetailPage>
state.closedUnlockSuccessfulTimer?.cancel(); state.closedUnlockSuccessfulTimer?.cancel();
_lockRefreshLockDetailInfoDataEvent?.cancel(); _lockRefreshLockDetailInfoDataEvent?.cancel();
state.replySubscription.cancel(); state.replySubscription.cancel();
state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent!.cancel(); state.lockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceEvent!
.cancel();
if (state.animationController != null) { if (state.animationController != null) {
state.animationController!.dispose(); state.animationController!.dispose();

View File

@ -1,7 +1,53 @@
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import 'catEyeSet_state.dart'; import 'catEyeSet_state.dart';
class CatEyeSetLogic extends BaseGetXController { class CatEyeSetLogic extends BaseGetXController {
final CatEyeSetState state = CatEyeSetState(); final CatEyeSetState state = CatEyeSetState();
//
void updateAutoLightScreenConfig() async {
var entity = await ApiRepository.to.updateAutoLightScreenConfig(
lockId: state.lockSetInfoData.value.lockId!,
autoLightScreen: state.isAutoBright.value == true ? 1 : 0,
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('设置成功');
}
}
//
void updateLightScreenTimeConfig() async {
var entity = await ApiRepository.to.updateLightScreenTimeConfig(
lockId: state.lockSetInfoData.value.lockId!,
autoLightScreenTime:
int.parse(state.selectBrightDuration.value.replaceAll('', '')),
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('设置成功');
}
}
//
void updateStayWarnConfig() async {
var entity = await ApiRepository.to.updateStayWarnConfig(
lockId: state.lockSetInfoData.value.lockId!,
stayWarn: state.isStayWarning.value == true ? 1 : 0,
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('设置成功');
}
}
//
void updateAbnormalWarnConfig() async {
var entity = await ApiRepository.to.updateAbnormalWarnConfig(
lockId: state.lockSetInfoData.value.lockId!,
abnormalWarn: state.isExceptionWarning.value == true ? 1 : 0,
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('设置成功');
}
}
} }

View File

@ -33,12 +33,18 @@ class _CatEyeSetPageState extends State<CatEyeSetPage> {
children: [ children: [
CommonItem( CommonItem(
leftTitel: '猫眼工作模式', leftTitel: '猫眼工作模式',
rightTitle: "", rightTitle: state.selectCatEyeWorkMode.value,
allHeight: 70.h, allHeight: 70.h,
isHaveLine: true, isHaveLine: true,
isHaveDirection: true, isHaveDirection: true,
action: () { action: () {
Get.toNamed(Routers.catEyeWorkModePage); Get.toNamed(Routers.catEyeWorkModePage, arguments: {
'lockSetInfoData': state.lockSetInfoData.value
})?.then((value) {
if (value != null) {
state.selectCatEyeWorkMode.value = value;
}
});
}), }),
Obx(() => CommonItem( Obx(() => CommonItem(
leftTitel: '自动亮屏', leftTitel: '自动亮屏',
@ -94,15 +100,26 @@ class _CatEyeSetPageState extends State<CatEyeSetPage> {
onChanged: (value) { onChanged: (value) {
switch (clickIndex) { switch (clickIndex) {
case 1: // case 1: //
{
state.isAutoBright.value = value; state.isAutoBright.value = value;
logic.updateAutoLightScreenConfig();
}
break; break;
case 2: // case 2: //
{
state.isStayWarning.value = value; state.isStayWarning.value = value;
logic.updateStayWarnConfig();
}
break; break;
case 3: // case 3: //
{
state.isExceptionWarning.value = value; state.isExceptionWarning.value = value;
logic.updateAbnormalWarnConfig();
}
break; break;
default: default:
print('clickIndex is not match');
break;
} }
}, },
); );
@ -120,6 +137,7 @@ class _CatEyeSetPageState extends State<CatEyeSetPage> {
chooseCallback: (value) { chooseCallback: (value) {
state.selectBrightDuration.value = state.selectBrightDuration.value =
state.brightDurationTimeList[value]; state.brightDurationTimeList[value];
logic.updateLightScreenTimeConfig();
}, },
); );
}); });

View File

@ -1,4 +1,5 @@
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
class CatEyeSetState { class CatEyeSetState {
var brightDurationTimeList = ['10秒', '15秒', '20秒'].obs; var brightDurationTimeList = ['10秒', '15秒', '20秒'].obs;
@ -6,4 +7,11 @@ class CatEyeSetState {
var isAutoBright = false.obs; // var isAutoBright = false.obs; //
var isStayWarning = false.obs; // var isStayWarning = false.obs; //
var isExceptionWarning = false.obs; // var isExceptionWarning = false.obs; //
var lockSetInfoData = LockSetInfoData().obs;
var selectCatEyeWorkMode = ''.obs; //
CatEyeSetState() {
Map map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
}
} }

View File

@ -0,0 +1,27 @@
import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_state.dart';
import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart';
class CatEyeWorkModeLogic extends BaseGetXController {
final CatEyeWorkModeState state = CatEyeWorkModeState();
//
void updateCatEyeModeConfig() async {
var entity = await ApiRepository.to.updateCatEyeModeConfig(
lockId: state.lockSetInfoData.value.lockId!,
catEyeConfig: {
'catEyeMode': state.selectCatEyeWorkMode.value,
'catEyeModeConfig': {
'recordMode': state.recordMode.value,
'recordStartTime': state.recordStartTime.value,
'recordEndTime': state.recordEndTime.value,
'detectionDistance': state.detectionDistance.value,
'realTimeMode': state.realTimeMode.value,
}
},
);
if (entity.errorCode!.codeIsSuccessful) {
showToast('设置成功');
}
}
}

View File

@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart'; import 'package:star_lock/appRouters.dart';
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
import 'package:star_lock/main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_logic.dart';
import '../../../../../app_settings/app_colors.dart'; import '../../../../../app_settings/app_colors.dart';
import '../../../../../tools/titleAppBar.dart'; import '../../../../../tools/titleAppBar.dart';
@ -14,8 +16,8 @@ class CatEyeWorkModePage extends StatefulWidget {
} }
class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> { class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
bool isCheck = false; final logic = Get.put(CatEyeWorkModeLogic());
List boolList = [true, false, false, false]; final state = Get.find<CatEyeWorkModeLogic>().state;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -30,44 +32,34 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
SizedBox( SizedBox(
height: 30.h, height: 30.h,
), ),
_buildTipsView( _buildTipsView('省电模式:\n',
'省电模式:\n', '适合门口较为安全的环境。\n仅发生特定事件才录像,并可查看实时画面。\n一般情况下满电可使用7-8个月', 0),
'适合门口较为安全的环境。\n仅发生特定事件才录像,并可查看实时画面。\n一般情况下满电可使用7-8个月', SizedBox(
0, height: 30.h,
boolList[0]), ),
_buildTipsView('逗留抓拍模式:\n',
'有人逗留或发生特定事件才录像,可随时查看\n实时画面。\n一般情况下满电可使用5~6个月。', 1),
SizedBox(
height: 30.h,
),
_buildTipsView('实时监控模式:\n',
'适合门口人员复杂、较不安全的环境。\n有人出现就录像,可随时查看实时画面。\n一般情况下满电可使用2~4个月。', 2),
SizedBox( SizedBox(
height: 30.h, height: 30.h,
), ),
_buildTipsView( _buildTipsView(
'逗留抓拍模式:\n', '自定义模式:\n', '根据您家门口实际情况设置录像和实时画面功能。\n可使用时长由具体设置决定。', 3)
'有人逗留或发生特定事件才录像,可随时查看\n实时画面。\n一般情况下满电可使用5~6个月。',
1,
boolList[1]),
SizedBox(
height: 30.h,
),
_buildTipsView(
'实时监控模式:\n',
'适合门口人员复杂、较不安全的环境。\n有人出现就录像,可随时查看实时画面。\n一般情况下满电可使用2~4个月。',
2,
boolList[2]),
SizedBox(
height: 30.h,
),
_buildTipsView('自定义模式:\n', '根据您家门口实际情况设置录像和实时画面功能。\n可使用时长由具体设置决定。',
3, boolList[3])
], ],
)); ));
} }
Widget _buildTipsView( Widget _buildTipsView(String titleStr, String subTitle, int clickIndex) {
String titleStr, String subTitle, int clickIndex, bool isClick) {
return GestureDetector( return GestureDetector(
child: Container( child: Container(
width: ScreenUtil().screenWidth - 40.w, width: ScreenUtil().screenWidth - 40.w,
margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h), margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 10.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: isClick color: state.boolList.value[clickIndex]
? AppColors.blueViewBgColor ? AppColors.blueViewBgColor
: AppColors.greyBackgroundColor, : AppColors.greyBackgroundColor,
borderRadius: BorderRadius.circular(10.0), borderRadius: BorderRadius.circular(10.0),
@ -77,7 +69,7 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
left: 20.w, top: 30.h, bottom: 30.h, right: 20.w), left: 20.w, top: 30.h, bottom: 30.h, right: 20.w),
child: Row( child: Row(
children: [ children: [
isClick state.boolList.value[clickIndex]
? Image.asset( ? Image.asset(
'images/mine/icon_mine_blueSelect.png', 'images/mine/icon_mine_blueSelect.png',
width: 20.w, width: 20.w,
@ -89,7 +81,8 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
), ),
SizedBox(width: 10.w), SizedBox(width: 10.w),
Expanded( Expanded(
child: _buildRichText(titleStr, subTitle, isClick), child: _buildRichText(
titleStr, subTitle, state.boolList.value[clickIndex]),
), ),
SizedBox( SizedBox(
width: 10.w, width: 10.w,
@ -128,11 +121,30 @@ class _CatEyeWorkModePageState extends State<CatEyeWorkModePage> {
), ),
onTap: () { onTap: () {
setState(() { setState(() {
for (int i = 0; i < boolList.length; i++) { for (int i = 0; i < state.boolList.value.length; i++) {
if (clickIndex == i) { if (clickIndex == i) {
boolList[clickIndex] = true; state.boolList.value[clickIndex] = true;
switch (clickIndex) {
case 0:
state.selectCatEyeWorkMode.value =
XSConstantMacro.catEyeWorkModePowerSaving;
break;
case 1:
state.selectCatEyeWorkMode.value =
XSConstantMacro.catEyeWorkModeStayCapture;
break;
case 2:
state.selectCatEyeWorkMode.value =
XSConstantMacro.catEyeWorkModeRealTimeMonitoring;
break;
case 3:
state.selectCatEyeWorkMode.value =
XSConstantMacro.catEyeWorkModeCustom;
break;
}
logic.updateCatEyeModeConfig();
} else { } else {
boolList[i] = false; state.boolList.value[i] = false;
} }
} }
}); });

View File

@ -0,0 +1,20 @@
import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
class CatEyeWorkModeState {
var lockSetInfoData = LockSetInfoData().obs;
var selectCatEyeWorkMode = 0.obs; //
var boolList = [true, false, false, false].obs;
var recordMode = 0.obs; // 0 1
//recordStartTime与recordEndTime参数
var recordStartTime = 0.obs; // 1709715049775,
var recordEndTime = 0.obs; //1709715049775,
var recordTime = 0.obs; //
var detectionDistance = 0.obs; //
var realTimeMode = 0.obs; // 0 1
CatEyeWorkModeState() {
Map map = Get.arguments;
lockSetInfoData.value = map["lockSetInfoData"];
}
}

View File

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

View File

@ -1,5 +1,4 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert';
import 'dart:math'; import 'dart:math';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -7,6 +6,7 @@ import 'package:flutter_voice_processor/flutter_voice_processor.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:star_lock/talk/call/callTalk.dart'; import 'package:star_lock/talk/call/callTalk.dart';
import 'package:star_lock/talk/udp/udp_talkClass.dart';
import '../../../../talk/call/g711.dart'; import '../../../../talk/call/g711.dart';
import '../../../../talk/udp/udp_manage.dart'; import '../../../../talk/udp/udp_manage.dart';
@ -33,7 +33,7 @@ class LockMonitoringLogic extends BaseGetXController {
// //
Uint8List imageData = Uint8List.fromList(event.tvList); Uint8List imageData = Uint8List.fromList(event.tvList);
// //
state.listData.value = imageData; state.listPhotoData.value = imageData;
} }
}); });
} }
@ -42,40 +42,59 @@ class LockMonitoringLogic extends BaseGetXController {
StreamSubscription? _getUDPStatusRefreshUIEvent; StreamSubscription? _getUDPStatusRefreshUIEvent;
void _getUDPStatusRefreshUIAction() { void _getUDPStatusRefreshUIAction() {
_getUDPStatusRefreshUIEvent = _getUDPStatusRefreshUIEvent =
eventBus.on<GetUDPStatusRefreshUI>().listen((event) { eventBus.on<GetUDPStatusRefreshUI>().listen((event) async {
state.udpStatus.value = event.udpStatus; state.udpStatus.value = event.udpStatus;
if (state.udpStatus.value == 8) { state.oneMinuteTime.value = 0;
// 60
state.oneMinuteTimeTimer = // 退
Timer.periodic(const Duration(seconds: 1), (Timer t) async { if (state.udpStatus.value == 0 && UDPTalkClass().isEndCall == true) {
state.oneMinuteTime.value++;
// Get.log('state.oneMinuteTime.value:${state.oneMinuteTime.value}');
if (state.oneMinuteTime.value >= 60) {
// 60
state.oneMinuteTimeTimer.cancel(); state.oneMinuteTimeTimer.cancel();
state.oneMinuteTime.value = 0; state.oneMinuteTime.value = 0;
// return;
UDPSenderManage.sendMainProtocol( }
command: 150,
commandTypeIsCalling: 1,
subCommand: 30,
lockID: UDPManage().lockId,
lockIP: UDPManage().host,
userMobile: await state.userUid,
userMobileIP: await state.userMobileIP,
endData: []);
CallTalk().stopPcmSound(); //
// if (state.udpStatus.value == 8) {
Get.back(); state.oneMinuteTimeTimer.cancel(); //
state.oneMinuteTimeTimer =
Timer.periodic(const Duration(seconds: 1), (Timer t) {
state.oneMinuteTime.value++;
if (state.oneMinuteTime.value >= 60) {
t.cancel(); //
initiateUdpHangUpAction(); //
print('通话时间超过60秒自动挂断');
state.oneMinuteTime.value = 0;
} }
}); });
} }
}); });
} }
//
void initiateUdpAnswerAction() {
state.answerTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
udpAnswerAction();
state.answerSeconds++;
//
if (UDPTalkClass().status == 8) {
state.answerTimer.cancel(); //
return;
}
// 6
if (state.answerSeconds >= 6) {
state.answerTimer.cancel();
showToast("接听失败");
initiateUdpHangUpAction();
// UDPTalkClass().callNoAnswer();
}
});
}
/// ///
udpAnswerAction() async { udpAnswerAction() async {
print('点了接听么');
UDPSenderManage.sendMainProtocol( UDPSenderManage.sendMainProtocol(
command: 150, command: 150,
commandTypeIsCalling: 1, commandTypeIsCalling: 1,
@ -87,6 +106,27 @@ class LockMonitoringLogic extends BaseGetXController {
endData: []); endData: []);
} }
//
void initiateUdpHangUpAction() {
// udpHangUpAction
state.hangUpTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
state.hangUpSeconds++;
udpHangUpAction();
//
if (UDPTalkClass().isEndCall == true) {
state.hangUpTimer.cancel();
return;
}
// 6
if (state.hangUpSeconds >= 6) {
state.hangUpTimer.cancel(); //
UDPTalkClass().callNoAnswer();
}
});
}
/// ///
udpHangUpAction() async { udpHangUpAction() async {
UDPSenderManage.sendMainProtocol( UDPSenderManage.sendMainProtocol(
@ -100,6 +140,20 @@ class LockMonitoringLogic extends BaseGetXController {
endData: []); endData: []);
} }
//
void initiateUdpOpenDoorAction(List<int> list) {
// udpOpenDoorAction
state.openDoorTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
state.openDoorSeconds++;
udpOpenDoorAction(list);
// 6
if (state.openDoorSeconds >= 6) {
state.openDoorTimer.cancel(); //
}
});
}
/// ///
udpOpenDoorAction(List<int> list) async { udpOpenDoorAction(List<int> list) async {
UDPSenderManage.sendMainProtocol( UDPSenderManage.sendMainProtocol(
@ -406,6 +460,6 @@ class LockMonitoringLogic extends BaseGetXController {
state.oneMinuteTimeTimer.cancel(); state.oneMinuteTimeTimer.cancel();
} }
stopProcessing(); stopProcessing();
state.listData.value = Uint8List(0); state.listPhotoData.value = Uint8List(0);
} }
} }

View File

@ -1,8 +1,11 @@
import 'dart:async';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/talk/call/callTalk.dart'; import 'package:star_lock/talk/call/callTalk.dart';
import 'package:star_lock/talk/udp/udp_talkClass.dart';
import '../../../../app_settings/app_colors.dart'; import '../../../../app_settings/app_colors.dart';
import '../../../../login/selectCountryRegion/common/index.dart'; import '../../../../login/selectCountryRegion/common/index.dart';
@ -23,8 +26,11 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
initAsync();
}
requestMicrophonePermission(); Future<void> initAsync() async {
await requestMicrophonePermission();
} }
@override @override
@ -34,16 +40,23 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
height: 1.sh, height: 1.sh,
child: Stack( child: Stack(
children: [ children: [
Obx(() => state.listData.value.isEmpty Obx(() {
? Container(color: Colors.transparent) if (state.listPhotoData.value.isEmpty ||
: Image.memory( state.listPhotoData.value.length < 10) {
state.listData.value, return Container(color: Colors.transparent);
// key: ValueKey<int>(state.listData.value.hashCode), } else {
return Image.memory(
state.listPhotoData.value,
gaplessPlayback: true, gaplessPlayback: true,
width: 1.sw, width: 1.sw,
height: 1.sh, height: 1.sh,
fit: BoxFit.cover, fit: BoxFit.cover,
)), errorBuilder: (context, error, stackTrace) {
return Container(color: Colors.transparent);
},
);
}
}),
Positioned( Positioned(
top: ScreenUtil().statusBarHeight + 30.h, top: ScreenUtil().statusBarHeight + 30.h,
width: 1.sw, width: 1.sw,
@ -163,8 +176,15 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
return Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ return Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
// //
Obx(() => bottomBtnItemWidget( Obx(() => bottomBtnItemWidget(
getAnswerBtnImg(), getAnswerBtnName(), Colors.white, () async { state.isClickAnswer.value == true
logic.udpAnswerAction(); ? 'images/main/icon_lockDetail_monitoringUnTalkback.png'
: getAnswerBtnImg(),
state.isClickAnswer.value == true ? '长按说话' : getAnswerBtnName(),
Colors.white, () async {
if (state.isClickAnswer.value == false) {
logic.initiateUdpAnswerAction();
state.isClickAnswer.value = true;
}
}, longPress: () { }, longPress: () {
// //
print("onLongPress"); print("onLongPress");
@ -186,7 +206,15 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
logic.stopProcessing(); logic.stopProcessing();
CallTalk().stopPcmSound(); CallTalk().stopPcmSound();
// //
if (state.isClickHangUp.value == false) {
logic.initiateUdpHangUpAction();
state.isClickHangUp.value = true;
} else {
print('点了这里?');
state.isClickHangUp.value = false;
UDPTalkClass().stopLocalAudio();
logic.udpHangUpAction(); logic.udpHangUpAction();
}
}), }),
bottomBtnItemWidget("images/main/icon_lockDetail_monitoringUnlock.png", bottomBtnItemWidget("images/main/icon_lockDetail_monitoringUnlock.png",
"开锁", AppColors.mainColor, () { "开锁", AppColors.mainColor, () {
@ -298,7 +326,7 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
} }
// state.isSenderAudioData.value = false; // state.isSenderAudioData.value = false;
print("发送接听了"); // print("发送接听了");
// //
}); });
} }

View File

@ -16,10 +16,11 @@ class LockMonitoringState {
var userMobileIP = NetworkInfo().getWifiIP(); var userMobileIP = NetworkInfo().getWifiIP();
var userUid = Storage.getUid(); var userUid = Storage.getUid();
var udpStatus = 0.obs; //0 1 2 3 4 5 6 8 9 var udpStatus =
0.obs; //0 1 2 3 4 5 6 8 9
var passwordTF = TextEditingController(); var passwordTF = TextEditingController();
var listData = Uint8List(0).obs; // var listPhotoData = Uint8List(0).obs; //
var listAudioData = <int>[].obs; // var listAudioData = <int>[].obs; //
late final VoiceProcessor? voiceProcessor; late final VoiceProcessor? voiceProcessor;
@ -29,7 +30,14 @@ class LockMonitoringState {
var oneMinuteTime = 0.obs; // var oneMinuteTime = 0.obs; //
// 10 // 10
late Timer answerTimer; late Timer answerTimer = Timer(const Duration(seconds: 1), () {}); //
late Timer hangUpTimer; var answerSeconds = 0.obs;
late Timer openDoorTimer; var isClickAnswer = false.obs; //
late Timer hangUpTimer = Timer(const Duration(seconds: 1), () {}); //
var hangUpSeconds = 0.obs;
var isClickHangUp = false.obs; //
late Timer openDoorTimer = Timer(const Duration(seconds: 1), () {}); //
var openDoorSeconds = 0.obs;
} }

View File

@ -215,8 +215,7 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
SizedBox( SizedBox(
height: 160.h, height: 160.h,
), ),
// Google暂时屏蔽 F.isLite
F.appFlavor == Flavor.sky
? Container() ? Container()
: SubmitBtn( : SubmitBtn(
btnName: '演示模式', btnName: '演示模式',

View File

@ -0,0 +1,9 @@
import 'flavors.dart';
import 'main.dart' as runner;
Future<void> main() async {
F.appFlavor = Flavor.sky;
F.isLite = true;
await runner.main();
}

View File

@ -146,14 +146,14 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
Get.toNamed(Routers.mineSetPage); Get.toNamed(Routers.mineSetPage);
}), }),
// //
F.appFlavor == Flavor.sky F.isLite
? Container() ? Container()
: mineItem('images/mine/icon_mine_main_vip.png', : mineItem('images/mine/icon_mine_main_vip.png',
TranslationLoader.lanKeys!.valueAddedServices!.tr, () { TranslationLoader.lanKeys!.valueAddedServices!.tr, () {
Get.back(); Get.back();
Get.toNamed(Routers.valueAddedServicesPage); Get.toNamed(Routers.valueAddedServicesPage);
}), }),
F.appFlavor == Flavor.sky F.isLite
? Container() ? Container()
: mineItem( : mineItem(
'images/mine/icon_mine_main_shoppingcart.png', "配件商城".tr, () { 'images/mine/icon_mine_main_shoppingcart.png', "配件商城".tr, () {

View File

@ -204,7 +204,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
height: 10.h, height: 10.h,
), ),
// //
F.appFlavor == Flavor.sky F.isLite
? Container() ? Container()
: CommonItem( : CommonItem(
leftTitel: "Amazon Alexa", leftTitel: "Amazon Alexa",
@ -214,7 +214,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
action: () { action: () {
logic.showToast("功能暂未开放"); logic.showToast("功能暂未开放");
}), }),
F.appFlavor == Flavor.sky F.isLite
? Container() ? Container()
: CommonItem( : CommonItem(
leftTitel: "Google Home", leftTitel: "Google Home",
@ -224,7 +224,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
action: () { action: () {
logic.showToast("功能暂未开放"); logic.showToast("功能暂未开放");
}), }),
F.appFlavor == Flavor.sky F.isLite
? Container() ? Container()
: CommonItem( : CommonItem(
leftTitel: TranslationLoader.lanKeys!.xiaomiIOTPlatform!.tr, leftTitel: TranslationLoader.lanKeys!.xiaomiIOTPlatform!.tr,

View File

@ -180,4 +180,7 @@ abstract class Api {
final String deletMessageURL = '/notifications/delete'; // final String deletMessageURL = '/notifications/delete'; //
final String getVersionURL = '/app/getVersion'; // final String getVersionURL = '/app/getVersion'; //
final String updateCatEyeConfigURL =
'/lockSetting/updateCatEyeConfig'; //
} }

View File

@ -204,8 +204,17 @@ class ApiProvider extends BaseProvider {
'operatorUid': operatorUid, 'operatorUid': operatorUid,
})); }));
Future<Response> updateKeyDate(String keyId, String lockId, String endDate, Future<Response> updateKeyDate(
String startDate, List weekDays, int keyType, int startTime, int endTime, int isOnlyManageSelf, int remoteEnable) => String keyId,
String lockId,
String endDate,
String startDate,
List weekDays,
int keyType,
int startTime,
int endTime,
int isOnlyManageSelf,
int remoteEnable) =>
post( post(
updateKeyDateURL.toUrl, updateKeyDateURL.toUrl,
jsonEncode({ jsonEncode({
@ -226,8 +235,7 @@ class ApiProvider extends BaseProvider {
jsonEncode({'lockId': lockId, 'operatorUid': operatorUid})); jsonEncode({'lockId': lockId, 'operatorUid': operatorUid}));
Future<Response> lockRecordList( Future<Response> lockRecordList(
{ {required String endDate,
required String endDate,
required String keyId, required String keyId,
required String keyStatus, required String keyStatus,
required String lockId, required String lockId,
@ -240,8 +248,7 @@ class ApiProvider extends BaseProvider {
required String timezoneRawOffSet, required String timezoneRawOffSet,
required String keyboardPwdId, required String keyboardPwdId,
required String cardId, required String cardId,
required String fingerprintId required String fingerprintId}) =>
}) =>
post( post(
keyOperationRecordURL.toUrl, keyOperationRecordURL.toUrl,
jsonEncode({ jsonEncode({
@ -364,9 +371,15 @@ class ApiProvider extends BaseProvider {
})); }));
// //
Future<Response> deletOwnerKeyInfo(String lockId, String keyId, int includeUnderlings) => post( Future<Response> deletOwnerKeyInfo(
String lockId, String keyId, int includeUnderlings) =>
post(
deleteElectronicKeyURL.toUrl, deleteElectronicKeyURL.toUrl,
jsonEncode({'lockId': lockId, 'keyId': keyId, 'includeUnderlings': includeUnderlings})); jsonEncode({
'lockId': lockId,
'keyId': keyId,
'includeUnderlings': includeUnderlings
}));
// //
Future<Response> checkLoginPassword(String password) => post( Future<Response> checkLoginPassword(String password) => post(
@ -515,7 +528,8 @@ class ApiProvider extends BaseProvider {
setAppUnlockMustOnlineURL.toUrl, jsonEncode({'lockIdList': lockIdList})); setAppUnlockMustOnlineURL.toUrl, jsonEncode({'lockIdList': lockIdList}));
Future<Response> deleteElectronicKey(String keyId, int includeUnderlings) => Future<Response> deleteElectronicKey(String keyId, int includeUnderlings) =>
post(deleteElectronicKeyURL.toUrl, post(
deleteElectronicKeyURL.toUrl,
jsonEncode({ jsonEncode({
'keyId': keyId, 'keyId': keyId,
'includeUnderlings': includeUnderlings, 'includeUnderlings': includeUnderlings,
@ -538,35 +552,34 @@ class ApiProvider extends BaseProvider {
})); }));
// //
Future<Response> setAdministrator(String keyId) => Future<Response> setAdministrator(String keyId) => post(
post(setAuthorizeURL.toUrl, setAuthorizeURL.toUrl,
jsonEncode({ jsonEncode({
'keyId': keyId, 'keyId': keyId,
})); }));
// //
Future<Response> cancelAdministrator(String keyId) => Future<Response> cancelAdministrator(String keyId) => post(
post(cancelAuthorizeURL.toUrl, cancelAuthorizeURL.toUrl,
jsonEncode({ jsonEncode({
'keyId': keyId, 'keyId': keyId,
})); }));
// //
Future<Response> freezeKey(String keyId) => Future<Response> freezeKey(String keyId) => post(
post(freezeKeyURL.toUrl, freezeKeyURL.toUrl,
jsonEncode({ jsonEncode({
'keyId': keyId, 'keyId': keyId,
})); }));
// //
Future<Response> cancelFreeze(String keyId) => Future<Response> cancelFreeze(String keyId) => post(
post(cancelFreezeURL.toUrl, cancelFreezeURL.toUrl,
jsonEncode({ jsonEncode({
'keyId': keyId, 'keyId': keyId,
})); }));
Future<Response> expireLockList(String pageNo, String pageSize) => Future<Response> expireLockList(String pageNo, String pageSize) => post(
post(
expireLockListURL.toUrl, expireLockListURL.toUrl,
jsonEncode({ jsonEncode({
'pageNo': pageNo, 'pageNo': pageNo,
@ -1235,7 +1248,8 @@ class ApiProvider extends BaseProvider {
String changeType, String changeType,
int startTime, int startTime,
int endTime, int endTime,
int cardType,) => int cardType,
) =>
post( post(
editICCardURL.toUrl, editICCardURL.toUrl,
jsonEncode({ jsonEncode({
@ -1606,12 +1620,58 @@ class ApiProvider extends BaseProvider {
})); }));
// //
Future<Response> getVersionData(String brandName, String currentVersion) => post( Future<Response> getVersionData(String brandName, String currentVersion) =>
post(
getVersionURL.toUrl, getVersionURL.toUrl,
jsonEncode({ jsonEncode({
'brandName': brandName, 'brandName': brandName,
'currentVersion': currentVersion, 'currentVersion': currentVersion,
})); }));
//
Future<Response> updateCatEyeModeConfig(int lockId, Map catEyeConfig) => post(
updateCatEyeConfigURL.toUrl,
jsonEncode({
'lockId': lockId,
'catEyeConfig': catEyeConfig,
}));
//
Future<Response> updateAutoLightScreenConfig(
int lockId, int autoLightScreen) =>
post(
updateCatEyeConfigURL.toUrl,
jsonEncode({
'lockId': lockId,
'autoLightScreen': autoLightScreen,
}));
//
Future<Response> updateLightScreenTimeConfig(
int lockId, int autoLightScreenTime) =>
post(
updateCatEyeConfigURL.toUrl,
jsonEncode({
'lockId': lockId,
'autoLightScreenTime': autoLightScreenTime,
}));
//
Future<Response> updateStayWarnConfig(int lockId, int stayWarn) => post(
updateCatEyeConfigURL.toUrl,
jsonEncode({
'lockId': lockId,
'stayWarn': stayWarn,
}));
//
Future<Response> updateAbnormalWarnConfig(int lockId, int abnormalWarn) =>
post(
updateCatEyeConfigURL.toUrl,
jsonEncode({
'lockId': lockId,
'abnormalWarn': abnormalWarn,
}));
} }
extension ExtensionString on String { extension ExtensionString on String {

View File

@ -193,8 +193,7 @@ class ApiRepository {
//- //-
Future<KeyOperationRecordEntity> lockRecordList( Future<KeyOperationRecordEntity> lockRecordList(
{ {required String endDate,
required String endDate,
required String keyId, required String keyId,
required String keyStatus, required String keyStatus,
required String lockId, required String lockId,
@ -207,8 +206,7 @@ class ApiRepository {
required String timezoneRawOffSet, required String timezoneRawOffSet,
required String keyboardPwdId, required String keyboardPwdId,
required String cardId, required String cardId,
required String fingerprintId required String fingerprintId}) async {
}) async {
final res = await apiProvider.lockRecordList( final res = await apiProvider.lockRecordList(
endDate: endDate, endDate: endDate,
keyId: keyId, keyId: keyId,
@ -397,8 +395,11 @@ class ApiRepository {
// //
Future<LockListInfoEntity> deletOwnerKeyData( Future<LockListInfoEntity> deletOwnerKeyData(
{required String lockId, required String keyId, required int includeUnderlings}) async { {required String lockId,
final res = await apiProvider.deletOwnerKeyInfo(lockId, keyId, includeUnderlings); required String keyId,
required int includeUnderlings}) async {
final res =
await apiProvider.deletOwnerKeyInfo(lockId, keyId, includeUnderlings);
return LockListInfoEntity.fromJson(res.body); return LockListInfoEntity.fromJson(res.body);
} }
@ -586,7 +587,8 @@ class ApiRepository {
} }
// //
Future<ExpireLockListEntity> expireLockList(String pageNo, String pageSize) async { Future<ExpireLockListEntity> expireLockList(
String pageNo, String pageSize) async {
final res = await apiProvider.expireLockList(pageNo, pageSize); final res = await apiProvider.expireLockList(pageNo, pageSize);
return ExpireLockListEntity.fromJson(res.body); return ExpireLockListEntity.fromJson(res.body);
} }
@ -1201,8 +1203,18 @@ class ApiRepository {
required int startTime, required int startTime,
required int endTime, required int endTime,
required int fingerprintType}) async { required int fingerprintType}) async {
final res = await apiProvider.editFingerprintsData(fingerprintId, lockId, final res = await apiProvider.editFingerprintsData(
weekDay, startDate, endDate, isCoerced, fingerprintName, changeType, startTime, endTime, fingerprintType); fingerprintId,
lockId,
weekDay,
startDate,
endDate,
isCoerced,
fingerprintName,
changeType,
startTime,
endTime,
fingerprintType);
return LoginEntity.fromJson(res.body); return LoginEntity.fromJson(res.body);
} }
@ -1359,14 +1371,25 @@ class ApiRepository {
required int endTime, required int endTime,
required int cardRight, required int cardRight,
}) async { }) async {
final res = await apiProvider.addICCardData(lockId, endDate, cardName, final res = await apiProvider.addICCardData(
cardNumber, cardType, addType, startDate, isCoerced, weekDay, startTime, endTime, cardRight); lockId,
endDate,
cardName,
cardNumber,
cardType,
addType,
startDate,
isCoerced,
weekDay,
startTime,
endTime,
cardRight);
return AddICCardEntity.fromJson(res.body); return AddICCardEntity.fromJson(res.body);
} }
// IC卡 // IC卡
Future<LoginEntity> editICCardData( Future<LoginEntity> editICCardData({
{required String lockId, required String lockId,
required String cardId, required String cardId,
required String cardName, required String cardName,
required String startDate, required String startDate,
@ -1376,9 +1399,20 @@ class ApiRepository {
required String changeType, required String changeType,
required int startTime, required int startTime,
required int endTime, required int endTime,
required int cardType,}) async { required int cardType,
final res = await apiProvider.editICCardData(lockId, cardId, cardName, }) async {
startDate, endDate, isCoerced, weekDay, changeType, startTime, endTime, cardType); final res = await apiProvider.editICCardData(
lockId,
cardId,
cardName,
startDate,
endDate,
isCoerced,
weekDay,
changeType,
startTime,
endTime,
cardType);
return LoginEntity.fromJson(res.body); return LoginEntity.fromJson(res.body);
} }
@ -1629,11 +1663,47 @@ class ApiRepository {
} }
// //
Future<VersionUndateEntity> getVersionData({ Future<VersionUndateEntity> getVersionData(
required String brandName, {required String brandName, required String currentVersion}) async {
required String currentVersion
}) async {
final res = await apiProvider.getVersionData(brandName, currentVersion); final res = await apiProvider.getVersionData(brandName, currentVersion);
return VersionUndateEntity.fromJson(res.body); return VersionUndateEntity.fromJson(res.body);
} }
//
Future<VersionUndateEntity> updateCatEyeModeConfig(
{required int lockId, required Map catEyeConfig}) async {
final res = await apiProvider.updateCatEyeModeConfig(lockId, catEyeConfig);
return VersionUndateEntity.fromJson(res.body);
}
//
Future<VersionUndateEntity> updateAutoLightScreenConfig(
{required int lockId, required int autoLightScreen}) async {
final res =
await apiProvider.updateAutoLightScreenConfig(lockId, autoLightScreen);
return VersionUndateEntity.fromJson(res.body);
}
//
Future<VersionUndateEntity> updateLightScreenTimeConfig(
{required int lockId, required int autoLightScreenTime}) async {
final res = await apiProvider.updateLightScreenTimeConfig(
lockId, autoLightScreenTime);
return VersionUndateEntity.fromJson(res.body);
}
//
Future<VersionUndateEntity> updateStayWarnConfig(
{required int lockId, required int stayWarn}) async {
final res = await apiProvider.updateStayWarnConfig(lockId, stayWarn);
return VersionUndateEntity.fromJson(res.body);
}
//
Future<VersionUndateEntity> updateAbnormalWarnConfig(
{required int lockId, required int abnormalWarn}) async {
final res =
await apiProvider.updateAbnormalWarnConfig(lockId, abnormalWarn);
return VersionUndateEntity.fromJson(res.body);
}
} }

View File

@ -17,9 +17,7 @@ class CallTalk {
static int ABUF_NUM = 100; static int ABUF_NUM = 100;
static int FIRSTINDEX = 1; static int FIRSTINDEX = 1;
int status = 0; //
IframeInfo? iframe; // IframeInfo? iframe; //
bool getFirstFrame = false; //
List<int> allDataBytes = <int>[]; // List<int> allDataBytes = <int>[]; //
CallTalk._init() { CallTalk._init() {
@ -73,12 +71,7 @@ class CallTalk {
// print('获取帧序号 getIframeIndex$getIframeIndex'); // print('获取帧序号 getIframeIndex$getIframeIndex');
// 65 // 65
// int alen = bb[POS_alen] & 0xff; int alen = bb[POS_alen] + bb[POS_alen + 1] * 256;
// var alenList = bb.sublist(POS_alen, POS_alen + 4);
// int alen = ((0xff & alenList[(0)]) << 24 |
// (0xff & alenList[1]) << 16 |
// (0xff & alenList[2]) << 8 |
// (0xFF & alenList[3]));
// print('获取帧长度 alen$alen'); // print('获取帧长度 alen$alen');
// 71 // 71
@ -96,7 +89,7 @@ class CallTalk {
iframe = IframeInfo(); iframe = IframeInfo();
iframe!.iframeIndex = getIframeIndex; iframe!.iframeIndex = getIframeIndex;
iframe!.bagNum = getBagNum; iframe!.bagNum = getBagNum;
// iframe!.cur_len = alen; iframe!.cur_len = alen;
iframe!.bb = []; iframe!.bb = [];
// growableList = iframe!.bb!.toList(growable: true); // growableList = iframe!.bb!.toList(growable: true);
} }
@ -105,15 +98,19 @@ class CallTalk {
// //
if (getIframeIndex == iframe!.iframeIndex) { if (getIframeIndex == iframe!.iframeIndex) {
var getList = bb.sublist(77, bb.length); var getList = bb.sublist(POS_data, bb.length);
iframe!.bb!.addAll(getList); 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) { if (iframe!.bagNum == iframe!.bagReceive) {
// print('播放第${iframe!.iframeIndex}帧 一帧图片的hexStringData: ${Uint8List.fromList(growableList)}'); // print('播放第${iframe!.iframeIndex}帧 一帧图片的hexStringData: ${Uint8List.fromList(growableList)}');
// print('得到的一张图片的数据长度为${iframe!.bb!.length}');
eventBus.fire(GetTVDataRefreshUI(iframe!.bb!)); eventBus.fire(GetTVDataRefreshUI(iframe!.bb!));
} else {
// print('接收到的包数不等于总包数');
} }
} }
} }

View File

@ -1,7 +1,5 @@
import 'dart:typed_data';
class IframeInfo { class IframeInfo {
int iframeIndex = -1; int iframeIndex = 0;
int iframeTime = 0; int iframeTime = 0;
int bagNum = 0; int bagNum = 0;
int bagReceive = 1; int bagReceive = 1;
@ -12,7 +10,7 @@ class IframeInfo {
int codecMode = 0; int codecMode = 0;
IframeInfo() { IframeInfo() {
iframeIndex = -1; iframeIndex = 0;
bagNum = 0; bagNum = 0;
bagReceive = 0; bagReceive = 0;
isFull = false; isFull = false;

View File

@ -2,6 +2,8 @@ import 'dart:typed_data';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/monitoring/monitoring/lockMonitoring_logic.dart';
import 'package:star_lock/main/lockDetail/monitoring/monitoring/lockMonitoring_state.dart';
import 'package:star_lock/talk/udp/udp_manage.dart'; import 'package:star_lock/talk/udp/udp_manage.dart';
import '../../blue/io_tool/io_tool.dart'; import '../../blue/io_tool/io_tool.dart';
@ -66,6 +68,7 @@ class CommandUDPReciverManager {
// //
UDPTalkClass().stopLocalAudio(); UDPTalkClass().stopLocalAudio();
eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status)); eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
print('接听反馈刷新UI1');
} }
} }
break; break;
@ -117,6 +120,7 @@ class CommandUDPReciverManager {
CallTalk().stopPcmSound(); CallTalk().stopPcmSound();
eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status)); eventBus.fire(GetUDPStatusRefreshUI(UDPTalkClass().status));
Get.back(); Get.back();
print('挂断反馈刷新UI1');
} }
break; break;
case 140: case 140:

View File

@ -1,8 +1,10 @@
import 'dart:async'; import 'dart:async';
import 'package:audioplayers/audioplayers.dart'; import 'package:audioplayers/audioplayers.dart';
import 'package:fast_gbk/fast_gbk.dart'; import 'package:fast_gbk/fast_gbk.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/main/lockDetail/monitoring/monitoring/lockMonitoring_logic.dart'; import 'package:star_lock/main/lockDetail/monitoring/monitoring/lockMonitoring_logic.dart';
import 'package:star_lock/main/lockDetail/monitoring/monitoring/lockMonitoring_state.dart';
import 'package:star_lock/talk/call/callTalk.dart'; import 'package:star_lock/talk/call/callTalk.dart';
import '../../appRouters.dart'; import '../../appRouters.dart';
import '../../tools/storage.dart'; import '../../tools/storage.dart';
@ -27,7 +29,11 @@ class UDPTalkClass {
late Timer timer; late Timer timer;
// 退 // 退
var isBeCall = false; var isBeCall = false;
var isEndCall = false; //
final audioPlayer = AudioPlayer(); final audioPlayer = AudioPlayer();
var playLocalAudioSecond = 0;
Timer playLocalAudioTimer =
Timer.periodic(const Duration(seconds: 1), (timer) {});
beCallW({List<int>? data, String? ip, int? port}) async { beCallW({List<int>? data, String? ip, int? port}) async {
print("beCall status:$status"); print("beCall status:$status");
@ -70,17 +76,46 @@ class UDPTalkClass {
Get.toNamed(Routers.lockMonitoringPage, arguments: {"lockId": "111"}); Get.toNamed(Routers.lockMonitoringPage, arguments: {"lockId": "111"});
} }
Timer(const Duration(minutes: 1), () {
stopLocalAudio();
callNoAnswer();
});
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();
_showNotification(flutterLocalNotificationsPlugin);
playLocalAudio(); playLocalAudio();
if (isEndCall == true) {
print('已经结束对讲');
return;
}
playLocalAudioTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
playLocalAudioSecond++;
// 60
if (playLocalAudioSecond >= 60) {
playLocalAudioTimer.cancel(); //
LockMonitoringLogic().initiateUdpHangUpAction();
}
});
} else { } else {
// //
} }
} }
//
Future<void> _showNotification(
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin) async {
const AndroidNotificationDetails androidPlatformChannelSpecifics =
AndroidNotificationDetails('1', 'flutter_channel',
importance: Importance.max,
priority: Priority.high,
playSound: true,
ticker: 'ticker');
const NotificationDetails platformChannelSpecifics =
NotificationDetails(android: androidPlatformChannelSpecifics);
var getLockName = await Storage.getString(saveLockAlias);
await flutterLocalNotificationsPlugin.show(
0, '呼叫提醒', '收到来自($getLockName)锁的呼叫。', platformChannelSpecifics,
payload: 'item x');
}
// call的本人 // call的本人
Future<bool> isCallMe(List<int>? data) async { Future<bool> isCallMe(List<int>? data) async {
final loginData = await Storage.getLoginData(); final loginData = await Storage.getLoginData();
@ -136,10 +171,13 @@ class UDPTalkClass {
// //
void callNoAnswer() { void callNoAnswer() {
// print('无应答处理');
stopLocalAudio();
status = 0;
isBeCall = false;
isEndCall = true;
LockMonitoringState().isClickHangUp.value = false;
CallTalk().stopPcmSound(); CallTalk().stopPcmSound();
//
LockMonitoringLogic().udpHangUpAction();
//
Get.back(); Get.back();
} }
} }

View File

@ -6,7 +6,6 @@ import 'dart:convert';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import '../login/login/entity/LoginData.dart'; import '../login/login/entity/LoginData.dart';
import '../login/login/entity/LoginEntity.dart';
const saveBluePublicKey = "BluePublicKey"; const saveBluePublicKey = "BluePublicKey";
const saveBluePrivateKey = "BluePrivateKey"; const saveBluePrivateKey = "BluePrivateKey";
@ -20,6 +19,7 @@ const isAgreePosition = "isAgreePosition"; //是否同意获取位置弹窗
const isAgreeCamera = "isAgreeCamera"; /// const isAgreeCamera = "isAgreeCamera"; ///
const isShowUpdateVersion = "isShowUpdateVersion"; // const isShowUpdateVersion = "isShowUpdateVersion"; //
const saveLockAlias = "saveLockAlias"; //
const saveUserLoginData = "userLoginData"; const saveUserLoginData = "userLoginData";

View File

@ -15,7 +15,7 @@ class XSJPushProvider {
appKey: "7ff37d174c1a568a89e98dad", appKey: "7ff37d174c1a568a89e98dad",
channel: "flutter_channel", channel: "flutter_channel",
production: false, production: false,
debug: true, debug: false,
); );
jpush.addEventHandler( jpush.addEventHandler(

View File

@ -22,7 +22,8 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# 1.0.18+2024032002修复注册页布局错乱修复第二次才可以删除锁的问题修改申请权限字符串 # 1.0.18+2024032002修复注册页布局错乱修复第二次才可以删除锁的问题修改申请权限字符串
# 1.0.18+20240321(2024032101):打包给欧阳测试 # 1.0.18+20240321(2024032101):打包给欧阳测试
# 1.0.20+2024032102修复Apple Store App Tracking Transparency权限问题 # 1.0.20+2024032102修复Apple Store App Tracking Transparency权限问题
version: 1.0.20+2024032102 # 1.0.21+2024032801同为斯凯环境也区分删减版和完整版通过main_sky_lite.dart/main_sky_full.dart切换
version: 1.0.21+2024032801
environment: environment:
sdk: '>=2.12.0 <3.0.0' sdk: '>=2.12.0 <3.0.0'