Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
f8a989939b
@ -1,17 +1,13 @@
|
|||||||
// import 'package:aliyun_push/aliyun_push.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.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:jpush_flutter/jpush_flutter.dart';
|
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:star_lock/flavors.dart';
|
import 'package:star_lock/flavors.dart';
|
||||||
import 'package:star_lock/tools/app_manager.dart';
|
import 'package:star_lock/tools/app_manager.dart';
|
||||||
import 'package:star_lock/tools/bindings/app_binding.dart';
|
import 'package:star_lock/tools/bindings/app_binding.dart';
|
||||||
import 'package:star_lock/tools/storage.dart';
|
import 'package:star_lock/tools/xs_jPhush.dart';
|
||||||
// import 'package:star_lock/tools/storage.dart';
|
|
||||||
// import 'package:star_lock/tools/xs_aliyunPush.dart';
|
|
||||||
|
|
||||||
import 'package:star_lock/translations/app_dept.dart';
|
import 'package:star_lock/translations/app_dept.dart';
|
||||||
import 'package:star_lock/translations/trans_lib.dart';
|
import 'package:star_lock/translations/trans_lib.dart';
|
||||||
@ -32,8 +28,6 @@ class MyApp extends StatefulWidget {
|
|||||||
// final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>();
|
// final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>();
|
||||||
|
|
||||||
class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
||||||
final JPush jpush = JPush();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ScreenUtilInit(
|
return ScreenUtilInit(
|
||||||
@ -106,7 +100,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
|||||||
super.initState();
|
super.initState();
|
||||||
WidgetsBinding.instance.addObserver(this);
|
WidgetsBinding.instance.addObserver(this);
|
||||||
|
|
||||||
initJPushService();
|
XSJPushProvider().initJPushService();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -114,43 +108,6 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
|||||||
WidgetsBinding.instance.removeObserver(this);
|
WidgetsBinding.instance.removeObserver(this);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> initJPushService() async {
|
|
||||||
final data = await Storage.getString(saveUserLoginData);
|
|
||||||
if (data != null && data.isNotEmpty) {
|
|
||||||
jpush.setup(
|
|
||||||
appKey: "7ff37d174c1a568a89e98dad",
|
|
||||||
channel: "flutter_channel",
|
|
||||||
production: false,
|
|
||||||
debug: true,
|
|
||||||
);
|
|
||||||
|
|
||||||
jpush.addEventHandler(
|
|
||||||
// 接收通知回调方法。
|
|
||||||
onReceiveNotification: (Map<String, dynamic> message) async {
|
|
||||||
print("flutter onReceiveNotification: $message");
|
|
||||||
},
|
|
||||||
// 点击通知回调方法。
|
|
||||||
onOpenNotification: (Map<String, dynamic> message) async {
|
|
||||||
print("flutter onOpenNotification: $message");
|
|
||||||
},
|
|
||||||
// 接收自定义消息回调方法。
|
|
||||||
onReceiveMessage: (Map<String, dynamic> message) async {
|
|
||||||
print("flutter onReceiveMessage: $message");
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
jpush.applyPushAuthority(
|
|
||||||
const NotificationSettingsIOS(sound: true, alert: true, badge: true));
|
|
||||||
// jpush.setChannelAndSound(
|
|
||||||
// channel: "flutter_channel", channelID: "115700", sound: "default");
|
|
||||||
|
|
||||||
// Platform messages may fail, so we use a try/catch PlatformException.
|
|
||||||
jpush.getRegistrationID().then((rid) {
|
|
||||||
print("flutter get registration id : $rid");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void openBlueScan() {
|
void openBlueScan() {
|
||||||
|
|||||||
@ -716,7 +716,8 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
// arguments: {"keyInfo": state.keyInfos.value});
|
// arguments: {"keyInfo": state.keyInfos.value});
|
||||||
// })
|
// })
|
||||||
|
|
||||||
var endWiddget = [
|
var endWiddget = <Widget>[];
|
||||||
|
endWiddget.add(
|
||||||
// 操作记录
|
// 操作记录
|
||||||
bottomItem(
|
bottomItem(
|
||||||
'images/main/icon_main_operatingRecord.png',
|
'images/main/icon_main_operatingRecord.png',
|
||||||
@ -728,15 +729,19 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
Get.toNamed(Routers.doorLockLogPage,
|
Get.toNamed(Routers.doorLockLogPage,
|
||||||
arguments: {"keyInfo": state.keyInfos.value});
|
arguments: {"keyInfo": state.keyInfos.value});
|
||||||
}),
|
}),
|
||||||
// 视频日志
|
);
|
||||||
bottomItem(
|
|
||||||
|
if (state.keyInfos.value.lockFeature!.d3Face == 1) {
|
||||||
|
//视频日志
|
||||||
|
endWiddget.add(bottomItem(
|
||||||
'images/main/icon_lockDetail_videoLog.png',
|
'images/main/icon_lockDetail_videoLog.png',
|
||||||
TranslationLoader.lanKeys!.videoLog!.tr,
|
TranslationLoader.lanKeys!.videoLog!.tr,
|
||||||
state.openDoorBtnisUneable.value,
|
state.openDoorBtnisUneable.value,
|
||||||
state.bottomBtnisEable.value, () {
|
state.bottomBtnisEable.value, () {
|
||||||
//视频日志
|
|
||||||
Get.toNamed(Routers.videoLogPage);
|
Get.toNamed(Routers.videoLogPage);
|
||||||
}),
|
}));
|
||||||
|
}
|
||||||
|
endWiddget.add(
|
||||||
// 消息提醒
|
// 消息提醒
|
||||||
bottomItem(
|
bottomItem(
|
||||||
'images/main/icon_lockDetail_messageReminding.png',
|
'images/main/icon_lockDetail_messageReminding.png',
|
||||||
@ -745,6 +750,9 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
state.bottomBtnisEable.value, () {
|
state.bottomBtnisEable.value, () {
|
||||||
Get.toNamed(Routers.msgNotificationPage);
|
Get.toNamed(Routers.msgNotificationPage);
|
||||||
}),
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
endWiddget.add(
|
||||||
// 设置
|
// 设置
|
||||||
bottomItem(
|
bottomItem(
|
||||||
'images/main/icon_main_set.png',
|
'images/main/icon_main_set.png',
|
||||||
@ -757,7 +765,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
|||||||
"isOnlyOneData": state.isOnlyOneData,
|
"isOnlyOneData": state.isOnlyOneData,
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
];
|
);
|
||||||
showWidgetArr.addAll(endWiddget);
|
showWidgetArr.addAll(endWiddget);
|
||||||
return showWidgetArr;
|
return showWidgetArr;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,6 +20,13 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
|||||||
final logic = Get.put(LockMonitoringLogic());
|
final logic = Get.put(LockMonitoringLogic());
|
||||||
final state = Get.find<LockMonitoringLogic>().state;
|
final state = Get.find<LockMonitoringLogic>().state;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
|
||||||
|
requestMicrophonePermission();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
@ -155,18 +162,9 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
|||||||
Widget bottomBottomBtnWidget() {
|
Widget bottomBottomBtnWidget() {
|
||||||
return Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
|
return Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
|
||||||
// 接听
|
// 接听
|
||||||
Obx(() => bottomBtnItemWidget(getAnswerBtnImg(), getAnswerBtnName(), Colors.white, () async {
|
Obx(() => bottomBtnItemWidget(
|
||||||
//获取麦克风权限
|
getAnswerBtnImg(), getAnswerBtnName(), Colors.white, () async {
|
||||||
await logic.getPermissionStatus().then((value) async {
|
logic.udpAnswerAction();
|
||||||
if (!value) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// state.isSenderAudioData.value = false;
|
|
||||||
print("发送接听了");
|
|
||||||
// 刚进来是接听状态,然后改为长按对讲
|
|
||||||
logic.udpAnswerAction();
|
|
||||||
});
|
|
||||||
}, longPress: () {
|
}, longPress: () {
|
||||||
// 开始长按
|
// 开始长按
|
||||||
print("onLongPress");
|
print("onLongPress");
|
||||||
@ -292,6 +290,19 @@ class _LockMonitoringPageState extends State<LockMonitoringPage> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//获取麦克风权限
|
||||||
|
Future requestMicrophonePermission() async {
|
||||||
|
await logic.getPermissionStatus().then((value) async {
|
||||||
|
if (!value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// state.isSenderAudioData.value = false;
|
||||||
|
print("发送接听了");
|
||||||
|
// 刚进来是接听状态,然后改为长按对讲
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||||
|
|
||||||
@ -14,27 +13,27 @@ import 'lockMain_state.dart';
|
|||||||
class LockMainLogic extends BaseGetXController {
|
class LockMainLogic extends BaseGetXController {
|
||||||
final LockMainState state = LockMainState();
|
final LockMainState state = LockMainState();
|
||||||
|
|
||||||
Future<LockListInfoEntity> getStarLockInfo() async{
|
Future<LockListInfoEntity> getStarLockInfo() async {
|
||||||
LockListInfoEntity entity = await ApiRepository.to.getStarLockListInfo(
|
LockListInfoEntity entity = await ApiRepository.to.getStarLockListInfo(
|
||||||
pageNo:pageNo,
|
pageNo: pageNo,
|
||||||
pageSize:50,
|
pageSize: 50,
|
||||||
);
|
);
|
||||||
if(entity.errorCode!.codeIsSuccessful){
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
if(entity.data!.groupList!.isEmpty){
|
if (entity.data!.groupList!.isEmpty) {
|
||||||
state.dataLength.value = 0;
|
state.dataLength.value = 0;
|
||||||
}else if(entity.data!.groupList!.length == 1){
|
} else if (entity.data!.groupList!.length == 1) {
|
||||||
GroupList groupList = entity.data!.groupList![0];
|
GroupList groupList = entity.data!.groupList![0];
|
||||||
if(groupList.lockList!.length > 1){
|
if (groupList.lockList!.length > 1) {
|
||||||
state.dataLength.value = 2;
|
state.dataLength.value = 2;
|
||||||
}else{
|
} else {
|
||||||
state.dataLength.value = 1;
|
state.dataLength.value = 1;
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
state.dataLength.value = 2;
|
state.dataLength.value = 2;
|
||||||
}
|
}
|
||||||
state.lockListInfoEntity.value = entity;
|
state.lockListInfoEntity.value = entity;
|
||||||
// return entity.data!;
|
// return entity.data!;
|
||||||
}else{
|
} else {
|
||||||
print("首页锁列表请求失败");
|
print("首页锁列表请求失败");
|
||||||
state.dataLength.value = 0;
|
state.dataLength.value = 0;
|
||||||
}
|
}
|
||||||
@ -70,7 +69,8 @@ class LockMainLogic extends BaseGetXController {
|
|||||||
connectListener() async {
|
connectListener() async {
|
||||||
Connectivity().onConnectivityChanged.listen((ConnectivityResult result) {
|
Connectivity().onConnectivityChanged.listen((ConnectivityResult result) {
|
||||||
print("设置网络切换监听:$result");
|
print("设置网络切换监听:$result");
|
||||||
if(state.networkConnectionStatus.value == 0 && result != ConnectivityResult.none){
|
if (state.networkConnectionStatus.value == 0 &&
|
||||||
|
result != ConnectivityResult.none) {
|
||||||
// 从无网络到有网络
|
// 从无网络到有网络
|
||||||
state.networkConnectionStatus.value = 1;
|
state.networkConnectionStatus.value = 1;
|
||||||
getStarLockInfo();
|
getStarLockInfo();
|
||||||
@ -85,7 +85,7 @@ class LockMainLogic extends BaseGetXController {
|
|||||||
print("onReady()");
|
print("onReady()");
|
||||||
|
|
||||||
// 开启UDP
|
// 开启UDP
|
||||||
// UdpHelp().openUDP();
|
UdpHelp().openUDP();
|
||||||
|
|
||||||
BlueManage();
|
BlueManage();
|
||||||
}
|
}
|
||||||
@ -112,5 +112,4 @@ class LockMainLogic extends BaseGetXController {
|
|||||||
// _teamEvent.cancel();
|
// _teamEvent.cancel();
|
||||||
// state.timer.cancel();
|
// state.timer.cancel();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import 'dart:ffi';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -32,6 +33,8 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
|
|||||||
super.initState();
|
super.initState();
|
||||||
WidgetsBinding.instance.addObserver(this); // 添加观察者
|
WidgetsBinding.instance.addObserver(this); // 添加观察者
|
||||||
logic.getUserInfoRequest();
|
logic.getUserInfoRequest();
|
||||||
|
_checkCameraPermission();
|
||||||
|
_checkPhotoPermission();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -40,15 +43,15 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当应用生命周期状态变化时调用
|
// // 当应用生命周期状态变化时调用
|
||||||
@override
|
// @override
|
||||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
// void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||||
super.didChangeAppLifecycleState(state);
|
// super.didChangeAppLifecycleState(state);
|
||||||
if (state == AppLifecycleState.resumed) {
|
// if (state == AppLifecycleState.resumed) {
|
||||||
// 当应用从后台返回前台时检查相机权限
|
// // 当应用从后台返回前台时检查相机权限
|
||||||
checkCameraPermission();
|
// checkCameraPermission();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -193,34 +196,58 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> requestCameraPermission() async {
|
// Future<void> requestCameraPermission() async {
|
||||||
var status = await Permission.camera.status;
|
// var status = await Permission.camera.status;
|
||||||
|
// if (status.isGranted) {
|
||||||
|
// selectCamera();
|
||||||
|
// } else {
|
||||||
|
// status = await Permission.camera.request();
|
||||||
|
// if (status.isGranted) {
|
||||||
|
// selectCamera();
|
||||||
|
// } else {
|
||||||
|
// showPermissionDeniedDialog();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
Future<void> _requestCameraPermission() async {
|
||||||
|
var status = await Permission.camera.request();
|
||||||
if (status.isGranted) {
|
if (status.isGranted) {
|
||||||
selectCamera();
|
setState(() {
|
||||||
|
state.hasCameraPermission.value = true; // 如果权限被授予,更新状态变量
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
status = await Permission.camera.request();
|
// 如果权限被拒绝,你可以选择在这里处理相应逻辑,比如显示一个提示框
|
||||||
if (status.isGranted) {
|
showPermissionDeniedDialog();
|
||||||
selectCamera();
|
|
||||||
} else {
|
|
||||||
showPermissionDeniedDialog();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> requestPhotoPermission() async {
|
Future<void> _requestPhotoPermission() async {
|
||||||
var status = await Permission.photos.status;
|
var status = await Permission.photos.request();
|
||||||
if (status.isGranted) {
|
if (status.isGranted) {
|
||||||
selectImage();
|
setState(() {
|
||||||
|
state.hasPhotoPermission.value = true; // 如果权限被授予,更新状态变量
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
status = await Permission.photos.request();
|
// 如果权限被拒绝,你可以选择在这里处理相应逻辑,比如显示一个提示框
|
||||||
if (status.isGranted) {
|
showPermissionDeniedDialog();
|
||||||
selectImage();
|
|
||||||
} else {
|
|
||||||
showPermissionDeniedDialog();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Future<void> requestPhotoPermission() async {
|
||||||
|
// var status = await Permission.photos.status;
|
||||||
|
// if (status.isGranted) {
|
||||||
|
// selectImage();
|
||||||
|
// } else {
|
||||||
|
// status = await Permission.photos.request();
|
||||||
|
// if (status.isGranted) {
|
||||||
|
// selectImage();
|
||||||
|
// } else {
|
||||||
|
// showPermissionDeniedDialog();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
// 显示权限被永久拒绝的提示对话框
|
// 显示权限被永久拒绝的提示对话框
|
||||||
void showPermissionDeniedDialog() {
|
void showPermissionDeniedDialog() {
|
||||||
showDialog(
|
showDialog(
|
||||||
@ -256,11 +283,13 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
|
|||||||
int getSelectIndex = value;
|
int getSelectIndex = value;
|
||||||
if (getSelectIndex == 0) {
|
if (getSelectIndex == 0) {
|
||||||
//拍照选项
|
//拍照选项
|
||||||
// selectCamera();
|
state.hasCameraPermission.value == true
|
||||||
requestCameraPermission();
|
? selectCamera()
|
||||||
|
: _requestCameraPermission();
|
||||||
} else if (getSelectIndex == 1) {
|
} else if (getSelectIndex == 1) {
|
||||||
// selectImage();
|
state.hasPhotoPermission.value == true
|
||||||
requestPhotoPermission();
|
? selectImage()
|
||||||
|
: _requestPhotoPermission();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -297,41 +326,29 @@ class _MinePersonInfoPageState extends State<MinePersonInfoPage>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> checkCameraPermission() async {
|
Future<void> _checkCameraPermission() async {
|
||||||
var status = await Permission.camera.status;
|
var status = await Permission.camera.status;
|
||||||
if (status.isGranted) {
|
if (status.isGranted) {
|
||||||
// 如果权限已经被授予,打开相机
|
setState(() {
|
||||||
} else if (status.isPermanentlyDenied || status.isDenied) {
|
state.hasCameraPermission.value = true; // 如果权限已经被授予,更新状态变量
|
||||||
// 如果权限被永久拒绝,显示对话框引导用户去设置页面
|
});
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
state.hasCameraPermission.value = false; // 如果权限未被授予,更新状态变量
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> checkPhotosPermission() async {
|
Future<void> _checkPhotoPermission() async {
|
||||||
var status = await Permission.photos.status;
|
var status = await Permission.photos.status;
|
||||||
if (status.isGranted) {
|
if (status.isGranted) {
|
||||||
// 如果权限已经被授予,打开相机
|
setState(() {
|
||||||
} else if (status.isPermanentlyDenied || status.isDenied) {
|
state.hasPhotoPermission.value = true; // 如果权限已经被授予,更新状态变量
|
||||||
// 如果权限被永久拒绝,显示对话框引导用户去设置页面
|
});
|
||||||
|
} else {
|
||||||
|
setState(() {
|
||||||
|
state.hasPhotoPermission.value = false; // 如果权限未被授予,更新状态变量
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// child: state.mineInfoData.value.headUrl != null
|
|
||||||
// ? CachedNetworkImage(
|
|
||||||
// imageUrl: Uri.encodeFull(
|
|
||||||
// state.mineInfoData.value.headUrl!),
|
|
||||||
// width: 72.w,
|
|
||||||
// height: 72.w,
|
|
||||||
// fit: BoxFit.fill,
|
|
||||||
// placeholder: (context, url) => Image.asset(
|
|
||||||
// 'images/controls_user.png',
|
|
||||||
// width: 72.w,
|
|
||||||
// height: 72.w,
|
|
||||||
// fit: BoxFit.fill,
|
|
||||||
// ))
|
|
||||||
// : Image.asset(
|
|
||||||
// 'images/controls_user.png',
|
|
||||||
// width: 72.w,
|
|
||||||
// height: 72.w,
|
|
||||||
// fit: BoxFit.fill,
|
|
||||||
// ),
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,4 +12,7 @@ class MinePersonInfoState {
|
|||||||
List<XFile>? imageList;
|
List<XFile>? imageList;
|
||||||
// 使用ImagePicker前必须先实例化
|
// 使用ImagePicker前必须先实例化
|
||||||
final ImagePicker imagePicker = ImagePicker();
|
final ImagePicker imagePicker = ImagePicker();
|
||||||
|
|
||||||
|
var hasPhotoPermission = false.obs; //是否有相册权限
|
||||||
|
var hasCameraPermission = false.obs; //是否有相机权限
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,8 @@ 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:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:star_lock/main/lockDetail/monitoring/monitoring/lockMonitoring_logic.dart';
|
||||||
|
import 'package:star_lock/talk/call/callTalk.dart';
|
||||||
import '../../appRouters.dart';
|
import '../../appRouters.dart';
|
||||||
import '../../tools/storage.dart';
|
import '../../tools/storage.dart';
|
||||||
import 'udp_manage.dart';
|
import 'udp_manage.dart';
|
||||||
@ -68,6 +70,10 @@ class UDPTalkClass {
|
|||||||
|
|
||||||
Get.toNamed(Routers.lockMonitoringPage, arguments: {"lockId": "111"});
|
Get.toNamed(Routers.lockMonitoringPage, arguments: {"lockId": "111"});
|
||||||
}
|
}
|
||||||
|
Timer(const Duration(minutes: 1), () {
|
||||||
|
stopLocalAudio();
|
||||||
|
callNoAnswer();
|
||||||
|
});
|
||||||
|
|
||||||
playLocalAudio();
|
playLocalAudio();
|
||||||
} else {
|
} else {
|
||||||
@ -127,4 +133,13 @@ class UDPTalkClass {
|
|||||||
audioPlayer.setReleaseMode(ReleaseMode.loop);
|
audioPlayer.setReleaseMode(ReleaseMode.loop);
|
||||||
await audioPlayer.stop();
|
await audioPlayer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//呼叫有响铃无应答处理
|
||||||
|
void callNoAnswer() {
|
||||||
|
CallTalk().stopPcmSound();
|
||||||
|
// 挂断
|
||||||
|
LockMonitoringLogic().udpHangUpAction();
|
||||||
|
// 关闭当前界面
|
||||||
|
Get.back();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,137 +0,0 @@
|
|||||||
/*
|
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:aliyun_push/aliyun_push.dart';
|
|
||||||
import 'package:star_lock/flavors.dart';
|
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
|
||||||
|
|
||||||
class XSAliyunPushProvider {
|
|
||||||
late AliyunPush _aliyunPush = AliyunPush();
|
|
||||||
|
|
||||||
Future<void> init(AliyunPush aliyunPush) async {
|
|
||||||
_aliyunPush = aliyunPush;
|
|
||||||
if (Platform.isAndroid) {
|
|
||||||
_aliyunPush.createAndroidChannel('1', '测试通道A', 3, '测试创建通知通道');
|
|
||||||
_aliyunPush.setAndroidLogLevel(kAliyunPushLogLevelError);
|
|
||||||
}
|
|
||||||
_addPushCallback();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _onNotification(Map<dynamic, dynamic> message) async {
|
|
||||||
// print('onNotification: $message');
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _onAndroidNotificationReceivedInApp(
|
|
||||||
Map<dynamic, dynamic> message) async {
|
|
||||||
// print('onAndroidNotificationReceivedInApp: $message');
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _onMessage(Map<dynamic, dynamic> message) async {
|
|
||||||
// print('onMessage: $message');
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _onNotificationOpened(Map<dynamic, dynamic> message) async {
|
|
||||||
// print('onNotificationOpened: $message');
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _onNotificationRemoved(Map<dynamic, dynamic> message) async {
|
|
||||||
// print('onNotificationRemoved: $message');
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _onAndroidNotificationClickedWithNoAction(
|
|
||||||
Map<dynamic, dynamic> message) async {
|
|
||||||
// print('onAndroidNotificationClickedWithNoAction: $message');
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _onIOSChannelOpened(Map<dynamic, dynamic> message) async {}
|
|
||||||
|
|
||||||
Future<void> _onIOSRegisterDeviceTokenSuccess(
|
|
||||||
Map<dynamic, dynamic> message) async {
|
|
||||||
// Toast.show(msg: 'APNs注册成功, $message');
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _onIOSRegisterDeviceTokenFailed(
|
|
||||||
Map<dynamic, dynamic> message) async {
|
|
||||||
// Toast.show(msg: '注册APNs失败, errorMsg: $message');
|
|
||||||
}
|
|
||||||
|
|
||||||
_addPushCallback() {
|
|
||||||
_aliyunPush.addMessageReceiver(
|
|
||||||
onNotification: _onNotification,
|
|
||||||
onNotificationOpened: _onNotificationOpened,
|
|
||||||
onNotificationRemoved: _onNotificationRemoved,
|
|
||||||
onMessage: _onMessage,
|
|
||||||
onAndroidNotificationReceivedInApp: _onAndroidNotificationReceivedInApp,
|
|
||||||
onAndroidNotificationClickedWithNoAction:
|
|
||||||
_onAndroidNotificationClickedWithNoAction,
|
|
||||||
onIOSChannelOpened: _onIOSChannelOpened,
|
|
||||||
onIOSRegisterDeviceTokenSuccess: _onIOSRegisterDeviceTokenSuccess,
|
|
||||||
onIOSRegisterDeviceTokenFailed: _onIOSRegisterDeviceTokenFailed);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> initAliyunPush() async {
|
|
||||||
String appKey;
|
|
||||||
String appSecret;
|
|
||||||
|
|
||||||
if (Platform.isIOS) {
|
|
||||||
if (F.appFlavor == Flavor.sky) {
|
|
||||||
appKey = "334068745";
|
|
||||||
appSecret = "bee9c200835e4951a85dc8709c319560";
|
|
||||||
} else {
|
|
||||||
appKey = "333904046";
|
|
||||||
appSecret = "3eead09a7fc7416cb4082319aa6f48c6";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (F.appFlavor == Flavor.sky) {
|
|
||||||
appKey = "334068743";
|
|
||||||
appSecret = "64de537f14984159a66ada10e54c6b63";
|
|
||||||
} else {
|
|
||||||
appKey = "333904040";
|
|
||||||
appSecret = "c316965fe0a74fc9a481a5c44a535dc2";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_aliyunPush
|
|
||||||
.initPush(appKey: appKey, appSecret: appSecret)
|
|
||||||
.then((initResult) {
|
|
||||||
var code = initResult['code'];
|
|
||||||
if (code == kAliyunPushSuccessCode) {
|
|
||||||
// Toast.show(msg: "初始化推送成功");
|
|
||||||
} else {
|
|
||||||
String errorMsg = initResult['errorMsg'];
|
|
||||||
// print('初始化推送失败,原因为:$errorMsg');
|
|
||||||
// Toast.show(msg: '初始化推送失败, errorMsg: $errorMsg.}');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// If the widget was removed from the tree while the asynchronous platform
|
|
||||||
// message was in flight, we want to discard the reply rather than calling
|
|
||||||
// setState to update our non-existent appearance.
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> initAliyunThirdPush() async {
|
|
||||||
// Platform messages may fail, so we use a try/catch PlatformException.
|
|
||||||
// We also handle the message potentially returning null.
|
|
||||||
_aliyunPush.initAndroidThirdPush().then((initResult) {
|
|
||||||
var code = initResult['code'];
|
|
||||||
if (code == kAliyunPushSuccessCode) {
|
|
||||||
// Toast.show(msg: "初始化辅助通道成功");
|
|
||||||
} else {
|
|
||||||
String errorMsg = initResult['errorMsg'];
|
|
||||||
// Toast.show(msg: '初始化辅助通道成功, errorMsg: $errorMsg');
|
|
||||||
// print("初始化辅助通道失败,原因为:$errorMsg");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// If the widget was removed from the tree while the asynchronous platform
|
|
||||||
// message was in flight, we want to discard the reply rather than calling
|
|
||||||
// setState to update our non-existent appearance.
|
|
||||||
}
|
|
||||||
|
|
||||||
void pushBindDeviceID(String deviceID, int deviceType) async {
|
|
||||||
var entity = await ApiRepository.to.pushBindAppId(deviceID, deviceType);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
53
star_lock/lib/tools/xs_jPhush.dart
Normal file
53
star_lock/lib/tools/xs_jPhush.dart
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:jpush_flutter/jpush_flutter.dart';
|
||||||
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
|
import 'package:star_lock/tools/storage.dart';
|
||||||
|
|
||||||
|
class XSJPushProvider {
|
||||||
|
final JPush jpush = JPush();
|
||||||
|
|
||||||
|
Future<void> initJPushService() async {
|
||||||
|
final data = await Storage.getString(saveUserLoginData);
|
||||||
|
if (data != null && data.isNotEmpty) {
|
||||||
|
jpush.setup(
|
||||||
|
appKey: "7ff37d174c1a568a89e98dad",
|
||||||
|
channel: "flutter_channel",
|
||||||
|
production: false,
|
||||||
|
debug: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
jpush.addEventHandler(
|
||||||
|
// 接收通知回调方法。
|
||||||
|
onReceiveNotification: (Map<String, dynamic> message) async {
|
||||||
|
print("flutter onReceiveNotification: $message");
|
||||||
|
},
|
||||||
|
// 点击通知回调方法。
|
||||||
|
onOpenNotification: (Map<String, dynamic> message) async {
|
||||||
|
print("flutter onOpenNotification: $message");
|
||||||
|
},
|
||||||
|
// 接收自定义消息回调方法。
|
||||||
|
onReceiveMessage: (Map<String, dynamic> message) async {
|
||||||
|
print("flutter onReceiveMessage: $message");
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
jpush.applyPushAuthority(
|
||||||
|
const NotificationSettingsIOS(sound: true, alert: true, badge: true));
|
||||||
|
// jpush.setChannelAndSound(
|
||||||
|
// channel: "flutter_channel", channelID: "115700", sound: "default");
|
||||||
|
|
||||||
|
// Platform messages may fail, so we use a try/catch PlatformException.
|
||||||
|
jpush.getRegistrationID().then((rid) {
|
||||||
|
print("flutter get registration id : $rid");
|
||||||
|
pushBindDeviceID(rid, Platform.isAndroid ? 10 : 20);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void pushBindDeviceID(String deviceID, int deviceType) async {
|
||||||
|
var entity = await ApiRepository.to.pushBindAppId(deviceID, deviceType);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user