diff --git a/star_lock/images/lan/lan_zh.json b/star_lock/images/lan/lan_zh.json index b772a3e0..110d48d8 100644 --- a/star_lock/images/lan/lan_zh.json +++ b/star_lock/images/lan/lan_zh.json @@ -163,7 +163,7 @@ "end":"结束", "allDay":"全天", "save":"保存", - "normallyOpenModeTip":"在设置的常开时间内,锁呗打开后将一直处于打开的状态,直到被手动关闭", + "normallyOpenModeTip":"在设置的常开时间内,锁被打开后将一直处于打开的状态,直到被手动关闭", "pleaseSeletLockVolume":"请选择锁音量", "lockSoundTip":"功能开启后,你将可以听到智能锁的提示音。包括电量过低,密码错误等提示。", "low":"低", diff --git a/star_lock/ios/Podfile.lock b/star_lock/ios/Podfile.lock index 23da6cd3..379be2ea 100644 --- a/star_lock/ios/Podfile.lock +++ b/star_lock/ios/Podfile.lock @@ -20,6 +20,16 @@ PODS: - fluttertoast (0.0.2): - Flutter - Toast + - geocoding_ios (1.0.5): + - Flutter + - google_maps_flutter_ios (0.0.1): + - Flutter + - GoogleMaps (< 8.0) + - GoogleMaps (5.2.0): + - GoogleMaps/Maps (= 5.2.0) + - GoogleMaps/Base (5.2.0) + - GoogleMaps/Maps (5.2.0): + - GoogleMaps/Base - image_picker_ios (0.0.1): - Flutter - package_info_plus (0.4.5): @@ -50,6 +60,8 @@ DEPENDENCIES: - Flutter (from `Flutter`) - flutter_native_contact_picker (from `.symlinks/plugins/flutter_native_contact_picker/ios`) - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) + - geocoding_ios (from `.symlinks/plugins/geocoding_ios/ios`) + - google_maps_flutter_ios (from `.symlinks/plugins/google_maps_flutter_ios/ios`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) @@ -63,6 +75,7 @@ SPEC REPOS: - AMap3DMap - AMapFoundation - AMapLocation + - GoogleMaps - Protobuf - SwiftProtobuf - Toast @@ -82,6 +95,10 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/flutter_native_contact_picker/ios" fluttertoast: :path: ".symlinks/plugins/fluttertoast/ios" + geocoding_ios: + :path: ".symlinks/plugins/geocoding_ios/ios" + google_maps_flutter_ios: + :path: ".symlinks/plugins/google_maps_flutter_ios/ios" image_picker_ios: :path: ".symlinks/plugins/image_picker_ios/ios" package_info_plus: @@ -108,6 +125,9 @@ SPEC CHECKSUMS: Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907 fluttertoast: fafc4fa4d01a6a9e4f772ecd190ffa525e9e2d9c + geocoding_ios: a389ea40f6f548de6e63006a2e31bf66ff80769a + google_maps_flutter_ios: abdac20d6ce8931f6ebc5f46616df241bfaa2cfd + GoogleMaps: 025272d5876d3b32604e5c080dc25eaf68764693 image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5 package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 diff --git a/star_lock/lib/blue/io_protocol/io_deletUser.dart b/star_lock/lib/blue/io_protocol/io_deletUser.dart index 4a9d32c9..11f5de0a 100644 --- a/star_lock/lib/blue/io_protocol/io_deletUser.dart +++ b/star_lock/lib/blue/io_protocol/io_deletUser.dart @@ -68,6 +68,7 @@ class DeletUserCommand extends SenderProtocol { data.addAll(utf8.encode(delUserID!)); data = getFixedLengthList(data, 20 - delUserIDLength); + // token data.addAll(token!); if(needAuthor == 0){ diff --git a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart index ab996acb..d91c478d 100644 --- a/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart +++ b/star_lock/lib/main/lockDetail/lcokSet/lockSet/lockSet_logic.dart @@ -39,6 +39,7 @@ class LockSetLogic extends BaseGetXController{ Storage.setStringList(saveBlueToken, saveStrList); int status = reply.data[6]; + print("status:$status"); switch(status){ case 0x00: //成功 @@ -56,10 +57,10 @@ class LockSetLogic extends BaseGetXController{ List publicKeyDataList = changeStringListToIntList(publicKey!); IoSenderManage.deletUser( - lockID:BlueManage().connectDeviceName, - authUserID:"100001", + lockID:state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName, + authUserID:await Storage.getUserId(), keyID:"1", - delUserID:"100001", + delUserID:await Storage.getUserId(), needAuthor:1, publicKey:publicKeyDataList, privateKey:getPrivateKeyList, @@ -87,8 +88,8 @@ class LockSetLogic extends BaseGetXController{ } Future deletUserAction() async { - BlueManage().judgeReconnect("AD01447A-30B5-A780-E778-DED3BDCB613E", "TMH_c3570480da8d", (DeviceConnectionState state) async { - if (state == DeviceConnectionState.connected){ + BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState connectionState) async { + if (connectionState == DeviceConnectionState.connected){ var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); @@ -98,9 +99,9 @@ class LockSetLogic extends BaseGetXController{ var token = await Storage.getStringList(saveBlueToken); List getTokenList = changeStringListToIntList(token!); print("openDoorTokenPubToken:$getTokenList"); - + print("state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName:${state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName}"); IoSenderManage.deletUser( - lockID:BlueManage().connectDeviceName, + lockID:state.getKeyInfosData.value.bluetooth!.bluetoothDeviceName, authUserID:"100001", keyID:"1", delUserID:"100001", diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart index 1ccc156a..218ac64e 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_logic.dart @@ -16,6 +16,7 @@ import '../../../blue/io_tool/io_tool.dart'; import '../../../blue/io_tool/manager_event_bus.dart'; import '../../../blue/sender_manage.dart'; import '../../../login/login/entity/LoginData.dart'; +import '../../../login/login/entity/LoginEntity.dart'; import '../../../tools/baseGetXController.dart'; import '../../../tools/storage.dart'; import 'lockDetail_state.dart'; @@ -77,11 +78,17 @@ class LockDetailLogic extends BaseGetXController{ case 0x06: //无权限 print("${reply.commandType}需要鉴权"); + String? userId = ''; + final data = await Storage.getString('userLoginData'); + if (data != null && data.isNotEmpty) { + userId = LoginEntity.fromJson(jsonDecode(data)).data!.userid.toString(); + } + IoSenderManage.senderOpenLock( keyID: "1", - userID: "100001", + userID: await Storage.getUserId(), openMode: 1, - openTime: 0x11223344, + openTime: DateTime.now().millisecondsSinceEpoch, token: tokenData, needAuthor: 1, signKey: signKeyDataList, @@ -207,9 +214,9 @@ class LockDetailLogic extends BaseGetXController{ IoSenderManage.senderEditUser( lockID:BlueManage().connectDeviceName, - authUserID:"100001", + authUserID:await Storage.getUserId(), keyID:"1", - userID:"100001", + userID:await Storage.getUserId(), openMode:1, keyType:1, startDate:0x11223344, @@ -270,7 +277,7 @@ class LockDetailLogic extends BaseGetXController{ IoSenderManage.senderFactoryDataReset( lockID:BlueManage().connectDeviceName, - userID:"100001", + userID:await Storage.getUserId(), keyID:"1", needAuthor:1, publicKey:publicKeyDataList, @@ -298,7 +305,7 @@ class LockDetailLogic extends BaseGetXController{ // 点击开门事件 Future openDoorAction() async { - BlueManage().judgeReconnect("AD01447A-30B5-A780-E778-DED3BDCB613E", "TMH_c3570480da8d", (DeviceConnectionState state) async { + BlueManage().judgeReconnect(state.keyInfos.value.bluetooth!.bluetoothDeviceId!, state.keyInfos.value.bluetooth!.bluetoothDeviceName!, (DeviceConnectionState state) async { if (state == DeviceConnectionState.connected){ var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); @@ -310,16 +317,15 @@ class LockDetailLogic extends BaseGetXController{ List getTokenList = changeStringListToIntList(token!); print("openDoorTokenPubToken:$getTokenList"); - // var userId = ""; + // String? userId = ''; // final data = await Storage.getString('userLoginData'); - // print("getLoginData:$data"); // if (data != null && data.isNotEmpty) { - // userId = LoginData.fromJson(jsonDecode(data)).userid as String; + // userId = LoginEntity.fromJson(jsonDecode(data)).data!.userid.toString(); // } - + // print("userId:$userId"); IoSenderManage.senderOpenLock( keyID: "1", - userID: "10001", + userID: await Storage.getUserId(), openMode: 1, openTime: DateTime.now().millisecondsSinceEpoch, token: getTokenList, @@ -333,7 +339,7 @@ class LockDetailLogic extends BaseGetXController{ // 编辑用户事件 Future editLockUserAction() async { - BlueManage().judgeReconnect("AD01447A-30B5-A780-E778-DED3BDCB613E", "TMH_c3570480da8d", (DeviceConnectionState state) async { + BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async { if (state == DeviceConnectionState.connected){ var publicKey = await Storage.getStringList(saveBluePublicKey); List publicKeyDataList = changeStringListToIntList(publicKey!); @@ -348,9 +354,9 @@ class LockDetailLogic extends BaseGetXController{ print("privateKey:$privateKey token:$token"); IoSenderManage.senderEditUser( lockID:BlueManage().connectDeviceName, - authUserID:"100001", + authUserID:await Storage.getUserId(), keyID:"1", - userID:"100001", + userID:await Storage.getUserId(), openMode:1, keyType:1, startDate:0x11223344, @@ -368,7 +374,7 @@ class LockDetailLogic extends BaseGetXController{ // 转移权限 Future transferPermissionsAction() async { - BlueManage().judgeReconnect("AD01447A-30B5-A780-E778-DED3BDCB613E", "TMH_c3570480da8d", (DeviceConnectionState state) async { + BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async { if (state == DeviceConnectionState.connected){ var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); @@ -382,9 +388,9 @@ class LockDetailLogic extends BaseGetXController{ IoSenderManage.senderTransferPermissions( lockID:BlueManage().connectDeviceName, - authUserID:"100001", + authUserID:await Storage.getUserId(), keyID:"1", - oldUserID:"100001", + oldUserID:await Storage.getUserId(), newUserID:"100002", needAuthor:1, publicKey:publicKeyDataList, @@ -397,7 +403,7 @@ class LockDetailLogic extends BaseGetXController{ // 恢复出厂设置 Future factoryDataResetAction() async { - BlueManage().judgeReconnect("AD01447A-30B5-A780-E778-DED3BDCB613E", "TMH_c3570480da8d", (DeviceConnectionState state) async { + BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async { if (state == DeviceConnectionState.connected){ var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); @@ -410,7 +416,7 @@ class LockDetailLogic extends BaseGetXController{ IoSenderManage.senderFactoryDataReset( lockID:BlueManage().connectDeviceName, - userID:"100001", + userID:await Storage.getUserId(), keyID:"1", needAuthor:1, publicKey:publicKeyDataList, @@ -424,13 +430,13 @@ class LockDetailLogic extends BaseGetXController{ // 备用逻辑,进入管理钥匙界面获取锁状态 Future connectBlue() async { // 进来之后首先连接 - BlueManage().connect("AD01447A-30B5-A780-E778-DED3BDCB613E", "TMH_c3570480da8d", connectStateCallBack: (DeviceConnectionState state) async { + BlueManage().connect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, connectStateCallBack: (DeviceConnectionState state) async { if (state == DeviceConnectionState.connected){ var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); IoSenderManage.senderGetLockStatu( lockID:BlueManage().connectDeviceName, - userID:"100001", + userID:await Storage.getUserId(), privateKey:getPrivateKeyList, ); } @@ -455,8 +461,11 @@ class LockDetailLogic extends BaseGetXController{ super.onInit(); print("lockDetail_onInit()"); - BlueManage().connectDeviceName = "TMH_c3570480da8d"; - BlueManage().connectDeviceMacAddress = "AD01447A-30B5-A780-E778-DED3BDCB613E"; + // BlueManage().connectDeviceName = "TMH_c3570480da8d"; + // BlueManage().connectDeviceMacAddress = "AD01447A-30B5-A780-E778-DED3BDCB613E"; + + // BlueManage().connectDeviceName = state.keyInfos.value.bluetooth!.bluetoothDeviceName!; + // BlueManage().connectDeviceMacAddress = state.keyInfos.value.bluetooth!.bluetoothDeviceId!; // 进来获取锁状态 // connectBlue(); diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart index 311f26f8..e934b575 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_page.dart @@ -4,6 +4,7 @@ import 'package:get/get.dart'; import '../../../appRouters.dart'; import '../../../app_settings/app_colors.dart'; +import '../../../blue/blue_manage.dart'; import '../../../translations/trans_lib.dart'; import '../../lockMian/entity/lockInfoEntity.dart'; import 'lockDetail_logic.dart'; @@ -24,8 +25,19 @@ class _LockDetailPageState extends State { final logic = Get.put(LockDetailLogic()); final state = Get.find().state; + @override + void initState() { + // TODO: implement initState + super.initState(); + + state.keyInfos.value = widget.keyInfo; + BlueManage().connectDeviceName = state.keyInfos.value.bluetooth!.bluetoothDeviceName!; + BlueManage().connectDeviceMacAddress = state.keyInfos.value.bluetooth!.bluetoothDeviceId!; + } + @override Widget build(BuildContext context) { + return Container( width: 1.sw, height: 1.sh - ScreenUtil().statusBarHeight*2, @@ -40,7 +52,7 @@ class _LockDetailPageState extends State { } Widget topWidget() { - KeyInfos keyInfo = widget.lockMainEntity.data!.keyInfos![0]; + // KeyInfos keyInfo = widget.lockMainEntity.data!.keyInfos![0]; return Column( children: [ SizedBox(height: 30.h), @@ -50,7 +62,7 @@ class _LockDetailPageState extends State { Align( alignment: Alignment.center, child: Text( - keyInfo.lockAlias!, + widget.keyInfo.lockAlias!, style: TextStyle(fontSize: 22.sp, fontWeight: FontWeight.w400), )), diff --git a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart index a6dfd516..bdad6c84 100644 --- a/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart +++ b/star_lock/lib/main/lockDetail/lockDetail/lockDetail_state.dart @@ -1,5 +1,10 @@ +import 'package:get/get.dart'; + +import '../../lockMian/entity/lockInfoEntity.dart'; + class LockDetailState { + Rx keyInfos = KeyInfos().obs; } \ No newline at end of file diff --git a/star_lock/lib/main/lockMian/entity/lockInfoEntity.dart b/star_lock/lib/main/lockMian/entity/lockInfoEntity.dart index 765e4167..26b4b1c8 100644 --- a/star_lock/lib/main/lockMian/entity/lockInfoEntity.dart +++ b/star_lock/lib/main/lockMian/entity/lockInfoEntity.dart @@ -232,6 +232,7 @@ class KeyInfos { int? doubleVerification; String? keyName; LockVersion? lockVersion; + Bluetooth? bluetooth; String? lockName; int? monitorFlag; Null? bondPassword; @@ -315,7 +316,8 @@ class KeyInfos { this.lockMac, this.wirelessKeypadFeatureValue, this.autoLockTime, - this.tamperAlert}); + this.tamperAlert, + this.bluetooth}); KeyInfos.fromJson(Map json) { lightingTime = json['lightingTime']; @@ -373,6 +375,9 @@ class KeyInfos { wirelessKeypadFeatureValue = json['wirelessKeypadFeatureValue']; autoLockTime = json['autoLockTime']; tamperAlert = json['tamperAlert']; + bluetooth = json['bluetooth'] != null + ? Bluetooth.fromJson(json['bluetooth']) + : null; } Map toJson() { @@ -432,6 +437,9 @@ class KeyInfos { data['wirelessKeypadFeatureValue'] = wirelessKeypadFeatureValue; data['autoLockTime'] = autoLockTime; data['tamperAlert'] = tamperAlert; + if (bluetooth != null) { + data['bluetooth'] = bluetooth!.toJson(); + } return data; } } @@ -475,4 +483,33 @@ class LockVersion { data['groupId'] = groupId; return data; } -} \ No newline at end of file +} + +class Bluetooth { + String? bluetoothDeviceId; + String? bluetoothDeviceName; + List? publicKey; + List? privateKey; + + Bluetooth( + {this.bluetoothDeviceId, + this.bluetoothDeviceName, + this.publicKey, + this.privateKey}); + + Bluetooth.fromJson(Map json) { + bluetoothDeviceId = json['bluetoothDeviceId']; + bluetoothDeviceName = json['bluetoothDeviceName']; + publicKey = json['publicKey']; + privateKey = json['publicKey']; + } + + Map toJson() { + final Map data = {}; + data['bluetoothDeviceId'] = bluetoothDeviceId; + data['bluetoothDeviceName'] = bluetoothDeviceName; + data['publicKey'] = publicKey; + data['privateKey'] = privateKey; + return data; + } +} diff --git a/star_lock/lib/mine/addLock/lockAddress/lockAddressGoogle_page.dart b/star_lock/lib/mine/addLock/lockAddress/lockAddressGoogle_page.dart index 0c0a3aab..b39110fe 100644 --- a/star_lock/lib/mine/addLock/lockAddress/lockAddressGoogle_page.dart +++ b/star_lock/lib/mine/addLock/lockAddress/lockAddressGoogle_page.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +// import 'package:google_maps_flutter/google_maps_flutter.dart'; class LockAddressGooglePage extends StatefulWidget { const LockAddressGooglePage({Key? key}) : super(key: key); @@ -9,6 +11,50 @@ class LockAddressGooglePage extends StatefulWidget { } class _LockAddressGooglePageState extends State { + + var deviceFindData = Get.arguments['data']; + var source; + var result; + + // LatLng _kMapCenter; + // CameraPosition _kInitialPosition; + + var _markers; + var setmarkers; + var restaurantMarker; + bool isSetupReady = false; + + String? currentAddress; + + @override + void initState() { + super.initState(); + + // doSetup(); + } + // + // doSetup() async { + // List placemarks = await placemarkFromCoordinates(deviceFindData.latitude, deviceFindData.longitude); + // Placemark place1 = placemarks[0]; + // currentAddress = "${place1.country} ${place1.administrativeArea} ${place1.locality} ${place1.subLocality} ${place1.name}"; + // // print("objectfasdfasdfasdfasdf:${placemarks}fasdfasdf${place1} ${currentAddress}"); + // + // restaurantMarker = await BitmapDescriptor.fromAssetImage( + // ImageConfiguration(size: Size(w(27), h(31))), Platform.isIOS ? R.assetsImgsDeviceFindDeviceIcon : R.assetsImgsDeviceFindDeviceAndroidIcon); + // _markers = [ + // Marker( + // markerId: MarkerId("marker_2"), + // infoWindow: InfoWindow(title: currentAddress), + // icon: restaurantMarker, + // // position:_kMapCenter, + // ), + // ]; + // setmarkers = _markers.toSet(); + // setState(() { + // isSetupReady = true; + // }); + // } + @override Widget build(BuildContext context) { return const Placeholder(); diff --git a/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart b/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart index 043fe5e7..3b637f46 100644 --- a/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart +++ b/star_lock/lib/mine/addLock/saveLock/saveLock_logic.dart @@ -68,9 +68,9 @@ class SaveLockLogic extends BaseGetXController { IoSenderManage.senderAddUser( lockID:BlueManage().connectDeviceName, - authUserID:"100001", + authUserID:await Storage.getUserId(), keyID:"1", - userID:"100001", + userID:await Storage.getUserId(), openMode:1, keyType:1, startDate:0x11223344, @@ -182,7 +182,7 @@ class SaveLockLogic extends BaseGetXController { // 添加用户 Future addUserConnectBlue() async { // 进来之后首先连接 - BlueManage().judgeReconnect("AD01447A-30B5-A780-E778-DED3BDCB613E", "TMH_c3570480da8d", (DeviceConnectionState state) async { + BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async { if (state == DeviceConnectionState.connected){ // 私钥 var privateKey = await Storage.getStringList(saveBluePrivateKey); @@ -198,11 +198,10 @@ class SaveLockLogic extends BaseGetXController { } IoSenderManage.senderAddUser( - // lockID:BlueManage().connectDeviceName, - lockID: "TMH_c3570480da8d", - authUserID:"100001", + lockID: BlueManage().connectDeviceName, + authUserID:await Storage.getUserId(), keyID:"1", - userID:"100001", + userID:await Storage.getUserId(), openMode:1, keyType:1, startDate:0x11223344, @@ -264,13 +263,13 @@ class SaveLockLogic extends BaseGetXController { // 获取锁状态 Future _getLockStatus() async { // 进来之后首先连接 - BlueManage().judgeReconnect("AD01447A-30B5-A780-E778-DED3BDCB613E", "TMH_c3570480da8d", (DeviceConnectionState state) async { + BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState state) async { if (state == DeviceConnectionState.connected) { var privateKey = await Storage.getStringList(saveBluePrivateKey); List getPrivateKeyList = changeStringListToIntList(privateKey!); IoSenderManage.senderGetLockStatu( lockID:BlueManage().connectDeviceName, - userID:"100001", + userID:await Storage.getUserId(), privateKey:getPrivateKeyList, ); } diff --git a/star_lock/lib/tools/storage.dart b/star_lock/lib/tools/storage.dart index 2a440045..79006e81 100644 --- a/star_lock/lib/tools/storage.dart +++ b/star_lock/lib/tools/storage.dart @@ -1,8 +1,12 @@ /* * 持久话数据 * */ +import 'dart:convert'; + import 'package:shared_preferences/shared_preferences.dart'; +import '../login/login/entity/LoginEntity.dart'; + class Storage { Storage._internal(); @@ -113,4 +117,15 @@ class Storage { SharedPreferences sp = await SharedPreferences.getInstance(); sp.clear(); } + + static Future getUserId() async { + String? userId = ''; + final data = await Storage.getString('userLoginData'); + if (data != null && data.isNotEmpty) { + userId = LoginEntity.fromJson(jsonDecode(data)).data!.userid.toString(); + } + return userId; + } + + } diff --git a/star_lock/pubspec.yaml b/star_lock/pubspec.yaml index 36152f1d..153ce01b 100644 --- a/star_lock/pubspec.yaml +++ b/star_lock/pubspec.yaml @@ -73,7 +73,6 @@ dependencies: url_launcher: ^6.1.12 #蓝牙 flutter_reactive_ble: ^5.1.1 -# flutter_blue_plus: ^1.10.5 # event_bus: ^2.0.0 #菊花 @@ -99,6 +98,10 @@ dependencies: #高德地图地图 amap_flutter_map: ^3.0.0 + # 谷歌地图 + google_maps_flutter: ^2.2.5 + geocoding: ^2.1.0 + dev_dependencies: flutter_test: sdk: flutter