1,鑫泓佳iOS端集成极光推送(已自测)
2,鑫泓佳Android端集成极光推送(厂商通道未完成) 3,fix提测问题:密码超过二十个刷新、加载会覆盖问题
This commit is contained in:
parent
bc08c31a64
commit
40bd9c3612
96
android/app/agconnect-services.json
Normal file
96
android/app/agconnect-services.json
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
{
|
||||||
|
"agcgw":{
|
||||||
|
"backurl":"connect-drcn.hispace.hicloud.com",
|
||||||
|
"url":"connect-drcn.dbankcloud.cn",
|
||||||
|
"websocketbackurl":"connect-ws-drcn.hispace.dbankcloud.com",
|
||||||
|
"websocketurl":"connect-ws-drcn.hispace.dbankcloud.cn"
|
||||||
|
},
|
||||||
|
"agcgw_all":{
|
||||||
|
"CN":"connect-drcn.dbankcloud.cn",
|
||||||
|
"CN_back":"connect-drcn.hispace.hicloud.com",
|
||||||
|
"DE":"connect-dre.dbankcloud.cn",
|
||||||
|
"DE_back":"connect-dre.hispace.hicloud.com",
|
||||||
|
"RU":"connect-drru.hispace.dbankcloud.ru",
|
||||||
|
"RU_back":"connect-drru.hispace.dbankcloud.cn",
|
||||||
|
"SG":"connect-dra.dbankcloud.cn",
|
||||||
|
"SG_back":"connect-dra.hispace.hicloud.com"
|
||||||
|
},
|
||||||
|
"websocketgw_all":{
|
||||||
|
"CN":"connect-ws-drcn.hispace.dbankcloud.cn",
|
||||||
|
"CN_back":"connect-ws-drcn.hispace.dbankcloud.com",
|
||||||
|
"DE":"connect-ws-dre.hispace.dbankcloud.cn",
|
||||||
|
"DE_back":"connect-ws-dre.hispace.dbankcloud.com",
|
||||||
|
"RU":"connect-ws-drru.hispace.dbankcloud.ru",
|
||||||
|
"RU_back":"connect-ws-drru.hispace.dbankcloud.cn",
|
||||||
|
"SG":"connect-ws-dra.hispace.dbankcloud.cn",
|
||||||
|
"SG_back":"connect-ws-dra.hispace.dbankcloud.com"
|
||||||
|
},
|
||||||
|
"client":{
|
||||||
|
"cp_id":"30086000752967166",
|
||||||
|
"product_id":"388421841222116270",
|
||||||
|
"client_id":"1406555529261648640",
|
||||||
|
"client_secret":"843E8191B02B692239726CF0ED990E1EC2B31928F825AA012B932A128FD2C516",
|
||||||
|
"project_id":"388421841222116270",
|
||||||
|
"app_id":"110798531",
|
||||||
|
"api_key":"DQEDAALnPCtuCgoYOyZfsIDa9/YZZhQ+buDGpypeurXhQUGMajWcVyYLQgXXqV3x2HbI6oyG+Wm2Gf+1hPs6j+wA3B6ylYAXG4aAQA==",
|
||||||
|
"package_name":"com.xhjcn.lock"
|
||||||
|
},
|
||||||
|
"oauth_client":{
|
||||||
|
"client_id":"110798531",
|
||||||
|
"client_type":1
|
||||||
|
},
|
||||||
|
"app_info":{
|
||||||
|
"app_id":"110798531",
|
||||||
|
"package_name":"com.xhjcn.lock"
|
||||||
|
},
|
||||||
|
"service":{
|
||||||
|
"analytics":{
|
||||||
|
"collector_url":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
|
||||||
|
"collector_url_ru":"datacollector-drru.dt.dbankcloud.ru,datacollector-drru.dt.hicloud.com",
|
||||||
|
"collector_url_sg":"datacollector-dra.dt.hicloud.com,datacollector-dra.dt.dbankcloud.cn",
|
||||||
|
"collector_url_de":"datacollector-dre.dt.hicloud.com,datacollector-dre.dt.dbankcloud.cn",
|
||||||
|
"collector_url_cn":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn",
|
||||||
|
"resource_id":"p1",
|
||||||
|
"channel_id":""
|
||||||
|
},
|
||||||
|
"edukit":{
|
||||||
|
"edu_url":"edukit.cloud.huawei.com.cn",
|
||||||
|
"dh_url":"edukit.cloud.huawei.com.cn"
|
||||||
|
},
|
||||||
|
"search":{
|
||||||
|
"url":"https://search-drcn.cloud.huawei.com"
|
||||||
|
},
|
||||||
|
"cloudstorage":{
|
||||||
|
"storage_url_sg_back":"https://agc-storage-dra.cloud.huawei.asia",
|
||||||
|
"storage_url_ru_back":"https://agc-storage-drru.cloud.huawei.ru",
|
||||||
|
"storage_url_ru":"https://agc-storage-drru.cloud.huawei.ru",
|
||||||
|
"storage_url_de_back":"https://agc-storage-dre.cloud.huawei.eu",
|
||||||
|
"storage_url_de":"https://ops-dre.agcstorage.link",
|
||||||
|
"storage_url":"https://agc-storage-drcn.platform.dbankcloud.cn",
|
||||||
|
"storage_url_sg":"https://ops-dra.agcstorage.link",
|
||||||
|
"storage_url_cn_back":"https://agc-storage-drcn.cloud.huawei.com.cn",
|
||||||
|
"storage_url_cn":"https://agc-storage-drcn.platform.dbankcloud.cn"
|
||||||
|
},
|
||||||
|
"ml":{
|
||||||
|
"mlservice_url":"ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"region":"CN",
|
||||||
|
"configuration_version":"3.0",
|
||||||
|
"appInfos":[
|
||||||
|
{
|
||||||
|
"package_name":"com.xhjcn.lock",
|
||||||
|
"client":{
|
||||||
|
"app_id":"110798531"
|
||||||
|
},
|
||||||
|
"app_info":{
|
||||||
|
"package_name":"com.xhjcn.lock",
|
||||||
|
"app_id":"110798531"
|
||||||
|
},
|
||||||
|
"oauth_client":{
|
||||||
|
"client_type":1,
|
||||||
|
"client_id":"110798531"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -27,6 +27,7 @@ apply plugin: 'kotlin-android'
|
|||||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'android-junk-code'
|
apply plugin: 'android-junk-code'
|
||||||
|
apply plugin: 'com.huawei.agconnect'
|
||||||
|
|
||||||
androidJunkCode {
|
androidJunkCode {
|
||||||
variantConfig {
|
variantConfig {
|
||||||
@ -161,13 +162,23 @@ android {
|
|||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
JPUSH_PKGNAME : "这里不重要,在口味配置",
|
JPUSH_PKGNAME : "这里不重要,在口味配置",
|
||||||
//JPush 上注册的包名对应的 Appkey.
|
//JPush 上注册的包名对应的 Appkey.
|
||||||
JPUSH_APPKEY : "7ff37d174c1a568a89e98dad",
|
// JPUSH_APPKEY : "7ff37d174c1a568a89e98dad",//--skyAppKey
|
||||||
//暂时填写默认值即可.
|
JPUSH_APPKEY : "251fc8074820d122b6de58d2",//--鑫泓佳AppKey
|
||||||
JPUSH_CHANNEL : "flutter_channel",
|
JPUSH_CHANNEL : "flutter_channel",
|
||||||
|
|
||||||
//若不集成厂商通道,可直接跳过以下配置
|
//若不集成厂商通道,可直接跳过以下配置
|
||||||
XIAOMI_APPID : "MI-2882303761520287291",
|
//以下为sky的配置
|
||||||
XIAOMI_APPKEY : "MI-5352028744291",
|
// XIAOMI_APPID : "MI-2882303761520287291",
|
||||||
|
// XIAOMI_APPKEY : "MI-5352028744291",
|
||||||
|
//以下均为鑫泓佳的配置
|
||||||
|
XIAOMI_APPID : "MI-2882303761520314939",
|
||||||
|
XIAOMI_APPKEY : "MI-5312031456939",
|
||||||
|
OPPO_APPKEY : "OP-47f668c9943248118502aa58d066393b",
|
||||||
|
OPPO_APPID : "OP-31726001",
|
||||||
|
OPPO_APPSECRET : "OP-05723986bba64183a71530b496922450",
|
||||||
|
// VIVO_APPKEY : "vivo的APPKEY",
|
||||||
|
// VIVO_APPID : "vivo的APPID",
|
||||||
|
HONOR_APPID : "110798531",
|
||||||
]
|
]
|
||||||
splits {
|
splits {
|
||||||
abi {
|
abi {
|
||||||
@ -208,7 +219,10 @@ dependencies {
|
|||||||
implementation('com.amap.api:3dmap:8.1.0')
|
implementation('com.amap.api:3dmap:8.1.0')
|
||||||
|
|
||||||
implementation 'cn.jiguang.sdk:jpush:5.2.3'
|
implementation 'cn.jiguang.sdk:jpush:5.2.3'
|
||||||
|
// 接入华为厂商
|
||||||
implementation 'com.huawei.hms:push:6.12.0.300'
|
implementation 'com.huawei.hms:push:6.12.0.300'
|
||||||
|
implementation 'cn.jiguang.sdk.plugin:huawei:5.2.3'
|
||||||
|
|
||||||
|
|
||||||
implementation 'cn.jiguang.sdk.plugin:xiaomi:5.2.3'
|
implementation 'cn.jiguang.sdk.plugin:xiaomi:5.2.3'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,7 @@ class StarLockLoginLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> login() async {
|
Future<void> login() async {
|
||||||
FocusScope.of(Get.context!).requestFocus(FocusNode());//关闭键盘
|
FocusScope.of(Get.context!).requestFocus(FocusNode()); //关闭键盘
|
||||||
final LoginEntity entity = await ApiRepository.to.login(
|
final LoginEntity entity = await ApiRepository.to.login(
|
||||||
loginType: '1',
|
loginType: '1',
|
||||||
password: state.pwd.value,
|
password: state.pwd.value,
|
||||||
@ -50,7 +50,7 @@ class StarLockLoginLogic extends BaseGetXController {
|
|||||||
Storage.setBool(saveIsVip, entity.data!.isVip == 0 ? false : true);
|
Storage.setBool(saveIsVip, entity.data!.isVip == 0 ? false : true);
|
||||||
eventBus.fire(MineInfoChangeRefreshUI());
|
eventBus.fire(MineInfoChangeRefreshUI());
|
||||||
XSJPushProvider().initJPushService();
|
XSJPushProvider().initJPushService();
|
||||||
XSJPushProvider().initLocalNotification(false);
|
XSJPushProvider().initLocalNotification(isCancelLocalPush: false);
|
||||||
Get.offNamedUntil(Routers.starLockMain, (Route route) => false);
|
Get.offNamedUntil(Routers.starLockMain, (Route route) => false);
|
||||||
BlueManage().scanDevices.clear(); //清除设备缓存
|
BlueManage().scanDevices.clear(); //清除设备缓存
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,14 +24,16 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
// 获取解析后的数据
|
// 获取解析后的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
_replySubscription =
|
||||||
|
EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
||||||
// 添加卡片开始(重置锁里面所有卡)
|
// 添加卡片开始(重置锁里面所有卡)
|
||||||
if((reply is SenderCustomPasswordsReply) && (state.ifCurrentScreen.value == true)) {
|
if ((reply is SenderCustomPasswordsReply) &&
|
||||||
|
(state.ifCurrentScreen.value == true)) {
|
||||||
_replyAddPassword(reply);
|
_replyAddPassword(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((reply is SenderResetPasswordsReply) && (state.ifCurrentScreen.value == true)){
|
if ((reply is SenderResetPasswordsReply) &&
|
||||||
|
(state.ifCurrentScreen.value == true)) {
|
||||||
_replyResetPassword(reply);
|
_replyResetPassword(reply);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -41,14 +43,14 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
Future<void> _replyAddPassword(Reply reply) async {
|
Future<void> _replyAddPassword(Reply reply) async {
|
||||||
int status = reply.data[2];
|
int status = reply.data[2];
|
||||||
|
|
||||||
switch(status){
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
deletePwdRequest();
|
deletePwdRequest();
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
@ -60,15 +62,15 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
IoSenderManage.senderCustomPasswordsCommand(
|
IoSenderManage.senderCustomPasswordsCommand(
|
||||||
keyID:"0",
|
keyID: "0",
|
||||||
userID:(await Storage.getUid())!,
|
userID: (await Storage.getUid())!,
|
||||||
pwdNo:state.itemData.isCustom == 1 ? state.pwdNo : 0,
|
pwdNo: state.itemData.isCustom == 1 ? state.pwdNo : 0,
|
||||||
pwd:state.pwd,//state.deletPWD,
|
pwd: state.pwd, //state.deletPWD,
|
||||||
operate: state.itemData.isCustom == 1 ? 2 : 3,
|
operate: state.itemData.isCustom == 1 ? 2 : 3,
|
||||||
isAdmin: 0,
|
isAdmin: 0,
|
||||||
useCountLimit: 0xffff,
|
useCountLimit: 0xffff,
|
||||||
startTime:0x11223344,
|
startTime: 0x11223344,
|
||||||
endTime:0x11223344,
|
endTime: 0x11223344,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
isBeforeAddUser: false,
|
isBeforeAddUser: false,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
@ -85,16 +87,16 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
// 重置密码
|
// 重置密码
|
||||||
Future<void> _replyResetPassword(Reply reply) async {
|
Future<void> _replyResetPassword(Reply reply) async {
|
||||||
int status = reply.data[2];
|
int status = reply.data[2];
|
||||||
switch(status){
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
//成功
|
//成功
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
state.encrpyKey = reply.data.sublist(9, 17);
|
state.encrpyKey = reply.data.sublist(9, 17);
|
||||||
resetPasswordKeyListRequest();
|
resetPasswordKeyListRequest();
|
||||||
break;
|
break;
|
||||||
case 0x06:
|
case 0x06:
|
||||||
//无权限
|
//无权限
|
||||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
@ -106,8 +108,8 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
IoSenderManage.senderResetPasswordsCommand(
|
IoSenderManage.senderResetPasswordsCommand(
|
||||||
keyID:"0",
|
keyID: "0",
|
||||||
userID:(await Storage.getUid())!,
|
userID: (await Storage.getUid())!,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
isBeforeAddUser: false,
|
isBeforeAddUser: false,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
@ -125,10 +127,11 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
// 设置自定义密码 这里用作删除密码
|
// 设置自定义密码 这里用作删除密码
|
||||||
Future<void> senderCustomPasswords() async {
|
Future<void> senderCustomPasswords() async {
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
showBlueConnetctToastTimer(action: (){
|
showBlueConnetctToastTimer(action: () {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
});
|
});
|
||||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
@ -140,25 +143,26 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
IoSenderManage.senderCustomPasswordsCommand(
|
IoSenderManage.senderCustomPasswordsCommand(
|
||||||
keyID:"0",
|
keyID: "0",
|
||||||
userID:(await Storage.getUid())!,
|
userID: (await Storage.getUid())!,
|
||||||
pwdNo:state.itemData.isCustom == 1 ? state.pwdNo : 0,
|
pwdNo: state.itemData.isCustom == 1 ? state.pwdNo : 0,
|
||||||
pwd:state.pwd,//state.deletPWD,
|
pwd: state.pwd, //state.deletPWD,
|
||||||
operate: state.itemData.isCustom == 1 ? 2 : 3,
|
operate: state.itemData.isCustom == 1 ? 2 : 3,
|
||||||
isAdmin: 0,
|
isAdmin: 0,
|
||||||
useCountLimit: 0xffff,
|
useCountLimit: 0xffff,
|
||||||
startTime:0x11223344,
|
startTime: 0x11223344,
|
||||||
endTime:0x11223344,
|
endTime: 0x11223344,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
isBeforeAddUser: false,
|
isBeforeAddUser: false,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList);
|
token: getTokenList);
|
||||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
} else if (deviceConnectionState ==
|
||||||
|
BluetoothConnectionState.disconnected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
if(state.ifCurrentScreen.value == true){
|
if (state.ifCurrentScreen.value == true) {
|
||||||
showBlueConnetctToast();
|
showBlueConnetctToast();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -167,17 +171,18 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
|
|
||||||
// 重置密码
|
// 重置密码
|
||||||
Future<void> senderResetPasswords() async {
|
Future<void> senderResetPasswords() async {
|
||||||
if(state.sureBtnState.value == 1){
|
if (state.sureBtnState.value == 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.sureBtnState.value = 1;
|
state.sureBtnState.value = 1;
|
||||||
|
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
showBlueConnetctToastTimer(action: (){
|
showBlueConnetctToastTimer(action: () {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
var signKey = await Storage.getStringList(saveBlueSignKey);
|
var signKey = await Storage.getStringList(saveBlueSignKey);
|
||||||
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
@ -189,43 +194,80 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
List<int> getTokenList = changeStringListToIntList(token!);
|
List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
|
|
||||||
IoSenderManage.senderResetPasswordsCommand(
|
IoSenderManage.senderResetPasswordsCommand(
|
||||||
keyID:"0",
|
keyID: "0",
|
||||||
userID:(await Storage.getUid())!,
|
userID: (await Storage.getUid())!,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
isBeforeAddUser: false,
|
isBeforeAddUser: false,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList);
|
token: getTokenList);
|
||||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
} else if (deviceConnectionState ==
|
||||||
|
BluetoothConnectionState.disconnected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
if(state.ifCurrentScreen.value == true){
|
if (state.ifCurrentScreen.value == true) {
|
||||||
showBlueConnetctToast();
|
showBlueConnetctToast();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* //请求操作记录列表(门锁日志)
|
||||||
|
void mockNetworkDataRequest({required bool isRefresh}) async {
|
||||||
|
// 如果是下拉刷新,清空已有数据
|
||||||
|
if (isRefresh) {
|
||||||
|
state.lockLogItemList.clear();
|
||||||
|
pageNo = 1;
|
||||||
|
}
|
||||||
|
DoorLockLogEntity entity = await ApiRepository.to.lockEventList(
|
||||||
|
lockId: state.keyInfos.value.lockId!,
|
||||||
|
lockEventType: state.dropdownValue.value,
|
||||||
|
pageNo: pageNo,
|
||||||
|
pageSize: int.parse(pageSize),
|
||||||
|
startDate: state.startDate.value,
|
||||||
|
endDate: state.endDate.value);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
// 更新数据列表
|
||||||
|
state.lockLogItemList.addAll(entity.data!.itemList!);
|
||||||
|
// 更新页码
|
||||||
|
pageNo++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
//请求密码钥匙列表
|
//请求密码钥匙列表
|
||||||
Future<PasswordKeyListEntity> mockNetworkDataRequest() async {
|
Future<PasswordKeyListEntity> mockNetworkDataRequest(
|
||||||
PasswordKeyListEntity entity = await ApiRepository.to.passwordKeyList(
|
{required bool isRefresh}) async {
|
||||||
|
// 如果是下拉刷新,清空已有数据
|
||||||
|
if (isRefresh) {
|
||||||
|
state.itemDataList.clear();
|
||||||
|
pageNo = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
final PasswordKeyListEntity entity = await ApiRepository.to.passwordKeyList(
|
||||||
state.keyInfo.value.keyStatus.toString(),
|
state.keyInfo.value.keyStatus.toString(),
|
||||||
state.keyInfo.value.lockId.toString(),
|
state.keyInfo.value.lockId.toString(),
|
||||||
pageNo.toString(),
|
pageNo.toString(),
|
||||||
pageSize.toString(),
|
pageSize.toString(),
|
||||||
state.searchController.text);
|
state.searchController.text);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
if (pageNo == 1) {
|
// 更新数据列表
|
||||||
state.itemDataList.value.clear();
|
state.itemDataList.addAll(entity.data!.itemList!);
|
||||||
state.itemDataList.value = entity.data!.itemList!;
|
// 更新页码
|
||||||
pageNo++;
|
pageNo++;
|
||||||
} else {
|
|
||||||
if (entity.data!.itemList!.isNotEmpty) {
|
// if (pageNo == 1) {
|
||||||
state.itemDataList.value.addAll(entity.data!.itemList!);
|
// state.itemDataList.value.clear();
|
||||||
pageNo++;
|
// state.itemDataList.value = entity.data!.itemList!;
|
||||||
}
|
// pageNo++;
|
||||||
}
|
// } else {
|
||||||
|
// if (entity.data!.itemList!.isNotEmpty) {
|
||||||
|
// state.itemDataList.value.addAll(entity.data!.itemList!);
|
||||||
|
// pageNo++;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
@ -233,13 +275,12 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
//密码钥匙重置请求
|
//密码钥匙重置请求
|
||||||
Future<void> resetPasswordKeyListRequest() async {
|
Future<void> resetPasswordKeyListRequest() async {
|
||||||
PasswordKeyListEntity entity = await ApiRepository.to.keyboardPwdReset(
|
PasswordKeyListEntity entity = await ApiRepository.to.keyboardPwdReset(
|
||||||
lockId:state.keyInfo.value.lockId.toString(),
|
lockId: state.keyInfo.value.lockId.toString(),
|
||||||
passwordKey: state.encrpyKey
|
passwordKey: state.encrpyKey);
|
||||||
);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("重置成功".tr, something: (){
|
showToast("重置成功".tr, something: () {
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
mockNetworkDataRequest();
|
mockNetworkDataRequest(isRefresh: true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -247,13 +288,13 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
//删除密码请求 deleteType:1-蓝牙 2-网关
|
//删除密码请求 deleteType:1-蓝牙 2-网关
|
||||||
Future<void> deletePwdRequest() async {
|
Future<void> deletePwdRequest() async {
|
||||||
PasswordKeyEntity entity = await ApiRepository.to.deleteKeyboardPwd(
|
PasswordKeyEntity entity = await ApiRepository.to.deleteKeyboardPwd(
|
||||||
lockId:state.itemData.lockId!.toString(),
|
lockId: state.itemData.lockId!.toString(),
|
||||||
keyboardPwdId:state.itemData.keyboardPwdId!.toString(),
|
keyboardPwdId: state.itemData.keyboardPwdId!.toString(),
|
||||||
deleteType:1);
|
deleteType: 1);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
showToast("删除成功".tr, something: (){
|
showToast("删除成功".tr, something: () {
|
||||||
pageNo = 1;
|
pageNo = 1;
|
||||||
mockNetworkDataRequest();
|
mockNetworkDataRequest(isRefresh: true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -262,80 +303,76 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
String getUseDateStr(PasswordKeyListItem indexEntity) {
|
String getUseDateStr(PasswordKeyListItem indexEntity) {
|
||||||
int? getPwdType = indexEntity.keyboardPwdType;
|
int? getPwdType = indexEntity.keyboardPwdType;
|
||||||
String useDateStr = '';
|
String useDateStr = '';
|
||||||
DateTime sendDateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
DateTime sendDateStr =
|
||||||
DateTime startDateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.sendDate!);
|
||||||
DateTime endDateStr = DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
DateTime startDateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.startDate!);
|
||||||
|
DateTime endDateStr =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(indexEntity.endDate!);
|
||||||
int starHour = indexEntity.hoursStart!;
|
int starHour = indexEntity.hoursStart!;
|
||||||
int endHour = indexEntity.hoursEnd!;
|
int endHour = indexEntity.hoursEnd!;
|
||||||
// AppLog.log('indexEntity.keyboardPwdName:${indexEntity.keyboardPwdName} indexEntity.keyboardPwdStatus:${indexEntity.keyboardPwdStatus} indexEntity.startDate!${indexEntity.startDate!} indexEntity.endDate!${indexEntity.endDate!} starHour:$starHour endHour:$endHour');
|
// AppLog.log('indexEntity.keyboardPwdName:${indexEntity.keyboardPwdName} indexEntity.keyboardPwdStatus:${indexEntity.keyboardPwdStatus} indexEntity.startDate!${indexEntity.startDate!} indexEntity.endDate!${indexEntity.endDate!} starHour:$starHour endHour:$endHour');
|
||||||
|
|
||||||
switch (getPwdType) {
|
switch (getPwdType) {
|
||||||
case 1:
|
case 1:
|
||||||
//单次 1 只能在开始时间后6小时内使用一次
|
//单次 1 只能在开始时间后6小时内使用一次
|
||||||
useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)} ${"单次".tr}';
|
useDateStr =
|
||||||
|
'${startDateStr.toLocal().toString().substring(0, 16)} ${"单次".tr}';
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
//永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
useDateStr = '${sendDateStr.toLocal().toString().substring(0, 16)} ${"永久".tr} ${indexEntity.isCustom! == 1? "自定义".tr : ""}';
|
useDateStr =
|
||||||
|
'${sendDateStr.toLocal().toString().substring(0, 16)} ${"永久".tr} ${indexEntity.isCustom! == 1 ? "自定义".tr : ""}';
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
//限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
useDateStr =
|
useDateStr =
|
||||||
'${startDateStr.toLocal().toString().substring(0, 16)} - ${endDateStr.toLocal().toString().substring(0, 16)} ${"限时".tr} ${indexEntity.isCustom! == 1? "自定义".tr : ""}';
|
'${startDateStr.toLocal().toString().substring(0, 16)} - ${endDateStr.toLocal().toString().substring(0, 16)} ${"限时".tr} ${indexEntity.isCustom! == 1 ? "自定义".tr : ""}';
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||||
useDateStr = '${startDateStr.toLocal().toString().substring(0, 16)} ${"清空码".tr}';
|
useDateStr =
|
||||||
|
'${startDateStr.toLocal().toString().substring(0, 16)} ${"清空码".tr}';
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
//周未循环 5 在周未开始和结束时间指定时间段内有效
|
||||||
useDateStr =
|
useDateStr = '${"周末".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||||
'${"周末".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
//每日循环 6 每天开始和结束时间指定时间段内有效
|
//每日循环 6 每天开始和结束时间指定时间段内有效
|
||||||
useDateStr =
|
useDateStr = '${"每日".tr}$starHour:00-$endHour:00 ${"循环"}';
|
||||||
'${"每日".tr}$starHour:00-$endHour:00 ${"循环"}';
|
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
//工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
//工作日循环 7 工作日开始和结束时间指定的时间段内有效
|
||||||
useDateStr =
|
useDateStr = '${"工作日".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||||
'${"工作日".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
//周一循环 8 每周一开始和结束时间指定时间段内有效
|
//周一循环 8 每周一开始和结束时间指定时间段内有效
|
||||||
useDateStr =
|
useDateStr = '${"周一".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||||
'${"周一".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
//周二循环 9 每周二开始和结束时间指定时间段内有效
|
//周二循环 9 每周二开始和结束时间指定时间段内有效
|
||||||
useDateStr =
|
useDateStr = '${"周二".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||||
'${"周二".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
//周三循环 10 每周三开始和结束时间指定时间段内有效
|
//周三循环 10 每周三开始和结束时间指定时间段内有效
|
||||||
useDateStr =
|
useDateStr = '${"周三".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||||
'${"周三".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
//周四循环 11 每周四开始和结束时间指定时间段内有效
|
//周四循环 11 每周四开始和结束时间指定时间段内有效
|
||||||
useDateStr =
|
useDateStr = '${"周四".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||||
'${"周四".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
//周五循环 12 每周五开始和结束时间指定时间段内有效
|
//周五循环 12 每周五开始和结束时间指定时间段内有效
|
||||||
useDateStr =
|
useDateStr = '${"周五".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||||
'${"周五".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
//周六循环 13 每周六开始和结束时间指定时间段内有效
|
//周六循环 13 每周六开始和结束时间指定时间段内有效
|
||||||
useDateStr =
|
useDateStr = '${"周六".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||||
'${"周六".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
//周天循环 14 每周日开始和结束时间指定时间段内有效
|
//周天循环 14 每周日开始和结束时间指定时间段内有效
|
||||||
useDateStr =
|
useDateStr = '${"周日".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
||||||
'${"周日".tr}$starHour:00-$endHour:00 ${"循环".tr}';
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -347,9 +384,9 @@ class PasswordKeyListLogic extends BaseGetXController {
|
|||||||
StreamSubscription? _getPasswordListRefreshUIEvent;
|
StreamSubscription? _getPasswordListRefreshUIEvent;
|
||||||
void _getPasswordListRefreshUIAction() {
|
void _getPasswordListRefreshUIAction() {
|
||||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||||
_getPasswordListRefreshUIEvent = eventBus.on<GetPasswordListRefreshUI>().listen((event) {
|
_getPasswordListRefreshUIEvent =
|
||||||
pageNo = 1;
|
eventBus.on<GetPasswordListRefreshUI>().listen((event) {
|
||||||
mockNetworkDataRequest();
|
mockNetworkDataRequest(isRefresh: true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
@ -24,14 +23,17 @@ class PasswordKeyListPage extends StatefulWidget {
|
|||||||
State<PasswordKeyListPage> createState() => _PasswordKeyListPageState();
|
State<PasswordKeyListPage> createState() => _PasswordKeyListPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAware {
|
class _PasswordKeyListPageState extends State<PasswordKeyListPage>
|
||||||
|
with RouteAware {
|
||||||
final logic = Get.put(PasswordKeyListLogic());
|
final logic = Get.put(PasswordKeyListLogic());
|
||||||
final state = Get.find<PasswordKeyListLogic>().state;
|
final state = Get.find<PasswordKeyListLogic>().state;
|
||||||
|
|
||||||
Future<void> getHttpData() async {
|
Future<void> getHttpData({required bool isRefresh}) async {
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
logic.mockNetworkDataRequest().then((PasswordKeyListEntity value){
|
logic
|
||||||
|
.mockNetworkDataRequest(isRefresh: isRefresh)
|
||||||
|
.then((PasswordKeyListEntity value) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -41,7 +43,7 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
getHttpData();
|
getHttpData(isRefresh: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -61,11 +63,12 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
var isDemoMode = await Storage.getBool(ifIsDemoModeOrNot);
|
||||||
if (isDemoMode == false) {
|
if (isDemoMode == false) {
|
||||||
if(state.itemDataList.isEmpty){
|
if (state.itemDataList.isEmpty) {
|
||||||
logic.showToast("暂无密码,无需重置".tr);
|
logic.showToast("暂无密码,无需重置".tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ShowTipView().showIosTipWithContentDialog('该锁的密码都将被删除'.tr, () {
|
ShowTipView().showIosTipWithContentDialog('该锁的密码都将被删除'.tr,
|
||||||
|
() {
|
||||||
logic.senderResetPasswords();
|
logic.senderResetPasswords();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -76,12 +79,11 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: EasyRefreshTool(
|
body: EasyRefreshTool(
|
||||||
onRefresh: (){
|
onRefresh: () {
|
||||||
logic.pageNo = 1;
|
getHttpData(isRefresh: true);
|
||||||
getHttpData();
|
|
||||||
},
|
},
|
||||||
onLoad: (){
|
onLoad: () {
|
||||||
getHttpData();
|
getHttpData(isRefresh: false);
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
@ -89,26 +91,25 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
|
|||||||
KeySearchWidget(
|
KeySearchWidget(
|
||||||
editingController: state.searchController,
|
editingController: state.searchController,
|
||||||
onSubmittedAction: () {
|
onSubmittedAction: () {
|
||||||
logic.pageNo = 1;
|
getHttpData(isRefresh: true);
|
||||||
getHttpData();
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20.h,
|
height: 20.h,
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(child: _buildMainUI()),
|
||||||
child: _buildMainUI()),
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20.h,
|
height: 20.h,
|
||||||
),
|
),
|
||||||
AddBottomWhiteBtn(
|
AddBottomWhiteBtn(
|
||||||
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
btnName: TranslationLoader.lanKeys!.getPassword!.tr,
|
||||||
onClick: () {
|
onClick: () {
|
||||||
Navigator.pushNamed(context, Routers.passwordKeyPerpetualPage,
|
Navigator.pushNamed(
|
||||||
arguments: {"keyInfo": state.keyInfo.value}).then((val) {
|
context, Routers.passwordKeyPerpetualPage,
|
||||||
|
arguments: {"keyInfo": state.keyInfo.value})
|
||||||
|
.then((val) {
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
logic.pageNo = 1;
|
getHttpData(isRefresh: true);
|
||||||
getHttpData();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
@ -122,58 +123,68 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
|
|||||||
|
|
||||||
Widget _buildMainUI() {
|
Widget _buildMainUI() {
|
||||||
return Obx(() => state.itemDataList.value.isEmpty
|
return Obx(() => state.itemDataList.value.isEmpty
|
||||||
? NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 190.h - 64.h)
|
? NoData(
|
||||||
|
noDataHeight: 1.sh -
|
||||||
|
ScreenUtil().statusBarHeight -
|
||||||
|
ScreenUtil().bottomBarHeight -
|
||||||
|
190.h -
|
||||||
|
64.h)
|
||||||
: SlidableAutoCloseBehavior(
|
: SlidableAutoCloseBehavior(
|
||||||
child: ListView.separated(
|
child: ListView.separated(
|
||||||
itemCount: state.itemDataList.value.length,
|
itemCount: state.itemDataList.value.length,
|
||||||
itemBuilder: (c, index) {
|
itemBuilder: (c, index) {
|
||||||
PasswordKeyListItem passwordKeyListItem = state.itemDataList.value[index];
|
PasswordKeyListItem passwordKeyListItem =
|
||||||
String useDateStr = logic.getUseDateStr(passwordKeyListItem);// 使用期限
|
state.itemDataList.value[index];
|
||||||
|
String useDateStr =
|
||||||
|
logic.getUseDateStr(passwordKeyListItem); // 使用期限
|
||||||
|
|
||||||
return Slidable(
|
return Slidable(
|
||||||
key:ValueKey(passwordKeyListItem.keyboardPwdId),
|
key: ValueKey(passwordKeyListItem.keyboardPwdId),
|
||||||
endActionPane: ActionPane(
|
endActionPane: ActionPane(
|
||||||
extentRatio: 0.2,
|
extentRatio: 0.2,
|
||||||
motion: const ScrollMotion(),
|
motion: const ScrollMotion(),
|
||||||
children: [
|
children: [
|
||||||
SlidableAction(
|
SlidableAction(
|
||||||
onPressed: (BuildContext context){
|
onPressed: (BuildContext context) {
|
||||||
ShowTipView().showIosTipWithContentDialog("确定要删除吗?".tr, () async {
|
ShowTipView().showIosTipWithContentDialog(
|
||||||
state.itemData = passwordKeyListItem;
|
"确定要删除吗?".tr, () async {
|
||||||
state.pwdNo = passwordKeyListItem.pwdUserNo!;
|
state.itemData = passwordKeyListItem;
|
||||||
state.pwd = passwordKeyListItem.keyboardPwd!;
|
state.pwdNo = passwordKeyListItem.pwdUserNo!;
|
||||||
logic.senderCustomPasswords();
|
state.pwd = passwordKeyListItem.keyboardPwd!;
|
||||||
});
|
logic.senderCustomPasswords();
|
||||||
},
|
});
|
||||||
backgroundColor: Colors.red,
|
},
|
||||||
foregroundColor: Colors.white,
|
backgroundColor: Colors.red,
|
||||||
label: '删除'.tr,
|
foregroundColor: Colors.white,
|
||||||
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
label: '删除'.tr,
|
||||||
|
padding: EdgeInsets.only(left: 5.w, right: 5.w),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
child: _electronicKeyItem(index, 'images/icon_password.png',
|
||||||
),
|
passwordKeyListItem.keyboardPwdName!, useDateStr, () {
|
||||||
child: _electronicKeyItem(index, 'images/icon_password.png', passwordKeyListItem.keyboardPwdName!, useDateStr, () {
|
Navigator.pushNamed(context, Routers.passwordKeyDetailPage,
|
||||||
Navigator.pushNamed(context, Routers.passwordKeyDetailPage,
|
arguments: {"itemData": passwordKeyListItem})
|
||||||
arguments: {"itemData": passwordKeyListItem}).then((val) {
|
.then((val) {
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
logic.pageNo = 1;
|
getHttpData(isRefresh: true);
|
||||||
getHttpData();
|
}
|
||||||
}
|
});
|
||||||
});
|
}),
|
||||||
}),
|
);
|
||||||
);
|
},
|
||||||
},
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
return const Divider(
|
||||||
return const Divider(
|
height: 1,
|
||||||
height: 1,
|
color: AppColors.greyLineColor,
|
||||||
color: AppColors.greyLineColor,
|
);
|
||||||
);
|
},
|
||||||
},
|
),
|
||||||
),
|
));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _electronicKeyItem(int itemIndex, String lockTypeIcon, String lockTypeTitle, String useDateStr, Function()? action) {
|
Widget _electronicKeyItem(int itemIndex, String lockTypeIcon,
|
||||||
|
String lockTypeTitle, String useDateStr, Function()? action) {
|
||||||
PasswordKeyListItem passwordKeyListItem = state.itemDataList[itemIndex];
|
PasswordKeyListItem passwordKeyListItem = state.itemDataList[itemIndex];
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
@ -185,8 +196,14 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(width: 30.w),
|
SizedBox(width: 30.w),
|
||||||
Image.asset(lockTypeIcon, width: 60.w, height: 60.w,),
|
Image.asset(
|
||||||
SizedBox(width: 20.w,),
|
lockTypeIcon,
|
||||||
|
width: 60.w,
|
||||||
|
height: 60.w,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@ -194,22 +211,28 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: passwordKeyListItem.keyboardPwdStatus == 2 ? 1.sw - 110.w - 100.w : 1.sw - 110.w - 50.w,
|
width: passwordKeyListItem.keyboardPwdStatus == 2
|
||||||
child: Row(
|
? 1.sw - 110.w - 100.w
|
||||||
children: [
|
: 1.sw - 110.w - 50.w,
|
||||||
Flexible(
|
child: Row(children: [
|
||||||
child: Text(
|
Flexible(
|
||||||
lockTypeTitle,
|
child: Text(lockTypeTitle,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor)
|
style: TextStyle(
|
||||||
),
|
fontSize: 24.sp,
|
||||||
)
|
color: AppColors.blackColor)),
|
||||||
]
|
)
|
||||||
),
|
]),
|
||||||
),
|
),
|
||||||
SizedBox(width: 10.w),
|
SizedBox(width: 10.w),
|
||||||
passwordKeyListItem.keyboardPwdStatus == 2 ? Text('已过期'.tr, style: TextStyle(color: Colors.red, fontSize: 20.sp),) : Container(),
|
passwordKeyListItem.keyboardPwdStatus == 2
|
||||||
|
? Text(
|
||||||
|
'已过期'.tr,
|
||||||
|
style:
|
||||||
|
TextStyle(color: Colors.red, fontSize: 20.sp),
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
// SizedBox(width: 15.w)
|
// SizedBox(width: 15.w)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -222,7 +245,9 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
|
|||||||
useDateStr,
|
useDateStr,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(fontSize: 18.sp, color: AppColors.placeholderTextColor),
|
style: TextStyle(
|
||||||
|
fontSize: 18.sp,
|
||||||
|
color: AppColors.placeholderTextColor),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -288,5 +313,4 @@ class _PasswordKeyListPageState extends State<PasswordKeyListPage> with RouteAwa
|
|||||||
state.ifCurrentScreen.value = false;
|
state.ifCurrentScreen.value = false;
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||||
@ -27,7 +26,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
/// getKeyType 单次1 永久2 限期3 删除4 周未循环5 每日循环6 工作日循环7 周一循环8 周二循环9 周三循环10 周四循环11 周五循环12 周六循环13 周天循环14
|
/// getKeyType 单次1 永久2 限期3 删除4 周未循环5 每日循环6 工作日循环7 周一循环8 周二循环9 周三循环10 周四循环11 周五循环12 周六循环13 周天循环14
|
||||||
//获取密码请求
|
//获取密码请求
|
||||||
Future<void> getKeyboardPwdRequest() async {
|
Future<void> getKeyboardPwdRequest() async {
|
||||||
final int startDate = DateTool().dateToTimestamp(state.beginTime.value, 1);
|
int startDate = DateTool().dateToTimestamp(state.beginTime.value, 1);
|
||||||
final int endDate = DateTool().dateToTimestamp(state.endTime.value, 1);
|
final int endDate = DateTool().dateToTimestamp(state.endTime.value, 1);
|
||||||
final String lockId = state.keyInfo.value.lockId.toString();
|
final String lockId = state.keyInfo.value.lockId.toString();
|
||||||
String getKeyType = '0';
|
String getKeyType = '0';
|
||||||
@ -40,20 +39,33 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
if (state.widgetType.value == 0) {
|
if (state.widgetType.value == 0) {
|
||||||
//永久
|
//永久
|
||||||
getKeyType = '2';
|
getKeyType = '2';
|
||||||
|
//永久密码startTime传当前时间戳
|
||||||
|
startDate = DateTime.now().millisecondsSinceEpoch;
|
||||||
} else if (state.widgetType.value == 1) {
|
} else if (state.widgetType.value == 1) {
|
||||||
//限时
|
//限时
|
||||||
// 鑫鸿佳不需要生效时间
|
// 鑫鸿佳不需要生效时间
|
||||||
if(CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XHJ && (CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XHJ_SYD || CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XHJ_JL)){
|
if (CommonDataManage().currentKeyInfo.vendor ==
|
||||||
if (endDate <= DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
IoModelVendor.vendor_XHJ &&
|
||||||
|
(CommonDataManage().currentKeyInfo.model ==
|
||||||
|
IoModelVendor.model_XHJ_SYD ||
|
||||||
|
CommonDataManage().currentKeyInfo.model ==
|
||||||
|
IoModelVendor.model_XHJ_JL)) {
|
||||||
|
if (endDate <=
|
||||||
|
DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
||||||
showToast('失效时间要大于当前时间'.tr);
|
showToast('失效时间要大于当前时间'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 芯连需要生效时间
|
// 芯连需要生效时间
|
||||||
if(CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL && (CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_BLE || CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_WIFI)){
|
if (CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL &&
|
||||||
|
(CommonDataManage().currentKeyInfo.model ==
|
||||||
|
IoModelVendor.model_XL_BLE ||
|
||||||
|
CommonDataManage().currentKeyInfo.model ==
|
||||||
|
IoModelVendor.model_XL_WIFI)) {
|
||||||
//限时
|
//限时
|
||||||
if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
if (startDate <
|
||||||
|
DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
||||||
showToast('生效时间不能小于当前时间'.tr);
|
showToast('生效时间不能小于当前时间'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -72,8 +84,13 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
} else if (state.widgetType.value == 4) {
|
} else if (state.widgetType.value == 4) {
|
||||||
//循环
|
//循环
|
||||||
// 芯连需要结束时间
|
// 芯连需要结束时间
|
||||||
if(CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL && (CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_BLE || CommonDataManage().currentKeyInfo.model == IoModelVendor.model_XL_WIFI)){
|
if (CommonDataManage().currentKeyInfo.vendor == IoModelVendor.vendor_XL &&
|
||||||
if (endDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
(CommonDataManage().currentKeyInfo.model ==
|
||||||
|
IoModelVendor.model_XL_BLE ||
|
||||||
|
CommonDataManage().currentKeyInfo.model ==
|
||||||
|
IoModelVendor.model_XL_WIFI)) {
|
||||||
|
if (endDate <
|
||||||
|
DateTool().dateToTimestamp(DateTool().getNowDateWithType(3), 1)) {
|
||||||
showToast('结束时间不能小于当前时间'.tr);
|
showToast('结束时间不能小于当前时间'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -116,7 +133,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
startDate: startDate.toString(),
|
startDate: startDate.toString(),
|
||||||
startHours: state.loopStartHours.value,
|
startHours: state.loopStartHours.value,
|
||||||
endHours: state.loopEndHours.value,
|
endHours: state.loopEndHours.value,
|
||||||
isCoerced: 1);
|
isCoerced: 2);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.isSendSuccess.value = true;
|
state.isSendSuccess.value = true;
|
||||||
state.sendSucceedType.value = state.widgetType.value;
|
state.sendSucceedType.value = state.widgetType.value;
|
||||||
@ -142,19 +159,20 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
//是否为永久
|
//是否为永久
|
||||||
if (state.isPermanent.value == false) {
|
if (state.isPermanent.value == false) {
|
||||||
getKeyType = '3';
|
getKeyType = '3';
|
||||||
getEffectiveDateTime = DateTool().dateToTimestamp(state.customBeginTime.value, 1).toString();
|
getEffectiveDateTime =
|
||||||
getFailureDateTime = DateTool().dateToTimestamp(state.customEndTime.value, 1).toString();
|
DateTool().dateToTimestamp(state.customBeginTime.value, 1).toString();
|
||||||
|
getFailureDateTime =
|
||||||
|
DateTool().dateToTimestamp(state.customEndTime.value, 1).toString();
|
||||||
}
|
}
|
||||||
final PasswordKeyEntity entity = await ApiRepository.to.addPasswordKey(
|
final PasswordKeyEntity entity = await ApiRepository.to.addPasswordKey(
|
||||||
lockId:lockId,
|
lockId: lockId,
|
||||||
keyboardPwdName:state.nameController.text,
|
keyboardPwdName: state.nameController.text,
|
||||||
keyboardPwd:state.pwdController.text,
|
keyboardPwd: state.pwdController.text,
|
||||||
keyboardPwdType:getKeyType,
|
keyboardPwdType: getKeyType,
|
||||||
startDate:getEffectiveDateTime,
|
startDate: getEffectiveDateTime,
|
||||||
endDate:getFailureDateTime,
|
endDate: getFailureDateTime,
|
||||||
addType:'1',
|
addType: '1',
|
||||||
pwdRight:state.isAdministrator.value == true ? 1 : 0
|
pwdRight: state.isAdministrator.value == true ? 1 : 0);
|
||||||
);
|
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
state.isSendSuccess.value = true;
|
state.isSendSuccess.value = true;
|
||||||
state.sendSucceedType.value = state.widgetType.value;
|
state.sendSucceedType.value = state.widgetType.value;
|
||||||
@ -189,10 +207,12 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
showToast('请输入密码'.tr);
|
showToast('请输入密码'.tr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final PasswordKeyEntity entity = await ApiRepository.to.checkKeyboardpwdName(
|
final PasswordKeyEntity entity =
|
||||||
lockId:state.keyInfo.value.lockId.toString(),
|
await ApiRepository.to.checkKeyboardpwdName(
|
||||||
keyboardPwdName:state.nameController.text,
|
lockId: state.keyInfo.value.lockId.toString(),
|
||||||
keyboardPwd:state.pwdController.text,);
|
keyboardPwdName: state.nameController.text,
|
||||||
|
keyboardPwd: state.pwdController.text,
|
||||||
|
);
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
senderCustomPasswords();
|
senderCustomPasswords();
|
||||||
} else {
|
} else {
|
||||||
@ -204,9 +224,11 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
// 监听设备返回的数据
|
// 监听设备返回的数据
|
||||||
late StreamSubscription<Reply> _replySubscription;
|
late StreamSubscription<Reply> _replySubscription;
|
||||||
void _initReplySubscription() {
|
void _initReplySubscription() {
|
||||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
_replySubscription =
|
||||||
|
EventBusManager().eventBus!.on<Reply>().listen((Reply reply) async {
|
||||||
// 设置自定义密码
|
// 设置自定义密码
|
||||||
if ((reply is SenderCustomPasswordsReply) && (state.ifCurrentScreen.value == true)) {
|
if ((reply is SenderCustomPasswordsReply) &&
|
||||||
|
(state.ifCurrentScreen.value == true)) {
|
||||||
final int status = reply.data[2];
|
final int status = reply.data[2];
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
@ -218,33 +240,33 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
state.pwdNumber.value = listChangInt(reply.data.sublist(9, 11));
|
state.pwdNumber.value = listChangInt(reply.data.sublist(9, 11));
|
||||||
// AppLog.log("密码编号:${state.pwdNumber.value}");
|
// AppLog.log("密码编号:${state.pwdNumber.value}");
|
||||||
|
|
||||||
switch(reply.data[11]){
|
switch (reply.data[11]) {
|
||||||
case 0:
|
case 0:
|
||||||
// 成功
|
// 成功
|
||||||
addKeyboardPwdRequest();
|
addKeyboardPwdRequest();
|
||||||
break;
|
break;
|
||||||
case 0xff:
|
case 0xff:
|
||||||
// 注册人脸失败
|
// 注册人脸失败
|
||||||
showToast('退出添加'.tr);
|
showToast('退出添加'.tr);
|
||||||
break;
|
break;
|
||||||
case 0xFE:
|
case 0xFE:
|
||||||
// 管理员已满
|
// 管理员已满
|
||||||
showToast('管理员已满'.tr);
|
showToast('管理员已满'.tr);
|
||||||
break;
|
break;
|
||||||
case 0xFD:
|
case 0xFD:
|
||||||
// 用户已满
|
// 用户已满
|
||||||
showToast('用户已满'.tr);
|
showToast('用户已满'.tr);
|
||||||
break;
|
break;
|
||||||
case 0xFC:
|
case 0xFC:
|
||||||
// 指纹已满
|
// 指纹已满
|
||||||
showToast('锁上面添加密码已满'.tr);
|
showToast('锁上面添加密码已满'.tr);
|
||||||
break;
|
break;
|
||||||
case 0xFB:
|
case 0xFB:
|
||||||
// 指纹已存在
|
// 指纹已存在
|
||||||
showToast('密码已存在'.tr);
|
showToast('密码已存在'.tr);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// 添加密码
|
// 添加密码
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -255,14 +277,20 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
final List<String> saveStrList = changeIntListToStringList(token);
|
final List<String> saveStrList = changeIntListToStringList(token);
|
||||||
Storage.setStringList(saveBlueToken, saveStrList);
|
Storage.setStringList(saveBlueToken, saveStrList);
|
||||||
|
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey =
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
|
final List<int> signKeyDataList =
|
||||||
|
changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
int startDate = DateTool().dateToTimestamp(state.customBeginTime.value, 1);
|
int startDate =
|
||||||
int endDate = DateTool().dateToTimestamp(state.customEndTime.value, 1);
|
DateTool().dateToTimestamp(state.customBeginTime.value, 1);
|
||||||
|
int endDate =
|
||||||
|
DateTool().dateToTimestamp(state.customEndTime.value, 1);
|
||||||
//非永久 须有时限
|
//非永久 须有时限
|
||||||
if (state.isPermanent.value == true) {
|
if (state.isPermanent.value == true) {
|
||||||
startDate = 0;
|
startDate = 0;
|
||||||
@ -272,12 +300,12 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
keyID: '1',
|
keyID: '1',
|
||||||
userID: await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
pwdNo: 0,
|
pwdNo: 0,
|
||||||
pwd:state.pwdController.text,
|
pwd: state.pwdController.text,
|
||||||
operate: 0,
|
operate: 0,
|
||||||
isAdmin: state.isAdministrator.value == true ? 1 : 0,
|
isAdmin: state.isAdministrator.value == true ? 1 : 0,
|
||||||
useCountLimit: 0xffff,
|
useCountLimit: 0xffff,
|
||||||
startTime: startDate ~/1000,
|
startTime: startDate ~/ 1000,
|
||||||
endTime: endDate ~/1000,
|
endTime: endDate ~/ 1000,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
isBeforeAddUser: false,
|
isBeforeAddUser: false,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
@ -311,7 +339,8 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
int endDate = DateTool().dateToTimestamp(state.customEndTime.value, 1);
|
int endDate = DateTool().dateToTimestamp(state.customEndTime.value, 1);
|
||||||
//非永久 须有时限
|
//非永久 须有时限
|
||||||
if (state.isPermanent.value == false) {
|
if (state.isPermanent.value == false) {
|
||||||
if (startDate < DateTool().dateToTimestamp(DateTool().getNowDateWithType(2), 1)) {
|
if (startDate <
|
||||||
|
DateTool().dateToTimestamp(DateTool().getNowDateWithType(2), 1)) {
|
||||||
showToast('生效时间要大于当前时间');
|
showToast('生效时间要大于当前时间');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -320,33 +349,38 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
showToast('失效时间需大于生效时间');
|
showToast('失效时间需大于生效时间');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
startDate = 0;
|
startDate = 0;
|
||||||
endDate = 0;
|
endDate = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.pwdController.text.length < 6 || state.pwdController.text.length > 9) {
|
if (state.pwdController.text.length < 6 ||
|
||||||
|
state.pwdController.text.length > 9) {
|
||||||
showToast('请输入6-9位数字密码');
|
showToast('请输入6-9位数字密码');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(state.sureBtnState.value == 1){
|
if (state.sureBtnState.value == 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state.sureBtnState.value = 1;
|
state.sureBtnState.value = 1;
|
||||||
|
|
||||||
showEasyLoading();
|
showEasyLoading();
|
||||||
showBlueConnetctToastTimer(action: (){
|
showBlueConnetctToastTimer(action: () {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
});
|
});
|
||||||
BlueManage().blueSendData(BlueManage().connectDeviceName, (BluetoothConnectionState deviceConnectionState) async {
|
BlueManage().blueSendData(BlueManage().connectDeviceName,
|
||||||
|
(BluetoothConnectionState deviceConnectionState) async {
|
||||||
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
if (deviceConnectionState == BluetoothConnectionState.connected) {
|
||||||
final List<String>? signKey = await Storage.getStringList(saveBlueSignKey);
|
final List<String>? signKey =
|
||||||
|
await Storage.getStringList(saveBlueSignKey);
|
||||||
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
final List<int> signKeyDataList = changeStringListToIntList(signKey!);
|
||||||
|
|
||||||
final List<String>? privateKey = await Storage.getStringList(saveBluePrivateKey);
|
final List<String>? privateKey =
|
||||||
final List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
await Storage.getStringList(saveBluePrivateKey);
|
||||||
|
final List<int> getPrivateKeyList =
|
||||||
|
changeStringListToIntList(privateKey!);
|
||||||
|
|
||||||
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
final List<String>? token = await Storage.getStringList(saveBlueToken);
|
||||||
final List<int> getTokenList = changeStringListToIntList(token!);
|
final List<int> getTokenList = changeStringListToIntList(token!);
|
||||||
@ -355,22 +389,23 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
keyID: '1',
|
keyID: '1',
|
||||||
userID: await Storage.getUid(),
|
userID: await Storage.getUid(),
|
||||||
pwdNo: 0,
|
pwdNo: 0,
|
||||||
pwd:state.pwdController.text,
|
pwd: state.pwdController.text,
|
||||||
operate: 0,
|
operate: 0,
|
||||||
isAdmin: state.isAdministrator.value == true ? 1 : 0,
|
isAdmin: state.isAdministrator.value == true ? 1 : 0,
|
||||||
useCountLimit: 0xffff,
|
useCountLimit: 0xffff,
|
||||||
startTime: startDate ~/1000,
|
startTime: startDate ~/ 1000,
|
||||||
endTime: endDate ~/1000,
|
endTime: endDate ~/ 1000,
|
||||||
needAuthor: 1,
|
needAuthor: 1,
|
||||||
isBeforeAddUser: false,
|
isBeforeAddUser: false,
|
||||||
signKey: signKeyDataList,
|
signKey: signKeyDataList,
|
||||||
privateKey: getPrivateKeyList,
|
privateKey: getPrivateKeyList,
|
||||||
token: getTokenList);
|
token: getTokenList);
|
||||||
} else if (deviceConnectionState == BluetoothConnectionState.disconnected) {
|
} else if (deviceConnectionState ==
|
||||||
|
BluetoothConnectionState.disconnected) {
|
||||||
dismissEasyLoading();
|
dismissEasyLoading();
|
||||||
cancelBlueConnetctToastTimer();
|
cancelBlueConnetctToastTimer();
|
||||||
state.sureBtnState.value = 0;
|
state.sureBtnState.value = 0;
|
||||||
if(state.ifCurrentScreen.value == true){
|
if (state.ifCurrentScreen.value == true) {
|
||||||
showBlueConnetctToast();
|
showBlueConnetctToast();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -393,24 +428,25 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
|
|||||||
case 1:
|
case 1:
|
||||||
//限时 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
//限时 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
|
||||||
useDateStr =
|
useDateStr =
|
||||||
'类型:限时\n有效期:${state.beginTime.value} -- ${state.endTime.value}';
|
'类型:限时\n有效期:${state.beginTime.value} -- ${state.endTime.value}';
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
//单次 只能在开始时间后6小时内使用一次
|
//单次 只能在开始时间后6小时内使用一次
|
||||||
useDateStr =
|
useDateStr =
|
||||||
'类型:单次\n有效期:${state.beginTime.value} -- ${state.endTime.value}';
|
'类型:单次\n有效期:${state.beginTime.value} -- ${state.endTime.value}';
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
//自定义
|
||||||
|
if (state.isPermanent.value == false) {
|
||||||
|
'类型:自定义-限时\n有效期:${state.customBeginTime.value} -- ${state.customEndTime.value}';
|
||||||
|
} else {
|
||||||
|
useDateStr = '类型:自定义-永久';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
|
||||||
//自定义
|
|
||||||
if (state.isPermanent.value == false) {
|
|
||||||
'类型:自定义-限时\n有效期:${state.customBeginTime.value} -- ${state.customEndTime.value}';
|
|
||||||
} else {
|
|
||||||
useDateStr = '类型:自定义-永久';
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 4:
|
case 4:
|
||||||
//周未循环 在周未开始和结束时间指定时间段内有效
|
//周未循环 在周未开始和结束时间指定时间段内有效
|
||||||
useDateStr = '类型:循环\n${state.loopModeStr.value} ${state.loopEffectiveDate.value}:00-${state.loopFailureDate.value}';
|
useDateStr =
|
||||||
|
'类型:循环\n${state.loopModeStr.value} ${state.loopEffectiveDate.value}:00-${state.loopFailureDate.value}';
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
//删除 4 在锁上使用后会删除之前在锁上使用过的密码
|
||||||
|
|||||||
@ -102,7 +102,7 @@ class MineSetLogic extends BaseGetXController {
|
|||||||
UdpHelp().closeUDP();
|
UdpHelp().closeUDP();
|
||||||
logOut();
|
logOut();
|
||||||
BlueManage().disconnect();
|
BlueManage().disconnect();
|
||||||
XSJPushProvider().initLocalNotification(true);
|
XSJPushProvider().initLocalNotification(isCancelLocalPush: true);
|
||||||
Get.offNamedUntil(Routers.starLockLoginPage, (route) => false);
|
Get.offNamedUntil(Routers.starLockLoginPage, (route) => false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -474,7 +474,7 @@ class _MineSetPageState extends State<MineSetPage> with WidgetsBindingObserver {
|
|||||||
IOSFlutterLocalNotificationsPlugin>()
|
IOSFlutterLocalNotificationsPlugin>()
|
||||||
?.requestPermissions(
|
?.requestPermissions(
|
||||||
alert: true,
|
alert: true,
|
||||||
badge: true,
|
badge: false,
|
||||||
sound: true,
|
sound: true,
|
||||||
) ??
|
) ??
|
||||||
false;
|
false;
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import 'dart:io';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||||
import 'package:jpush_flutter/jpush_flutter.dart';
|
import 'package:jpush_flutter/jpush_flutter.dart';
|
||||||
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoEditAccount/minePersonInfoEditAccount/mineUnbindPhoneOrEmail_entity.dart';
|
||||||
import 'package:star_lock/network/api_repository.dart';
|
import 'package:star_lock/network/api_repository.dart';
|
||||||
import 'package:star_lock/tools/baseGetXController.dart';
|
import 'package:star_lock/tools/baseGetXController.dart';
|
||||||
import 'package:star_lock/tools/storage.dart';
|
import 'package:star_lock/tools/storage.dart';
|
||||||
@ -12,63 +13,72 @@ import '../app_settings/app_settings.dart';
|
|||||||
class XSJPushProvider {
|
class XSJPushProvider {
|
||||||
final JPush jpush = JPush();
|
final JPush jpush = JPush();
|
||||||
|
|
||||||
|
// appKey: 251fc8074820d122b6de58d2--鑫泓佳AppKey
|
||||||
|
// appKey: 7ff37d174c1a568a89e98dad--sky
|
||||||
Future<void> initJPushService() async {
|
Future<void> initJPushService() async {
|
||||||
final data = await Storage.getString(saveUserLoginData);
|
final String? data = await Storage.getString(saveUserLoginData);
|
||||||
if (data != null && data.isNotEmpty) {
|
if (data == null || data.isEmpty) {
|
||||||
jpush.setup(
|
AppLog.log('No user data found.');
|
||||||
appKey: "7ff37d174c1a568a89e98dad",
|
return;
|
||||||
channel: "flutter_channel",
|
}
|
||||||
production: false,
|
|
||||||
debug: false,
|
|
||||||
);
|
|
||||||
|
|
||||||
jpush.addEventHandler(
|
jpush.setup(
|
||||||
// 接收通知回调方法。
|
appKey: '251fc8074820d122b6de58d2',
|
||||||
onReceiveNotification: (Map<String, dynamic> message) async {
|
channel: 'flutter_channel',
|
||||||
AppLog.log("flutter onReceiveNotification: $message");
|
production: false,
|
||||||
},
|
debug: true,
|
||||||
// 点击通知回调方法。
|
);
|
||||||
onOpenNotification: (Map<String, dynamic> message) async {
|
|
||||||
AppLog.log("flutter onOpenNotification: $message");
|
|
||||||
},
|
|
||||||
// 接收自定义消息回调方法。
|
|
||||||
onReceiveMessage: (Map<String, dynamic> message) async {
|
|
||||||
AppLog.log("flutter onReceiveMessage: $message");
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
jpush.applyPushAuthority(
|
jpush.addEventHandler(
|
||||||
const NotificationSettingsIOS(sound: true, alert: true, badge: true));
|
onReceiveNotification: (Map<String, dynamic> message) async {
|
||||||
// jpush.setChannelAndSound(
|
AppLog.log('flutter onReceiveNotification: $message');
|
||||||
// channel: "flutter_channel", channelID: "115700", sound: "default");
|
},
|
||||||
|
onOpenNotification: (Map<String, dynamic> message) async {
|
||||||
|
AppLog.log('flutter onOpenNotification: $message');
|
||||||
|
},
|
||||||
|
onReceiveMessage: (Map<String, dynamic> message) async {
|
||||||
|
AppLog.log('flutter onReceiveMessage: $message');
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
// Platform messages may fail, so we use a try/catch PlatformException.
|
jpush.applyPushAuthority(
|
||||||
jpush.getRegistrationID().then((rid) {
|
const NotificationSettingsIOS(sound: true, alert: true, badge: false),
|
||||||
AppLog.log("flutter get registration id : $rid");
|
);
|
||||||
Storage.setString(
|
|
||||||
pushDeviceID,
|
try {
|
||||||
rid,
|
AppLog.log('Fetching registration ID...');
|
||||||
);
|
final String rid = await jpush.getRegistrationID();
|
||||||
pushBindDeviceID(rid, Platform.isAndroid ? 10 : 20);
|
AppLog.log('flutter get registration id : $rid');
|
||||||
});
|
await Storage.setString(pushDeviceID, rid);
|
||||||
|
await pushBindDeviceID(rid, Platform.isAndroid ? 10 : 20);
|
||||||
|
} catch (e) {
|
||||||
|
AppLog.log('Error getting registration ID: $e');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void pushBindDeviceID(String deviceID, int deviceType) async {
|
Future<void> pushBindDeviceID(String deviceID, int deviceType) async {
|
||||||
var entity = await ApiRepository.to.pushBindAppId(deviceID, deviceType);
|
try {
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
final MineUnbindPhoneOrEmailEntity entity =
|
||||||
AppLog.log("绑定成功");
|
await ApiRepository.to.pushBindAppId(deviceID, deviceType);
|
||||||
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
|
AppLog.log('绑定成功');
|
||||||
|
} else {
|
||||||
|
AppLog.log('绑定失败');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
AppLog.log('Error binding device ID: $e');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//本地通知初始化 isCancelLocalPush 是否取消所有本地通知
|
//本地通知初始化 isCancelLocalPush 是否取消所有本地通知
|
||||||
initLocalNotification(bool isCancelLocalPush) async {
|
Future<void> initLocalNotification({required bool isCancelLocalPush}) async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
|
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
|
||||||
FlutterLocalNotificationsPlugin();
|
FlutterLocalNotificationsPlugin();
|
||||||
const AndroidInitializationSettings initializationSettingsAndroid =
|
|
||||||
AndroidInitializationSettings('app_icon');
|
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
|
const AndroidInitializationSettings initializationSettingsAndroid =
|
||||||
|
AndroidInitializationSettings('app_icon');
|
||||||
const InitializationSettings initializationSettings =
|
const InitializationSettings initializationSettings =
|
||||||
InitializationSettings(android: initializationSettingsAndroid);
|
InitializationSettings(android: initializationSettingsAndroid);
|
||||||
await flutterLocalNotificationsPlugin.initialize(initializationSettings);
|
await flutterLocalNotificationsPlugin.initialize(initializationSettings);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user