From 725da55d6d38254535c4359d10869f34f9f1c0a0 Mon Sep 17 00:00:00 2001
From: GeJiaXiang <353358601@qq.com>
Date: Wed, 24 Jan 2024 16:02:57 +0800
Subject: [PATCH 1/2] fix profile build err.
---
star_lock/android/app/src/profile/AndroidManifest.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/star_lock/android/app/src/profile/AndroidManifest.xml b/star_lock/android/app/src/profile/AndroidManifest.xml
index bd99c894..7b0b93a4 100644
--- a/star_lock/android/app/src/profile/AndroidManifest.xml
+++ b/star_lock/android/app/src/profile/AndroidManifest.xml
@@ -10,7 +10,7 @@
-
+
From 760f0e95ca46702897ae8b6ff719e771cdf7e2c7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=AD=8F=E5=B0=91=E9=98=B3?= <786612630@qq.com>
Date: Wed, 24 Jan 2024 18:44:34 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=89=E5=8D=93?=
=?UTF-8?q?=E5=88=86=E4=BA=AB=EF=BC=8C=E8=B0=83=E8=AF=95=E6=B6=88=E6=81=AF?=
=?UTF-8?q?=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../kotlin/cn/starlock/lock/MainActivity.kt | 41 ++++++++++
star_lock/images/lan/lan_zh.json | 2 +-
star_lock/ios/Podfile.lock | 28 +++----
star_lock/ios/Runner/CommonDefine.h | 4 +-
star_lock/ios/Runner/XSFlutterManager.m | 2 +-
star_lock/lib/appRouters.dart | 5 +-
.../sendElectronicKey_page.dart | 34 +++-----
.../lockDetail/lockDetail_page.dart | 15 ----
.../passwordKeyDetail_logic.dart | 77 +++++++++++++++++-
.../passwordKeyDetail_page.dart | 33 +++-----
.../passwordKey_perpetual_logic.dart | 67 +++++++++++++++
.../passwordKey_perpetual_page.dart | 80 +++++++++++++-----
.../passwordKey_perpetual_state.dart | 27 ++-----
.../messageDetail/messageDetail_logic.dart | 37 +++++++++
.../messageDetail/messageDetail_page.dart | 49 +++++++++++
.../messageDetail/messageDetail_state.dart | 12 +++
.../messageList/messageList_entity.dart | 81 +++++++++++++++++++
.../messageList/messageList_logic.dart | 54 +++++++++++++
.../{ => messageList}/messageList_page.dart | 58 ++++++-------
.../messageList/messageList_state.dart | 10 +++
star_lock/lib/network/api.dart | 7 +-
star_lock/lib/network/api_provider.dart | 16 ++++
star_lock/lib/network/api_repository.dart | 19 +++++
.../lib/tools/NativeInteractionTool.dart | 18 +++++
star_lock/lib/tools/eventBusEventManage.dart | 5 ++
25 files changed, 627 insertions(+), 154 deletions(-)
create mode 100644 star_lock/lib/mine/message/messageDetail/messageDetail_logic.dart
create mode 100644 star_lock/lib/mine/message/messageDetail/messageDetail_page.dart
create mode 100644 star_lock/lib/mine/message/messageDetail/messageDetail_state.dart
create mode 100644 star_lock/lib/mine/message/messageList/messageList_entity.dart
create mode 100644 star_lock/lib/mine/message/messageList/messageList_logic.dart
rename star_lock/lib/mine/message/{ => messageList}/messageList_page.dart (60%)
create mode 100644 star_lock/lib/mine/message/messageList/messageList_state.dart
create mode 100644 star_lock/lib/tools/NativeInteractionTool.dart
diff --git a/star_lock/android/app/src/main/kotlin/cn/starlock/lock/MainActivity.kt b/star_lock/android/app/src/main/kotlin/cn/starlock/lock/MainActivity.kt
index ddc1df7b..9d1689e4 100644
--- a/star_lock/android/app/src/main/kotlin/cn/starlock/lock/MainActivity.kt
+++ b/star_lock/android/app/src/main/kotlin/cn/starlock/lock/MainActivity.kt
@@ -1,10 +1,14 @@
package cn.starlock.lock
+import android.content.Intent
+import android.net.Uri
import android.os.Bundle
import android.util.Log
import com.alibaba.sdk.android.push.noonesdk.PushServiceFactory
import com.aliyun.ams.emas.push.CommonCallback
import io.flutter.embedding.android.FlutterActivity
+import io.flutter.plugin.common.MethodChannel
+import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.plugins.GeneratedPluginRegistrant
@@ -12,6 +16,29 @@ class MainActivity: FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
initAliyunPushService()
+
+ GeneratedPluginRegistrant.registerWith(flutterEngine!!)
+ MethodChannel(flutterEngine?.dartExecutor!!.binaryMessenger, "starLockFlutterSend").setMethodCallHandler { call, result ->
+ if (call.method == "loadNativeShare") {
+ var map = call.arguments as Map
+ shareText(map["shareText"], "分享")
+ } else {
+ result.notImplemented() // 没有实现的方法
+ }
+ }
+ }
+
+ fun shareText(text: String?, subject: String = "", imageUrl: String = "") {
+ val shareIntent = Intent().apply {
+ action = Intent.ACTION_SEND
+ putExtra(Intent.EXTRA_TEXT, text)
+ type = "text/plain"
+// putExtra(Intent.EXTRA_SUBJECT, subject)
+// putExtra(Intent.EXTRA_STREAM, Uri.parse(imageUrl))
+// type = "image/*"
+// addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
+ }
+ startActivity(Intent.createChooser(shareIntent, null))
}
private fun initAliyunPushService() {
@@ -30,4 +57,18 @@ class MainActivity: FlutterActivity() {
pushService.register(applicationContext,callback)
}
+
+ override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
+ GeneratedPluginRegistrant.registerWith(flutterEngine);
+ MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "starLockFlutterSend").setMethodCallHandler {
+ call, result ->
+ println("methodmethodmethod: ${call.method}")
+ // 在这里处理从 Flutter 发送过来的方法调用
+ if (call.method == "loadNativeShare") {
+ println("methodmethodmethod: ${call.method}")
+ } else {
+ result.notImplemented()
+ }
+ }
+ }
}
diff --git a/star_lock/images/lan/lan_zh.json b/star_lock/images/lan/lan_zh.json
index 8a5e56cb..fece2dbb 100644
--- a/star_lock/images/lan/lan_zh.json
+++ b/star_lock/images/lan/lan_zh.json
@@ -60,7 +60,7 @@
"pleaseNameYourPassword":"请给密码命名",
"pleaseEnterDigitsNumber":"请输入6-9位数字",
"getPasswordTip1":"密码在24小时内至少要使用过一次,否则将无效",
- "getPasswordTip2":"限时密码可以再有下期内不限次数使用 \n密码在生效后的24小时内至少要使用过一次,否则将失效",
+ "getPasswordTip2":"限时密码可以在有效期内不限次数使用 \n密码在生效后的24小时内至少要使用过一次,否则将失效",
"getPasswordTip3":"密码有限期为6个小时,只能使用一次",
"getPasswordTip4":"手动输入6-9位数字作为密码。可在锁旁边通过手机蓝牙添加,也可以通过网关远程添加",
"getPasswordTip5":"限时密码可以再有下期内不限次数使用 \n密码在生效后的24小时内至少要使用过一次,否则将失效",
diff --git a/star_lock/ios/Podfile.lock b/star_lock/ios/Podfile.lock
index a86bb578..2d0a0ce7 100644
--- a/star_lock/ios/Podfile.lock
+++ b/star_lock/ios/Podfile.lock
@@ -63,7 +63,7 @@ PODS:
- Flutter
- google_maps_flutter_ios (0.0.1):
- Flutter
- - GoogleMaps (< 8.0)
+ - GoogleMaps (< 9.0)
- GoogleMaps (6.2.1):
- GoogleMaps/Maps (= 6.2.1)
- GoogleMaps/Base (6.2.1)
@@ -85,7 +85,7 @@ PODS:
- FlutterMacOS
- permission_handler_apple (9.1.1):
- Flutter
- - Protobuf (3.25.0)
+ - Protobuf (3.25.1)
- ReachabilitySwift (5.0.0)
- reactive_ble_mobile (0.0.1):
- Flutter
@@ -97,7 +97,7 @@ PODS:
- sqflite (0.0.3):
- Flutter
- FMDB (>= 2.7.5)
- - SwiftProtobuf (1.25.1)
+ - SwiftProtobuf (1.25.2)
- Toast (4.0.0)
- url_launcher_ios (0.0.1):
- Flutter
@@ -241,7 +241,7 @@ SPEC CHECKSUMS:
audio_session: 4f3e461722055d21515cf3261b64c973c062f345
audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40
auto_orientation: 102ed811a5938d52c86520ddd7ecd3a126b5d39d
- camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb
+ camera_avfoundation: 8b8d780bcfb6a4a02b0fbe2b4bd17b5b71946e68
connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d
device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed
EMASRest: 8df6f87836767a9415ad5cc4af739bc9d215b475
@@ -251,30 +251,30 @@ SPEC CHECKSUMS:
flutter_sound: c60effa2a350fb977885f0db2fbc4c1ad5160900
flutter_sound_core: 26c10e5832e76aaacfae252d8925232281c486ae
flutter_voice_processor: 53afbf59ad3feb82f4a379fea9ed8dc98495210f
- fluttertoast: fafc4fa4d01a6a9e4f772ecd190ffa525e9e2d9c
+ fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
g711_flutter: 8f2769052d2cf3549f83d11e1c42d81d94441123
- google_maps_flutter_ios: abdac20d6ce8931f6ebc5f46616df241bfaa2cfd
+ google_maps_flutter_ios: d1318b4ff711612cab16862d7a87e31a7403d458
GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4
image_gallery_saver: cb43cc43141711190510e92c460eb1655cd343cb
- image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
+ image_picker_ios: 99dfe1854b4fa34d0364e74a78448a0151025425
ios-voice-processor: 8e32d7f980a06d392d128ef1cd19cf6ddcaca3c1
just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa
network_info_plus: 6d0c3eb8367b8164fa3fb0c19875e3f59d49697f
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
- path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
+ path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
- Protobuf: 6a4183ec1d51649eb2be7b86ccc286e5c539219c
+ Protobuf: d94761c33f1239c0a43a0817ca1a5f7f7c900241
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
reactive_ble_mobile: 9ce6723d37ccf701dbffd202d487f23f5de03b4c
- shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
+ shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
- SwiftProtobuf: 69f02cd54fb03201c5e6bf8b76f687c5ef7541a3
+ SwiftProtobuf: 407a385e97fd206c4fbe880cc84123989167e0d1
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
- url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b
+ url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812
video_player_avfoundation: 81e49bb3d9fb63dccf9fa0f6d877dc3ddbeac126
- webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a
+ webview_flutter_wkwebview: 4f3e50f7273d31e5500066ed267e3ae4309c5ae4
PODFILE CHECKSUM: 42aa7ffc6134b996f93caa6a9b6a2b5b580ff28a
-COCOAPODS: 1.12.1
+COCOAPODS: 1.14.3
diff --git a/star_lock/ios/Runner/CommonDefine.h b/star_lock/ios/Runner/CommonDefine.h
index 2f437e76..4f0b7bf5 100644
--- a/star_lock/ios/Runner/CommonDefine.h
+++ b/star_lock/ios/Runner/CommonDefine.h
@@ -10,9 +10,9 @@
/** 信号通道,须与flutter里一致*/
-#define XSflutterMethodChannel @"talkPlugin"
+#define XSflutterMethodChannel @"starLockFlutterSend"
/** 交互方法字段名,须与flutter里一致*/
-#define XSflutterMethodSharePassword @"flutter_sharePassword_to_ios"//分享密码
+#define XSflutterMethodSharePassword @"loadNativeShare"//分享密码
#define XSflutterMethodPresent @"flutter_present_to_ios"
#define XSflutterMethodVideoTalk @"videoTalk"//视频对讲
diff --git a/star_lock/ios/Runner/XSFlutterManager.m b/star_lock/ios/Runner/XSFlutterManager.m
index a3363373..6505e456 100644
--- a/star_lock/ios/Runner/XSFlutterManager.m
+++ b/star_lock/ios/Runner/XSFlutterManager.m
@@ -50,7 +50,7 @@
if ([params isKindOfClass:[NSDictionary class]]) {
NSDictionary *paramDic = (NSDictionary *)params;
//分享的标题
- self.textToShare = paramDic[@"pwdShareStr"];
+ self.textToShare = paramDic[@"shareText"];
}
//分享的url
NSURL *urlToShare = [NSURL URLWithString:@"https://pre.lock.star-lock.cn:8093/login"];
diff --git a/star_lock/lib/appRouters.dart b/star_lock/lib/appRouters.dart
index 711556e1..69ae1e8f 100644
--- a/star_lock/lib/appRouters.dart
+++ b/star_lock/lib/appRouters.dart
@@ -146,7 +146,8 @@ import 'mine/gateway/gatewayConnectionLock/gatewayConnectionLockList_page.dart';
import 'mine/gateway/gatewayDetail/gatewayDetail_page.dart';
import 'mine/gateway/gatewayList/gatewayList_page.dart';
import 'mine/mall/mall_page.dart';
-import 'mine/message/messageList_page.dart';
+import 'mine/message/messageDetail/messageDetail_page.dart';
+import 'mine/message/messageList/messageList_page.dart';
import 'mine/mine/starLockMine_page.dart';
import 'mine/mineMultiLanguage/mineMultiLanguage_page.dart';
import 'mine/minePersonInfo/minePersonInfoPage/minePersonInfo_page.dart';
@@ -305,6 +306,7 @@ abstract class Routers {
'/GatewayConfigurationWifiPage'; // 我的-网关配置wifi
static const messageListPage = '/MessageListPage'; // 我的-消息
+ static const messageDetailPage = '/MessageDetailPage'; // 我的-消息详情
static const supportStaffPage = '/SupportStaffPage'; // 我的-客服
static const valueAddedServicesPage = '/ValueAddedServicesPage'; // 我的-增值服务
static const aboutPage = '/AboutPage'; // 我的-关于
@@ -1019,5 +1021,6 @@ abstract class AppRouters {
GetPage(name: Routers.videoSlotPage, page: (() => const VideoSlotPage())),
GetPage(name: Routers.liveVideoPage, page: (() => const LiveVideoPage())),
GetPage(name: Routers.faceDetailPage, page: (() => const FaceDetailPage())),
+ GetPage(name: Routers.messageDetailPage, page: (() => const MessageDetailPage())),
];
}
diff --git a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart
index 1dac77e1..3261aa5b 100644
--- a/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart
+++ b/star_lock/lib/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_page.dart
@@ -13,6 +13,7 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/storage.dart';
import '../../../../../appRouters.dart';
+import '../../../../../tools/NativeInteractionTool.dart';
import '../../../../../tools/commonItem.dart';
import '../../../../../tools/submitBtn.dart';
import '../../../../../translations/trans_lib.dart';
@@ -29,7 +30,6 @@ class SendElectronicKeyPage extends StatefulWidget {
class _SendElectronicKeyPageState extends State {
final logic = Get.put(SendElectronicKeyLogic());
final state = Get.find().state;
- static const methodChannel = MethodChannel('talkPlugin');
bool isDemoMode = false;
@override
@@ -551,7 +551,7 @@ class _SendElectronicKeyPageState extends State {
context: context,
shape: RoundedRectangleBorder(
borderRadius: BorderRadiusDirectional.circular(10)),
- constraints: BoxConstraints(maxHeight: 260.h),
+ constraints: BoxConstraints(maxHeight: 270.h),
builder: (BuildContext context) {
return Column(
children: [
@@ -627,44 +627,36 @@ class _SendElectronicKeyPageState extends State {
}
_jumpSmartDeviceRoute(int itemIndex) {
+ Get.back();
switch (itemIndex) {
case 0:
//微信好友
{
- Navigator.pop(context);
String pwdShareStr = '您好,您的电子钥匙生成成功';
- tokNative('flutter_sharePassword_to_ios',
- arguments: {'pwdShareStr': pwdShareStr}).then((result) {
- print('$result');
- });
- print('与原生交互');
+ NativeInteractionTool.loadNativeShare(shareText:pwdShareStr);
}
break;
case 1:
//短信
- {}
+ {
+ String pwdShareStr = '您好,您的电子钥匙生成成功';
+ NativeInteractionTool.loadNativeShare(shareText:pwdShareStr);
+ }
break;
case 2:
//邮件
{
- Navigator.pop(context);
- Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
+ Get.toNamed(Routers.sendEmailNotificationPage);
}
break;
case 3:
//更多
- {}
+ {
+ String pwdShareStr = '您好,您的电子钥匙生成成功';
+ NativeInteractionTool.loadNativeShare(shareText:pwdShareStr);
+ }
break;
default:
}
}
-
- static Future tokNative(String method,
- {required Map arguments}) async {
- if (arguments == null) {
- return await methodChannel.invokeMethod(method);
- } else {
- return await methodChannel.invokeMethod(method, arguments);
- }
- }
}
diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart
index 95adbbfb..cba25cba 100644
--- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart
+++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart
@@ -31,7 +31,6 @@ class _LockDetailPageState extends State
// with RouteAware
final logic = Get.put(LockDetailLogic());
final state = Get.find().state;
- static const methodChannel = MethodChannel('talkPlugin');
@override
void initState() {
@@ -393,11 +392,6 @@ class _LockDetailPageState extends State
Get.toNamed(Routers.faceList, arguments: {
"lockId": widget.lockListInfoItemEntity.lockId,
}); // Toast.show(msg: "功能暂未开放");
-
- // tokNative('videoTalk',
- // arguments: {'videoTalk': 'videoTalk'}).then((result) {
- // print('$result');
- // });
}),
);
}
@@ -520,15 +514,6 @@ class _LockDetailPageState extends State
return 'images/main/icon_lockElectricLevel_5.png';
}
- static Future tokNative(String method,
- {required Map arguments}) async {
- if (arguments == null) {
- return await methodChannel.invokeMethod(method);
- } else {
- return await methodChannel.invokeMethod(method, arguments);
- }
- }
-
//开锁成功弹出的小界面
void _showFullScreenOverlay(BuildContext context) {
showModalBottomSheet(
diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart
index d1b1384e..74095356 100644
--- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart
+++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_logic.dart
@@ -48,7 +48,7 @@ class PasswordKeyDetailLogic extends BaseGetXController {
}
}
- //使用期限
+ //使用期限详情显示
String getUseDateStr() {
int? getPwdType = state.itemData.value.keyboardPwdType;
String useDateStr = '';
@@ -125,4 +125,79 @@ class PasswordKeyDetailLogic extends BaseGetXController {
return useDateStr;
}
+ String getShareContentStr() {
+ int? getPwdType = state.itemData.value.keyboardPwdType;
+ String useDateStr = '';
+ DateTime startDateStr =
+ DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
+ DateTime endDateStr =
+ DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
+ int starHour = startDateStr.hour;
+ int endHour = endDateStr.hour;
+
+ switch (getPwdType) {
+ case 1:
+ //单次 1 只能在开始时间后6小时内使用一次
+ useDateStr =
+ '类型:永久\n有效期:${startDateStr.toLocal().toString().substring(0, 16)} -- ${endDateStr.toLocal().toString().substring(0, 16)}';
+ break;
+ case 2:
+ //永久 2 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
+ useDateStr = '类型:永久';
+ break;
+ case 3:
+ //限期 3 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
+ useDateStr =
+ '类型:限时\n有效期:${startDateStr.toLocal().toString().substring(0, 16)}-${endDateStr.toLocal().toString().substring(0, 16)}';
+ break;
+ case 4:
+ //删除 4 在锁上使用后会删除之前在锁上使用过的密码
+ useDateStr = '类型:清空';
+ break;
+ case 5:
+ //周未循环 5 在周未开始和结束时间指定时间段内有效
+ useDateStr = '类型:循环\n 周末 $starHour:00-$endHour:00';
+ break;
+ case 6:
+ //每日循环 6 每天开始和结束时间指定时间段内有效
+ useDateStr = '类型:循环\n周日 $starHour:00-$endHour:00';
+ break;
+ case 7:
+ //工作日循环 7 工作日开始和结束时间指定的时间段内有效
+ useDateStr = '类型:循环\n工作日 $starHour:00-$endHour:00';
+ break;
+ case 8:
+ //周一循环 8 每周一开始和结束时间指定时间段内有效
+ useDateStr = '类型:循环\n周一 $starHour:00-$endHour:00';
+ break;
+ case 9:
+ //周二循环 9 每周二开始和结束时间指定时间段内有效
+ useDateStr = '类型:循环\n周二 $starHour:00-$endHour:00';
+ break;
+ case 10:
+ //周三循环 10 每周三开始和结束时间指定时间段内有效
+ useDateStr = '类型:循环\n周三 $starHour:00-$endHour:00';
+ break;
+ case 11:
+ //周四循环 11 每周四开始和结束时间指定时间段内有效
+ useDateStr = '类型:循环\n周四 $starHour:00 -$endHour:00';
+ break;
+ case 12:
+ //周五循环 12 每周五开始和结束时间指定时间段内有效
+ useDateStr = '类型:循环\n周五 $starHour:00-$endHour:00';
+ break;
+ case 13:
+ //周六循环 13 每周六开始和结束时间指定时间段内有效
+ useDateStr = '类型:循环\n周六 $starHour:00-$endHour:00';
+ break;
+ case 14:
+ //周天循环 14 每周日开始和结束时间指定时间段内有效
+ useDateStr = '类型:循环\n周天 $starHour:00-$endHour:00';
+ break;
+
+ default:
+ }
+ return "您好,您的密码是:${state.itemData.value.keyboardPwd}\n$useDateStr\n密码名字:${state.itemData.value.keyboardPwdName}";
+ }
+
}
diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart
index d210f648..14213d9c 100644
--- a/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart
+++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKeyDetail/passwordKeyDetail_page.dart
@@ -8,6 +8,7 @@ import 'package:star_lock/tools/showTFView.dart';
import '../../../../appRouters.dart';
import '../../../../app_settings/app_colors.dart';
+import '../../../../tools/NativeInteractionTool.dart';
import '../../../../tools/commonItem.dart';
import '../../../../tools/showIosTipView.dart';
import '../../../../tools/submitBtn.dart';
@@ -22,7 +23,6 @@ class PasswordKeyDetailPage extends StatefulWidget {
}
class _PasswordKeyDetailPageState extends State {
- static const methodChannel = MethodChannel('talkPlugin');
final logic = Get.put(PasswordKeyDetailLogic());
final state = Get.find().state;
@@ -313,48 +313,37 @@ class _PasswordKeyDetailPageState extends State {
}
_jumpSmartDeviceRoute(int itemIndex) {
+ Get.back();
+ String pwdShareStr = logic.getShareContentStr();
switch (itemIndex) {
case 0:
//微信好友
{
- Navigator.pop(context);
- String pwdShareStr =
- '您好,您的密码是:${state.itemData.value.keyboardPwd}\n生效时间:${state.itemData.value.startDate}\n类型:永久\n锁名:${state.itemData.value.keyboardPwdName}';
- tokNative('flutter_sharePassword_to_ios',
- arguments: {'pwdShareStr': pwdShareStr}).then((result) {
- print('$result');
- });
- print('与原生交互');
+ NativeInteractionTool.loadNativeShare(shareText:pwdShareStr);
}
break;
case 1:
//短信
- {}
+ {
+ NativeInteractionTool.loadNativeShare(shareText:pwdShareStr);
+ }
break;
case 2:
//邮件
{
- Navigator.pop(context);
- Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
+ Get.toNamed(Routers.sendEmailNotificationPage);
}
break;
case 3:
//更多
- {}
+ {
+ NativeInteractionTool.loadNativeShare(shareText:pwdShareStr);
+ }
break;
default:
}
}
- static Future tokNative(String method,
- {required Map arguments}) async {
- if (arguments == null) {
- return await methodChannel.invokeMethod(method);
- } else {
- return await methodChannel.invokeMethod(method, arguments);
- }
- }
-
void showIosTipViewDialog(BuildContext context) {
showDialog(
context: context,
diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart
index 28ea8917..6e208b46 100644
--- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart
+++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart
@@ -113,6 +113,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
print('获取密码成功');
state.isSendSuccess.value = true;
state.sendSucceedType.value = state.widgetType.value;
+ state.pwdNameStr = state.nameController.text;
state.nameController.text = "";
state.pwdController.text = "";
if (entity.data != null) {
@@ -154,6 +155,7 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
print('获取密码成功');
state.isSendSuccess.value = true;
state.sendSucceedType.value = state.widgetType.value;
+ state.pwdNameStr = state.nameController.text;
state.nameController.text = "";
state.pwdController.text = "";
if (entity.data != null) {
@@ -185,6 +187,9 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
case 0x00:
//成功
print("${reply.commandType!.typeValue} 数据解析成功");
+ state.sureBtnState.value = 0;
+ dismissEasyLoading();
+ cancelBlueConnetctToastTimer();
addKeyboardPwdRequest();
break;
case 0x06:
@@ -235,6 +240,16 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
// 设置自定义密码
Future senderCustomPasswords() async {
+ if(state.sureBtnState.value == 1){
+ return;
+ }
+ state.sureBtnState.value = 1;
+
+ showEasyLoading();
+ showBlueConnetctToastTimer(action: (){
+ dismissEasyLoading();
+ state.sureBtnState.value = 0;
+ });
BlueManage().bludSendData(BlueManage().connectDeviceName, (DeviceConnectionState deviceConnectionState) async {
if (deviceConnectionState == DeviceConnectionState.connected) {
var signKey = await Storage.getStringList(saveBlueSignKey);
@@ -259,10 +274,62 @@ class PasswordKeyPerpetualLogic extends BaseGetXController {
signKey: signKeyDataList,
privateKey: getPrivateKeyList,
token: getTokenList);
+ } else if (deviceConnectionState == DeviceConnectionState.disconnected) {
+ dismissEasyLoading();
+ cancelBlueConnetctToastTimer();
+ state.sureBtnState.value = 0;
+ if(state.ifCurrentScreen.value == true){
+ showBlueConnetctToast();
+ }
}
});
}
+ String getShareContentStr() {
+ int? getPwdType = state.widgetType.value;
+ String useDateStr = '';
+ // DateTime startDateStr = DateTime.fromMillisecondsSinceEpoch(state.itemData.value.startDate!);
+ // DateTime endDateStr = DateTime.fromMillisecondsSinceEpoch(state.itemData.value.endDate!);
+ // int starHour = startDateStr.hour;
+ // int endHour = endDateStr.hour;
+
+ switch (getPwdType) {
+ case 0:
+ // 永久 从开始时间开始永久有效,必需在开始时间24小时内使用一次,否则将失效
+ useDateStr = '类型:永久';
+ break;
+ case 1:
+ //限时 在开始和结束时间内有效,必需在开始时间24小时内使用一次,否则将失效
+ useDateStr =
+ '类型:限时\n有效期:${state.selectEffectiveDate.value} -- ${state.selectFailureDate.value}';
+ break;
+ case 2:
+ //单次 只能在开始时间后6小时内使用一次
+ useDateStr =
+ '类型:单次\n有效期:${state.selectEffectiveDate.value} -- ${state.selectFailureDate.value}';
+ break;
+ case 3:
+ //自定义
+ if (state.isPermanent.value == false) {
+ '类型:自定义-限时\n有效期:${state.selectEffectiveDate.value} -- ${state.selectFailureDate.value}';
+ } else {
+ useDateStr = '类型:自定义-永久';
+ }
+ break;
+ case 4:
+ //周未循环 在周未开始和结束时间指定时间段内有效
+ useDateStr = '类型:循环\n${state.loopModeStr.value} ${state.loopEffectiveDate.value}:00-${state.loopFailureDate.value}';
+ break;
+ case 5:
+ //删除 4 在锁上使用后会删除之前在锁上使用过的密码
+ useDateStr = '类型:清空';
+ break;
+
+ default:
+ }
+ return "您好,您的密码是:${state.getPwdStr.value}\n$useDateStr\n密码名字:${state.pwdNameStr}";
+ }
+
@override
void onReady() {
// TODO: implement onReady
diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart
index 8f05461e..e3b914ae 100644
--- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart
+++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_page.dart
@@ -2,6 +2,7 @@ import 'package:date_format/date_format.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart';
@@ -12,6 +13,9 @@ import 'package:star_lock/tools/pickers/time_picker/model/date_mode.dart';
import 'package:star_lock/tools/storage.dart';
import '../../../../appRouters.dart';
+import '../../../../blue/blue_manage.dart';
+import '../../../../tools/NativeInteractionTool.dart';
+import '../../../../tools/appRouteObserver.dart';
import '../../../../tools/commonItem.dart';
import '../../../../tools/submitBtn.dart';
@@ -31,12 +35,10 @@ class PasswordKeyPerpetualPage extends StatefulWidget {
_PasswordKeyPerpetualPageState();
}
-class _PasswordKeyPerpetualPageState extends State {
+class _PasswordKeyPerpetualPageState extends State with RouteAware{
final logic = Get.put(PasswordKeyPerpetualLogic());
final state = Get.find().state;
- static const methodChannel = MethodChannel('talkPlugin');
-
@override
void initState() {
super.initState();
@@ -598,7 +600,7 @@ class _PasswordKeyPerpetualPageState extends State {
context: context,
shape: RoundedRectangleBorder(
borderRadius: BorderRadiusDirectional.circular(10)),
- constraints: BoxConstraints(maxHeight: 260.h),
+ constraints: BoxConstraints(maxHeight: 270.h),
builder: (BuildContext context) {
return Column(
children: [
@@ -675,21 +677,20 @@ class _PasswordKeyPerpetualPageState extends State {
//\n生效时间:${itemData.startDate}\n类型:永久\n锁名:${itemData.keyboardPwdName}
_jumpSmartDeviceRoute(int itemIndex) {
+ Get.back();
+ String pwdShareStr = logic.getShareContentStr();
switch (itemIndex) {
case 0:
//微信好友
{
- String pwdShareStr = '您好,您的密码是:${state.getPwdStr.value}';
- tokNative('flutter_sharePassword_to_ios',
- arguments: {'pwdShareStr': pwdShareStr}).then((result) {
- print('$result');
- });
- print('与原生交互');
+ NativeInteractionTool.loadNativeShare(shareText:pwdShareStr);
}
break;
case 1:
//短信
- {}
+ {
+ NativeInteractionTool.loadNativeShare(shareText:pwdShareStr);
+ }
break;
case 2:
//邮件
@@ -699,18 +700,59 @@ class _PasswordKeyPerpetualPageState extends State {
break;
case 3:
//更多
- {}
+ {
+ NativeInteractionTool.loadNativeShare(shareText:pwdShareStr);
+ }
break;
default:
}
}
- static Future tokNative(String method,
- {required Map arguments}) async {
- if (arguments == null) {
- return await methodChannel.invokeMethod(method);
- } else {
- return await methodChannel.invokeMethod(method, arguments);
- }
+ @override
+ void dispose() {
+ // TODO: implement dispose
+ /// 取消路由订阅
+ AppRouteObserver().routeObserver.unsubscribe(this);
+ super.dispose();
+ }
+
+ /// 从上级界面进入 当前界面即将出现
+ @override
+ void didPush() {
+ super.didPush();
+ print("lockSet===didPush");
+ state.ifCurrentScreen.value = true;
+ }
+
+ /// 返回上一个界面 当前界面即将消失
+ @override
+ void didPop() {
+ super.didPop();
+ print("lockSet===didPop");
+ logic.cancelBlueConnetctToastTimer();
+ if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
+ BlueManage().stopScan();
+ state.ifCurrentScreen.value = false;
+ state.sureBtnState.value = 0;
+ }
+
+ /// 从下级返回 当前界面即将出现
+ @override
+ void didPopNext() {
+ super.didPopNext();
+ print("lockSet===didPopNext");
+ state.ifCurrentScreen.value = true;
+ }
+
+ /// 进入下级界面 当前界面即将消失
+ @override
+ void didPushNext() {
+ super.didPushNext();
+ print("lockSet===didPushNext");
+ logic.cancelBlueConnetctToastTimer();
+ if (EasyLoading.isShow) EasyLoading.dismiss(animation: true);
+ BlueManage().stopScan();
+ state.ifCurrentScreen.value = false;
+ state.sureBtnState.value = 0;
}
}
diff --git a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart
index 96db4879..a97cbb4d 100644
--- a/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart
+++ b/star_lock/lib/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_state.dart
@@ -11,31 +11,13 @@ class PasswordKeyPerpetualState {
final isSendSuccess = false.obs; //是否发送成功
final isPermanent = true.obs; //是否永久
var getPwdStr = ''.obs;
+ var pwdNameStr = '';
final effectiveDateTime = DateTime.now().obs;
final failureDateTime = DateTime.now().obs;
- var selectEffectiveDate = "${formatDate(DateTime.now(), [
- yyyy,
- '-',
- mm,
- '-',
- dd,
- ' ',
- HH,
- ])}:00"
- .obs; //生效时间
-
- var selectFailureDate = "${formatDate(DateTime.now(), [
- yyyy,
- '-',
- mm,
- '-',
- dd,
- ' ',
- HH,
- ])}:00"
- .obs; //失效时间
+ var selectEffectiveDate = "${formatDate(DateTime.now(), [yyyy,'-',mm,'-', dd, ' ', HH,])}:00".obs; //生效时间
+ var selectFailureDate = "${formatDate(DateTime.now(), [yyyy, '-', mm, '-', dd, ' ', HH,])}:00".obs; //失效时间
var loopEffectiveDate = "${formatDate(DateTime.now(), [HH])}:00".obs; //生效时间
var loopFailureDate = "${formatDate(DateTime.now(), [HH])}:00".obs; //失效时间
@@ -46,4 +28,7 @@ class PasswordKeyPerpetualState {
final widgetType = 0.obs;
final sendSucceedType = 0.obs;
final keyInfo = LockListInfoItemEntity().obs;
+
+ var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
+ var sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用)
}
diff --git a/star_lock/lib/mine/message/messageDetail/messageDetail_logic.dart b/star_lock/lib/mine/message/messageDetail/messageDetail_logic.dart
new file mode 100644
index 00000000..72571baa
--- /dev/null
+++ b/star_lock/lib/mine/message/messageDetail/messageDetail_logic.dart
@@ -0,0 +1,37 @@
+
+import 'package:star_lock/tools/baseGetXController.dart';
+import '../../../network/api_repository.dart';
+import '../../../tools/eventBusEventManage.dart';
+import '../messageList/messageList_entity.dart';
+import 'messageDetail_state.dart';
+
+class MessageDetailLogic extends BaseGetXController {
+ final MessageDetailState state = MessageDetailState();
+
+ //请求密码钥匙列表
+ void readMessageDataRequest() async {
+ MessageListEntity entity = await ApiRepository.to.readMessageLoadData(messageId:state.itemData.value.id!);
+ if (entity.errorCode!.codeIsSuccessful) {
+ eventBus.fire(ReadMessageRefreshUI());
+ }
+ }
+
+ @override
+ void onReady() {
+ // TODO: implement onReady
+ super.onReady();
+ readMessageDataRequest();
+ }
+
+ @override
+ void onInit() {
+ // TODO: implement onInit
+ super.onInit();
+ }
+
+ @override
+ void onClose() {
+ // TODO: implement onClose
+ super.onClose();
+ }
+}
\ No newline at end of file
diff --git a/star_lock/lib/mine/message/messageDetail/messageDetail_page.dart b/star_lock/lib/mine/message/messageDetail/messageDetail_page.dart
new file mode 100644
index 00000000..166ee3b1
--- /dev/null
+++ b/star_lock/lib/mine/message/messageDetail/messageDetail_page.dart
@@ -0,0 +1,49 @@
+
+import 'package:flutter/material.dart';
+import 'package:flutter_screenutil/flutter_screenutil.dart';
+import 'package:get/get.dart';
+
+import '../../../app_settings/app_colors.dart';
+import '../../../tools/dateTool.dart';
+import '../../../tools/titleAppBar.dart';
+import 'messageDetail_logic.dart';
+
+class MessageDetailPage extends StatefulWidget {
+ const MessageDetailPage({Key? key}) : super(key: key);
+
+ @override
+ State createState() => _MessageDetailPageState();
+}
+
+class _MessageDetailPageState extends State {
+ final logic = Get.put(MessageDetailLogic());
+ final state = Get.find().state;
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ backgroundColor: AppColors.mainBackgroundColor,
+ appBar: TitleAppBar(
+ barTitle: "消息详情",
+ haveBack: true,
+ backgroundColor: AppColors.mainColor),
+ body: Container(
+ margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 20.h),
+ child: Obx(() => Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ "创建时间:${DateTool().dateToYMDHNString(state.itemData.value.createdAt!.toString())}",
+ style: TextStyle(fontSize: 22.sp, color: AppColors.placeholderTextColor),
+ ),
+ SizedBox(height: 20.h),
+ Text(
+ state.itemData.value.data!,
+ style: TextStyle(fontSize: 22.sp, color: AppColors.placeholderTextColor),
+ ),
+ ],
+ )),
+ )
+ );
+ }
+}
diff --git a/star_lock/lib/mine/message/messageDetail/messageDetail_state.dart b/star_lock/lib/mine/message/messageDetail/messageDetail_state.dart
new file mode 100644
index 00000000..59076210
--- /dev/null
+++ b/star_lock/lib/mine/message/messageDetail/messageDetail_state.dart
@@ -0,0 +1,12 @@
+
+import 'package:get/get.dart';
+import '../messageList/messageList_entity.dart';
+
+class MessageDetailState{
+ final itemData = MessageItemEntity().obs;
+
+ MessageDetailState() {
+ Map map = Get.arguments;
+ itemData.value = map["messageItemEntity"];
+ }
+}
\ No newline at end of file
diff --git a/star_lock/lib/mine/message/messageList/messageList_entity.dart b/star_lock/lib/mine/message/messageList/messageList_entity.dart
new file mode 100644
index 00000000..f768625d
--- /dev/null
+++ b/star_lock/lib/mine/message/messageList/messageList_entity.dart
@@ -0,0 +1,81 @@
+class MessageListEntity {
+ int? errorCode;
+ String? description;
+ String? errorMsg;
+ Data? data;
+
+ MessageListEntity(
+ {this.errorCode, this.description, this.errorMsg, this.data});
+
+ MessageListEntity.fromJson(Map json) {
+ errorCode = json['errorCode'];
+ description = json['description'];
+ errorMsg = json['errorMsg'];
+ data = json['data'] != null ? Data.fromJson(json['data']) : null;
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['errorCode'] = errorCode;
+ data['description'] = description;
+ data['errorMsg'] = errorMsg;
+ if (this.data != null) {
+ data['data'] = this.data!.toJson();
+ }
+ return data;
+ }
+}
+
+class Data {
+ List? list;
+ int? pageNo;
+ int? pageSize;
+
+ Data({this.list, this.pageNo, this.pageSize});
+
+ Data.fromJson(Map json) {
+ if (json['list'] != null) {
+ list = [];
+ json['list'].forEach((v) {
+ list!.add(MessageItemEntity.fromJson(v));
+ });
+ }
+ pageNo = json['pageNo'];
+ pageSize = json['pageSize'];
+ }
+
+ Map toJson() {
+ final Map data = {};
+ if (list != null) {
+ data['list'] = list!.map((v) => v.toJson()).toList();
+ }
+ data['pageNo'] = pageNo;
+ data['pageSize'] = pageSize;
+ return data;
+ }
+}
+
+class MessageItemEntity {
+ String? id;
+ String? data;
+ int? createdAt;
+ int? readAt;
+
+ MessageItemEntity({this.id, this.data, this.createdAt, this.readAt});
+
+ MessageItemEntity.fromJson(Map json) {
+ id = json['id'];
+ data = json['data'];
+ createdAt = json['createdAt'];
+ readAt = json['readAt'];
+ }
+
+ Map toJson() {
+ final Map data = {};
+ data['id'] = id;
+ data['data'] = this.data;
+ data['createdAt'] = createdAt;
+ data['readAt'] = readAt;
+ return data;
+ }
+}
diff --git a/star_lock/lib/mine/message/messageList/messageList_logic.dart b/star_lock/lib/mine/message/messageList/messageList_logic.dart
new file mode 100644
index 00000000..fa929e76
--- /dev/null
+++ b/star_lock/lib/mine/message/messageList/messageList_logic.dart
@@ -0,0 +1,54 @@
+
+import 'dart:async';
+
+import 'package:star_lock/tools/baseGetXController.dart';
+import '../../../network/api_repository.dart';
+import '../../../tools/eventBusEventManage.dart';
+import 'messageList_entity.dart';
+import 'messageList_state.dart';
+
+class MessageListLogic extends BaseGetXController {
+ final MessageListState state = MessageListState();
+
+ //请求密码钥匙列表
+ void messageListDataRequest() async {
+ MessageListEntity entity = await ApiRepository.to.messageListLoadData(
+ pageNo:state.pageNum.toString(),
+ pageSize:state.pageSize.toString());
+ if (entity.errorCode!.codeIsSuccessful) {
+ state.itemDataList.value = entity.data!.list!;
+ }
+ }
+
+ /// 刷新密码列表
+ StreamSubscription? _readMessageRefreshUIEvent;
+ void _readMessageRefreshUIAction() {
+ // 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
+ _readMessageRefreshUIEvent = eventBus.on().listen((event) {
+ messageListDataRequest();
+ });
+ }
+
+ @override
+ void onReady() {
+ // TODO: implement onReady
+ super.onReady();
+ messageListDataRequest();
+
+ _readMessageRefreshUIAction();
+ }
+
+ @override
+ void onInit() {
+ // TODO: implement onInit
+ super.onInit();
+ }
+
+ @override
+ void onClose() {
+ // TODO: implement onClose
+ super.onClose();
+ _readMessageRefreshUIEvent?.cancel();
+ }
+
+}
\ No newline at end of file
diff --git a/star_lock/lib/mine/message/messageList_page.dart b/star_lock/lib/mine/message/messageList/messageList_page.dart
similarity index 60%
rename from star_lock/lib/mine/message/messageList_page.dart
rename to star_lock/lib/mine/message/messageList/messageList_page.dart
index 547ddbdb..97d4a88a 100644
--- a/star_lock/lib/mine/message/messageList_page.dart
+++ b/star_lock/lib/mine/message/messageList/messageList_page.dart
@@ -3,10 +3,13 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:star_lock/tools/noData.dart';
-import '../../appRouters.dart';
-import '../../app_settings/app_colors.dart';
-import '../../tools/titleAppBar.dart';
-import '../../translations/trans_lib.dart';
+import '../../../appRouters.dart';
+import '../../../app_settings/app_colors.dart';
+import '../../../tools/dateTool.dart';
+import '../../../tools/titleAppBar.dart';
+import '../../../translations/trans_lib.dart';
+import 'messageList_entity.dart';
+import 'messageList_logic.dart';
class MessageListPage extends StatefulWidget {
const MessageListPage({Key? key}) : super(key: key);
@@ -16,7 +19,9 @@ class MessageListPage extends StatefulWidget {
}
class _MessageListPageState extends State {
- List dataList = [];
+ final logic = Get.put(MessageListLogic());
+ final state = Get.find().state;
+
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -25,27 +30,25 @@ class _MessageListPageState extends State {
barTitle: TranslationLoader.lanKeys!.message!.tr,
haveBack: true,
backgroundColor: AppColors.mainColor),
- body: dataList.isEmpty
+ body: Obx(() => state.itemDataList.isEmpty
? const NoData()
: ListView.builder(
- itemCount: 10,
- itemBuilder: (c, index) {
- return _selectGatewayListListItem(
- 'images/controls_user.png', "您的钥匙已发送成功", "2023.6.21 11.15",
- () {
- // Navigator.pushNamed(context, Routers.gatewayConfigurationWifiPage);
- });
- }),
+ itemCount: 10,
+ itemBuilder: (c, index) {
+ MessageItemEntity messageItemEntity = state.itemDataList[index];
+ return _selectGatewayListListItem(messageItemEntity, () {
+ Get.toNamed(Routers.messageDetailPage, arguments: {"messageItemEntity": messageItemEntity});
+ });
+ })),
);
}
- Widget _selectGatewayListListItem(String lockTypeIcon, String gateWayName,
- String networkSignal, Function() action) {
+ Widget _selectGatewayListListItem(MessageItemEntity messageItemEntity, Function() action) {
return GestureDetector(
onTap: action,
child: Container(
height: 90.h,
- margin: const EdgeInsets.only(bottom: 2),
+ margin: EdgeInsets.only(bottom: 2.h),
// padding:
// EdgeInsets.only(left: 10.w, right: 20.w, top: 20.h, bottom: 20.h),
decoration: BoxDecoration(
@@ -54,14 +57,6 @@ class _MessageListPageState extends State {
),
child: Row(
children: [
- SizedBox(
- width: 10.w,
- ),
- Image.asset(
- lockTypeIcon,
- width: 50.w,
- height: 50.w,
- ),
SizedBox(
width: 20.w,
),
@@ -73,24 +68,19 @@ class _MessageListPageState extends State {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
- gateWayName,
+ messageItemEntity.data!,
style: TextStyle(
- fontSize: 22.sp, color: AppColors.blackColor),
+ fontSize: 22.sp, color: messageItemEntity.readAt! == 0 ? AppColors.blackColor : AppColors.placeholderTextColor),
),
],
),
- SizedBox(height: 5.h),
+ SizedBox(height: 10.h),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
// Image.asset('images/mine/icon_mine_gatewaySignal_strong.png', width: 40.w, height: 40.w,),
// SizedBox(width: 10.w,),
- Text(
- networkSignal,
- style: TextStyle(
- fontSize: 18.sp,
- color: AppColors.placeholderTextColor),
- ),
+ Text(DateTool().dateToYMDHNString(messageItemEntity.createdAt!.toString()), style: TextStyle(fontSize: 18.sp, color: messageItemEntity.readAt! == 0 ? AppColors.blackColor : AppColors.placeholderTextColor)),
],
),
SizedBox(width: 20.h),
diff --git a/star_lock/lib/mine/message/messageList/messageList_state.dart b/star_lock/lib/mine/message/messageList/messageList_state.dart
new file mode 100644
index 00000000..eec1e217
--- /dev/null
+++ b/star_lock/lib/mine/message/messageList/messageList_state.dart
@@ -0,0 +1,10 @@
+
+import 'package:get/get.dart';
+import 'messageList_entity.dart';
+
+class MessageListState{
+ var pageNum = 1.obs; //请求页码
+ final pageSize = 20.obs; //请求每页数据条数
+ final itemDataList = [].obs;
+
+}
\ No newline at end of file
diff --git a/star_lock/lib/network/api.dart b/star_lock/lib/network/api.dart
index ac9cd36b..75f117d8 100644
--- a/star_lock/lib/network/api.dart
+++ b/star_lock/lib/network/api.dart
@@ -1,6 +1,6 @@
abstract class Api {
- static String baseAddress = "https://pre.lock.star-lock.cn"; //预发布环境
- // static String baseAddress = "https://dev.lock.star-lock.cn"; //联调环境
+ // static String baseAddress = "https://pre.lock.star-lock.cn"; //预发布环境
+ static String baseAddress = "https://dev.lock.star-lock.cn"; //联调环境
// static String baseAddress = "http://192.168.1.15:8022"; //谢总本地
// static String baseAddress = "https://ge.lock.star-lock.cn"; //葛工开发环境地址
@@ -168,4 +168,7 @@ abstract class Api {
final String unbindPhoneTokenURL = '/user/unbindPhoneToken'; //获取解绑手机号Token
final String unbindEmailTokenURL = '/user/unbindEmailToken'; //获取解绑邮箱Token
final String pushBindAppIdURL = '/user/bindAppId'; //推送绑定APP设备
+
+ final String messageListURL = '/notifications/list'; //消息列表
+ final String readMessageURL = '/notifications/markAsRead'; //读取消息
}
diff --git a/star_lock/lib/network/api_provider.dart b/star_lock/lib/network/api_provider.dart
index 27c243c4..7112377c 100644
--- a/star_lock/lib/network/api_provider.dart
+++ b/star_lock/lib/network/api_provider.dart
@@ -1458,6 +1458,22 @@ class ApiProvider extends BaseProvider {
Future pushBindAppId(String deviceId, int deviceType) => post(
pushBindAppIdURL.toUrl,
jsonEncode({"deviceId": deviceId, "deviceType": deviceType}));
+
+ // 消息列表
+ Future messageListLoadData(String pageNo, String pageSize) =>
+ post(messageListURL.toUrl,
+ jsonEncode({
+ 'pageNo': pageNo,
+ 'pageSize': pageSize,
+ }));
+
+ // 读取消息
+ Future readMessageLoadData(String messageId) =>
+ post(readMessageURL.toUrl,
+ jsonEncode({
+ 'id': messageId,
+ }));
+
}
extension ExtensionString on String {
diff --git a/star_lock/lib/network/api_repository.dart b/star_lock/lib/network/api_repository.dart
index c5c5ba2a..2e2546e4 100644
--- a/star_lock/lib/network/api_repository.dart
+++ b/star_lock/lib/network/api_repository.dart
@@ -41,6 +41,7 @@ import '../main/lockDetail/lockDetail/lockNetToken_entity.dart';
import '../main/lockDetail/lockOperatingRecord/lockOperatingRecordGetLastRecordTime_entity.dart';
import '../main/lockMian/entity/lockListInfo_entity.dart';
import '../mine/addLock/saveLock/entity/SaveLockEntity.dart';
+import '../mine/message/messageList/messageList_entity.dart';
import '../mine/minePersonInfo/minePersonInfoPage/minePersonGetUploadFileInfo_entity.dart';
import '../mine/mineSet/transferGateway/selectGetewayList_entity.dart';
import '../mine/mineSet/transferSmartLock/recipientInformation/recipientInformation_entity.dart';
@@ -1466,4 +1467,22 @@ class ApiRepository {
final res = await apiProvider.pushBindAppId(deviceId, deviceType);
return MineUnbindPhoneOrEmailEntity.fromJson(res.body);
}
+
+ // 消息列表
+ Future messageListLoadData({
+ required String pageNo,
+ required String pageSize
+ }) async {
+ final res = await apiProvider.messageListLoadData(pageNo, pageSize);
+ return MessageListEntity.fromJson(res.body);
+ }
+
+ // 读取消息
+ Future readMessageLoadData({
+ required String messageId,
+ }) async {
+ final res = await apiProvider.readMessageLoadData(messageId);
+ return MessageListEntity.fromJson(res.body);
+ }
+
}
diff --git a/star_lock/lib/tools/NativeInteractionTool.dart b/star_lock/lib/tools/NativeInteractionTool.dart
new file mode 100644
index 00000000..94d08f9d
--- /dev/null
+++ b/star_lock/lib/tools/NativeInteractionTool.dart
@@ -0,0 +1,18 @@
+
+import 'package:flutter/services.dart';
+
+///原生交互配置
+class NativeInteractionConfig{
+ static String eventChannel = 'starLockFlutterReceive';
+ static String methodChannel = 'starLockFlutterSend';
+}
+
+///原生交互flutter向原生发送消息
+class NativeInteractionTool{
+
+ static loadNativeShare({required String shareText}){
+ MethodChannel(NativeInteractionConfig.methodChannel).invokeMethod('loadNativeShare', {'shareText':shareText});
+ }
+}
+
+
diff --git a/star_lock/lib/tools/eventBusEventManage.dart b/star_lock/lib/tools/eventBusEventManage.dart
index 059b6ae5..72c71f27 100644
--- a/star_lock/lib/tools/eventBusEventManage.dart
+++ b/star_lock/lib/tools/eventBusEventManage.dart
@@ -84,3 +84,8 @@ class GetPasswordTypeUpdateIndex {
class GetPasswordListRefreshUI {
GetPasswordListRefreshUI();
}
+
+/// 刷新消息列表
+class ReadMessageRefreshUI {
+ ReadMessageRefreshUI();
+}