Merge branch 'release_hyx' into release
This commit is contained in:
commit
023067cdc0
@ -867,5 +867,7 @@
|
|||||||
"自定义短信模版":"Custom SMS template",
|
"自定义短信模版":"Custom SMS template",
|
||||||
"自定义邮件模版":"Custom email template",
|
"自定义邮件模版":"Custom email template",
|
||||||
"名称":"Name",
|
"名称":"Name",
|
||||||
"星星锁": "Star lock"
|
"星星锁": "Star lock",
|
||||||
|
"为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。": "To receive important updates, please click 'OK' and enable notifications in the settings."
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -899,5 +899,7 @@
|
|||||||
"自定义短信模版":"自定义短信模版",
|
"自定义短信模版":"自定义短信模版",
|
||||||
"自定义邮件模版":"自定义邮件模版",
|
"自定义邮件模版":"自定义邮件模版",
|
||||||
"名称":"名称",
|
"名称":"名称",
|
||||||
"星星锁": "星星锁"
|
"星星锁": "星星锁",
|
||||||
|
"为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。": "为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -867,5 +867,6 @@
|
|||||||
"自定义短信模版":"自定义短信模版",
|
"自定义短信模版":"自定义短信模版",
|
||||||
"自定义邮件模版":"自定义邮件模版",
|
"自定义邮件模版":"自定义邮件模版",
|
||||||
"名称":"名称",
|
"名称":"名称",
|
||||||
"星星锁": "星星锁"
|
"星星锁": "星星锁",
|
||||||
|
"为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。": "为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,11 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
import 'dart:io';
|
||||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||||
|
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:star_lock/main/lockMian/lockList/lockList_logic.dart';
|
import 'package:star_lock/main/lockMian/lockList/lockList_logic.dart';
|
||||||
|
import 'package:star_lock/tools/showTipView.dart';
|
||||||
|
|
||||||
import '../../../app_settings/app_settings.dart';
|
import '../../../app_settings/app_settings.dart';
|
||||||
import '../../../blue/blue_manage.dart';
|
import '../../../blue/blue_manage.dart';
|
||||||
@ -17,7 +21,8 @@ class LockMainLogic extends BaseGetXController {
|
|||||||
|
|
||||||
Future<LockListInfoEntity> getStarLockInfo(
|
Future<LockListInfoEntity> getStarLockInfo(
|
||||||
{bool isUnShowLoading = false}) async {
|
{bool isUnShowLoading = false}) async {
|
||||||
LockListInfoEntity entity = await ApiRepository.to.getStarLockListInfo(
|
final LockListInfoEntity entity =
|
||||||
|
await ApiRepository.to.getStarLockListInfo(
|
||||||
pageNo: pageNo,
|
pageNo: pageNo,
|
||||||
pageSize: 50,
|
pageSize: 50,
|
||||||
isUnShowLoading: isUnShowLoading,
|
isUnShowLoading: isUnShowLoading,
|
||||||
@ -59,33 +64,35 @@ class LockMainLogic extends BaseGetXController {
|
|||||||
|
|
||||||
/// 获取联网类型
|
/// 获取联网类型
|
||||||
void getConnectType() async {
|
void getConnectType() async {
|
||||||
var connectResult = await (Connectivity().checkConnectivity());
|
final ConnectivityResult connectResult =
|
||||||
|
await (Connectivity().checkConnectivity());
|
||||||
if (connectResult == ConnectivityResult.mobile) {
|
if (connectResult == ConnectivityResult.mobile) {
|
||||||
// _netType = "4G";
|
// _netType = "4G";
|
||||||
state.networkConnectionStatus.value = 1;
|
state.networkConnectionStatus.value = 1;
|
||||||
AppLog.log("网络连接: 4G 4G 4G 4G 4G");
|
AppLog.log('网络连接: 4G 4G 4G 4G 4G');
|
||||||
} else if (connectResult == ConnectivityResult.wifi) {
|
} else if (connectResult == ConnectivityResult.wifi) {
|
||||||
// _netType = "wifi";
|
// _netType = "wifi";
|
||||||
state.networkConnectionStatus.value = 1;
|
state.networkConnectionStatus.value = 1;
|
||||||
AppLog.log("网络连接: wifi wifi wifi wifi wifi");
|
AppLog.log('网络连接: wifi wifi wifi wifi wifi');
|
||||||
} else {
|
} else {
|
||||||
// _netType = "未连接";
|
// _netType = "未连接";
|
||||||
state.networkConnectionStatus.value = 0;
|
state.networkConnectionStatus.value = 0;
|
||||||
AppLog.log("网络连接: 未连接 未连接 未连接 未连接 未连接");
|
AppLog.log('网络连接: 未连接 未连接 未连接 未连接 未连接');
|
||||||
// showToast("网络访问失败,请检查网络是否正常");
|
// showToast("网络访问失败,请检查网络是否正常");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 判断网络是否连接
|
/// 判断网络是否连接
|
||||||
Future<bool> isConnected() async {
|
Future<bool> isConnected() async {
|
||||||
var connectResult = await (Connectivity().checkConnectivity());
|
final ConnectivityResult connectResult =
|
||||||
|
await Connectivity().checkConnectivity();
|
||||||
return connectResult != ConnectivityResult.none;
|
return connectResult != ConnectivityResult.none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 设置网络切换监听
|
/// 设置网络切换监听
|
||||||
connectListener() async {
|
Future<void> connectListener() async {
|
||||||
Connectivity().onConnectivityChanged.listen((ConnectivityResult result) {
|
Connectivity().onConnectivityChanged.listen((ConnectivityResult result) {
|
||||||
AppLog.log("设置网络切换监听:$result");
|
AppLog.log('设置网络切换监听:$result');
|
||||||
if (state.networkConnectionStatus.value == 0 &&
|
if (state.networkConnectionStatus.value == 0 &&
|
||||||
result != ConnectivityResult.none) {
|
result != ConnectivityResult.none) {
|
||||||
// 从无网络到有网络
|
// 从无网络到有网络
|
||||||
@ -95,36 +102,52 @@ class LockMainLogic extends BaseGetXController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 检测推送是否开启
|
||||||
|
Future<void> checkWhetherPushIsEnabled() async {
|
||||||
|
bool notificationEnabled = false;
|
||||||
|
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
notificationEnabled = await FlutterLocalNotificationsPlugin()
|
||||||
|
.resolvePlatformSpecificImplementation<
|
||||||
|
AndroidFlutterLocalNotificationsPlugin>()
|
||||||
|
?.areNotificationsEnabled() ??
|
||||||
|
false;
|
||||||
|
} else if (Platform.isIOS) {
|
||||||
|
notificationEnabled = await FlutterLocalNotificationsPlugin()
|
||||||
|
.resolvePlatformSpecificImplementation<
|
||||||
|
IOSFlutterLocalNotificationsPlugin>()
|
||||||
|
?.requestPermissions(
|
||||||
|
alert: true,
|
||||||
|
badge: false,
|
||||||
|
sound: true,
|
||||||
|
) ??
|
||||||
|
false;
|
||||||
|
}
|
||||||
|
if (!notificationEnabled) {
|
||||||
|
//推送未开启
|
||||||
|
ShowTipView().showIosTipWithContentDialog(
|
||||||
|
'为了让您及时收到重要通知和更新,我们需要获取通知权限。请点击“确定”按钮,然后在设置页面中启用通知权限。'.tr, () async {
|
||||||
|
openAppSettings();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
// TODO: implement onReady
|
|
||||||
super.onReady();
|
super.onReady();
|
||||||
|
|
||||||
// 开启UDP
|
// 开启UDP
|
||||||
UdpHelp().openUDP();
|
UdpHelp().openUDP();
|
||||||
|
|
||||||
BlueManage();
|
BlueManage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
// TODO: implement onInit
|
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
checkWhetherPushIsEnabled();
|
||||||
// getLockInfo();
|
|
||||||
// 设置网络变化监听
|
|
||||||
// connectListener();
|
|
||||||
// 获取网络连接状态
|
|
||||||
// getConnectType();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
// TODO: implement onClose
|
|
||||||
super.onClose();
|
super.onClose();
|
||||||
|
|
||||||
// refreshController.dispose();
|
|
||||||
// _teamEvent.cancel();
|
|
||||||
// state.timer.cancel();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,9 +54,6 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
|||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
// if (mounted) {
|
|
||||||
// setSŒe(() {});
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user