Merge remote-tracking branch 'origin/master' into build-1.0.13+20240309
# Conflicts: # star_lock/pubspec.yaml
This commit is contained in:
commit
461bce214f
@ -10,7 +10,7 @@ import io.flutter.embedding.android.FlutterActivity
|
||||
import io.flutter.plugin.common.MethodChannel
|
||||
import io.flutter.embedding.engine.FlutterEngine;
|
||||
import io.flutter.plugins.GeneratedPluginRegistrant
|
||||
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
|
||||
class MainActivity: FlutterActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
@ -22,6 +22,25 @@ class MainActivity: FlutterActivity() {
|
||||
if (call.method == "loadNativeShare") {
|
||||
var map = call.arguments as Map<String, String>
|
||||
shareText(map["shareText"], "分享")
|
||||
} else if (call.method == "sendGetBlueStatus") {
|
||||
// 蓝牙是否开启
|
||||
// println("收到原生的信息了 methodmethodmethod: ${call.method}")
|
||||
val bluetoothAdapter: BluetoothAdapter? = BluetoothAdapter.getDefaultAdapter()
|
||||
var status = "0"
|
||||
bluetoothAdapter?.let {
|
||||
if (it.isEnabled) {
|
||||
// 蓝牙已开启
|
||||
status = "1"
|
||||
} else {
|
||||
// 蓝牙已关闭
|
||||
status = "0"
|
||||
}
|
||||
} ?: run {
|
||||
// 设备不支持蓝牙
|
||||
status = "-1"
|
||||
}
|
||||
val flutterEngine: FlutterEngine? = this.flutterEngine // 获取你的 FlutterEngine 实例
|
||||
MethodChannel(flutterEngine?.dartExecutor!!.binaryMessenger, "starLockFlutterReceive").invokeMethod("getBlueStatus", status)
|
||||
} else {
|
||||
result.notImplemented() // 没有实现的方法
|
||||
}
|
||||
|
||||
@ -50,15 +50,12 @@ PODS:
|
||||
- Flutter
|
||||
- flutter_sound_core (= 9.2.13)
|
||||
- flutter_sound_core (9.2.13)
|
||||
- flutter_voice_processor (1.1.0):
|
||||
- flutter_voice_processor (1.1.1):
|
||||
- Flutter
|
||||
- ios-voice-processor (~> 1.1.0)
|
||||
- fluttertoast (0.0.2):
|
||||
- Flutter
|
||||
- Toast
|
||||
- FMDB (2.7.5):
|
||||
- FMDB/standard (= 2.7.5)
|
||||
- FMDB/standard (2.7.5)
|
||||
- g711_flutter (0.0.1):
|
||||
- Flutter
|
||||
- google_maps_flutter_ios (0.0.1):
|
||||
@ -96,8 +93,10 @@ PODS:
|
||||
- FlutterMacOS
|
||||
- sqflite (0.0.3):
|
||||
- Flutter
|
||||
- FMDB (>= 2.7.5)
|
||||
- FlutterMacOS
|
||||
- SwiftProtobuf (1.25.2)
|
||||
- system_settings (0.0.1):
|
||||
- Flutter
|
||||
- Toast (4.0.0)
|
||||
- url_launcher_ios (0.0.1):
|
||||
- Flutter
|
||||
@ -135,7 +134,8 @@ DEPENDENCIES:
|
||||
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
|
||||
- reactive_ble_mobile (from `.symlinks/plugins/reactive_ble_mobile/ios`)
|
||||
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
|
||||
- sqflite (from `.symlinks/plugins/sqflite/ios`)
|
||||
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
|
||||
- system_settings (from `.symlinks/plugins/system_settings/ios`)
|
||||
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
||||
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/ios`)
|
||||
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)
|
||||
@ -153,7 +153,6 @@ SPEC REPOS:
|
||||
- AMapFoundation
|
||||
- AMapLocation
|
||||
- flutter_sound_core
|
||||
- FMDB
|
||||
- GoogleMaps
|
||||
- ios-voice-processor
|
||||
- Protobuf
|
||||
@ -217,7 +216,9 @@ EXTERNAL SOURCES:
|
||||
shared_preferences_foundation:
|
||||
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
|
||||
sqflite:
|
||||
:path: ".symlinks/plugins/sqflite/ios"
|
||||
:path: ".symlinks/plugins/sqflite/darwin"
|
||||
system_settings:
|
||||
:path: ".symlinks/plugins/system_settings/ios"
|
||||
url_launcher_ios:
|
||||
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
||||
video_player_avfoundation:
|
||||
@ -250,9 +251,8 @@ SPEC CHECKSUMS:
|
||||
flutter_pcm_sound: de0572ca4f99091cc2abfcc31601b8a4ddd33c0e
|
||||
flutter_sound: c60effa2a350fb977885f0db2fbc4c1ad5160900
|
||||
flutter_sound_core: 26c10e5832e76aaacfae252d8925232281c486ae
|
||||
flutter_voice_processor: 53afbf59ad3feb82f4a379fea9ed8dc98495210f
|
||||
flutter_voice_processor: 2b89b93d69b02227ae3fd58589ee0bcfa3ca2a82
|
||||
fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
|
||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||
g711_flutter: 8f2769052d2cf3549f83d11e1c42d81d94441123
|
||||
google_maps_flutter_ios: d1318b4ff711612cab16862d7a87e31a7403d458
|
||||
GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4
|
||||
@ -268,8 +268,9 @@ SPEC CHECKSUMS:
|
||||
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
|
||||
reactive_ble_mobile: 9ce6723d37ccf701dbffd202d487f23f5de03b4c
|
||||
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
|
||||
sqflite: 50a33e1d72bd59ee092a519a35d107502757ebed
|
||||
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
|
||||
SwiftProtobuf: 407a385e97fd206c4fbe880cc84123989167e0d1
|
||||
system_settings: 8f5cdbfa72c677fc8d665b863bcc20d393d87e9d
|
||||
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
|
||||
url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812
|
||||
video_player_avfoundation: 81e49bb3d9fb63dccf9fa0f6d877dc3ddbeac126
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
buildImplicitDependencies = "YES">
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug-dev"
|
||||
buildConfiguration = "Release-dev"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
@ -24,7 +24,7 @@
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug-dev"
|
||||
buildConfiguration = "Release-dev"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
@ -62,7 +62,7 @@
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug-dev">
|
||||
buildConfiguration = "Release-dev">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release-dev"
|
||||
|
||||
@ -78,7 +78,8 @@ import 'main/lockDetail/lockSet/basicInformation/uploadElectricQuantity/uploadEl
|
||||
import 'main/lockDetail/lockSet/burglarAlarm/burglarAlarm_page.dart';
|
||||
import 'main/lockDetail/lockSet/catEyeSet/catEyeWorkMode/catEyeWorkMode_page.dart';
|
||||
import 'main/lockDetail/lockSet/checkInCreatCompany/checkInCreatCompany_page.dart';
|
||||
import 'main/lockDetail/lockSet/configuringWifi/configuringWifi_page.dart';
|
||||
import 'main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_page.dart';
|
||||
import 'main/lockDetail/lockSet/configuringWifi/wifiList/wifiList_page.dart';
|
||||
import 'main/lockDetail/lockSet/diagnose/diagnose_page.dart';
|
||||
import 'main/lockDetail/lockSet/doorMagnetic/addDoorMagnetic/addDoorMagnetic_page.dart';
|
||||
import 'main/lockDetail/lockSet/doorMagnetic/doorMagneticList/doorMagnetic_page.dart';
|
||||
@ -253,6 +254,7 @@ abstract class Routers {
|
||||
static const burglarAlarmPage = '/BurglarAlarmPage'; // 防撬警报
|
||||
static const resetButtonPage = '/ResetButtonPage'; // 锁重置键
|
||||
static const unlockQRCodePage = '/UnlockQRCodePage'; // 开锁二维码
|
||||
static const wifiListPage = '/WifiListPage'; // WiFi列表
|
||||
static const configuringWifiPage = '/ConfiguringWifiPage'; // 配置WiFi
|
||||
static const lockTimePage = '/LockTimePage'; // 锁时间
|
||||
static const diagnosePage = '/DiagnosePage'; // 诊断
|
||||
@ -1029,6 +1031,9 @@ abstract class AppRouters {
|
||||
page: (() => const MessageDetailPage())),
|
||||
GetPage(
|
||||
name: Routers.accessoriesListPage,
|
||||
page: (() => const AccessoriesListPage()))
|
||||
page: (() => const AccessoriesListPage())),
|
||||
GetPage(
|
||||
name: Routers.wifiListPage,
|
||||
page: (() => const WifiListPage()))
|
||||
];
|
||||
}
|
||||
|
||||
@ -40,7 +40,9 @@ class BlueManage {
|
||||
DeviceConnectionState? deviceConnectionState = DeviceConnectionState.disconnected;
|
||||
|
||||
static BlueManage? _manager;
|
||||
BlueManage._init();
|
||||
BlueManage._init(){
|
||||
// _initBlue();
|
||||
}
|
||||
|
||||
static BlueManage? shareManager() {
|
||||
_manager ??= BlueManage._init();
|
||||
@ -111,6 +113,10 @@ class BlueManage {
|
||||
Future<void> bludSendData(String deviceName, ConnectStateCallBack stateCallBack, {bool isAddEquipment = false}) async {
|
||||
_flutterReactiveBle!.statusStream.listen((status) {
|
||||
Get.log("_flutterReactiveBle.status:$status");
|
||||
if(deviceName.isEmpty) {
|
||||
Get.log("deviceName为空");
|
||||
return;
|
||||
}
|
||||
if (status == BleStatus.ready) {
|
||||
// 蓝牙已开启,可以进行蓝牙操作
|
||||
if(deviceConnectionState != DeviceConnectionState.connected){
|
||||
@ -283,7 +289,7 @@ class BlueManage {
|
||||
// 写入
|
||||
Future<void> writeCharacteristicWithResponse(List<int> value) async {
|
||||
QualifiedCharacteristic characteristic = QualifiedCharacteristic(characteristicId: _characteristicIdWrite, serviceId: _serviceIdWrite, deviceId: connectDeviceMacAddress);
|
||||
int mtuLength = await _flutterReactiveBle!.requestMtu(deviceId: characteristic.deviceId, mtu: 250);
|
||||
int mtuLength = await _flutterReactiveBle!.requestMtu(deviceId: characteristic.deviceId, mtu: 512);
|
||||
print("mtuLength:$mtuLength");
|
||||
try {
|
||||
List<int> valueList = value;
|
||||
|
||||
107
star_lock/lib/blue/io_protocol/io_getWifiList.dart
Normal file
107
star_lock/lib/blue/io_protocol/io_getWifiList.dart
Normal file
@ -0,0 +1,107 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import '../io_reply.dart';
|
||||
import '../io_sender.dart';
|
||||
import '../io_tool/io_tool.dart';
|
||||
import '../io_type.dart';
|
||||
import 'package:crypto/crypto.dart' as crypto;
|
||||
|
||||
import '../sm4Encipher/sm4.dart';
|
||||
|
||||
class SenderGetWifiCommand extends SenderProtocol {
|
||||
|
||||
String? keyID;
|
||||
String? userID;
|
||||
List<int>? token;
|
||||
int? needAuthor;
|
||||
List<int>? publicKey;
|
||||
List<int>? privateKey;
|
||||
|
||||
SenderGetWifiCommand({
|
||||
this.keyID,
|
||||
this.userID,
|
||||
this.token,
|
||||
this.needAuthor,
|
||||
this.publicKey,
|
||||
this.privateKey,
|
||||
}) : super(CommandType.generalExtendedCommond);
|
||||
|
||||
@override
|
||||
List<int> messageDetail() {
|
||||
List<int> data = [];
|
||||
List<int> subData = [];
|
||||
List<int> ebcData = [];
|
||||
|
||||
// 指令类型
|
||||
int type = commandType!.typeValue;
|
||||
double typeDouble = type / 256;
|
||||
int type1 = typeDouble.toInt();
|
||||
int type2 = type % 256;
|
||||
data.add(type1);
|
||||
data.add(type2);
|
||||
|
||||
// 子命令类型
|
||||
data.add(53);
|
||||
|
||||
// keyID 40
|
||||
int keyIDLength = utf8.encode(keyID!).length;
|
||||
subData.addAll(utf8.encode(keyID!));
|
||||
subData = getFixedLengthList(subData, 40 - keyIDLength);
|
||||
|
||||
//userID 20
|
||||
int userIDLength = utf8.encode(userID!).length;
|
||||
subData.addAll(utf8.encode(userID!));
|
||||
subData = getFixedLengthList(subData, 20 - userIDLength);
|
||||
|
||||
// token
|
||||
// subData.addAll(token!);
|
||||
|
||||
if(needAuthor == 0){
|
||||
//AuthCodeLen 1
|
||||
subData.add(0);
|
||||
} else {
|
||||
List<int> authCodeData = [];
|
||||
|
||||
//userID
|
||||
authCodeData.addAll(utf8.encode(userID!));
|
||||
|
||||
//KeyID
|
||||
authCodeData.addAll(utf8.encode(keyID!));
|
||||
|
||||
//token 4 首次请求 Token 填 0,如果锁需要鉴权操作者身份,则会分配动态口令并在应答消息中返回,二次请求时带上。
|
||||
authCodeData.addAll(token!);
|
||||
|
||||
authCodeData.addAll(publicKey!);
|
||||
|
||||
print("${commandType!.typeValue}-authCodeData:$authCodeData");
|
||||
|
||||
// 把KeyID、authUserID、时间戳、公钥通过md5加密之后就是authCode
|
||||
var authCode = crypto.md5.convert(authCodeData);
|
||||
|
||||
subData.add(authCode.bytes.length);
|
||||
subData.addAll(authCode.bytes);
|
||||
}
|
||||
|
||||
data.add(subData.length);
|
||||
data.addAll(subData);
|
||||
|
||||
if ((data.length % 16) != 0) {
|
||||
int add = (16 - data.length % 16);
|
||||
for (int i = 0; i < add; i++) {
|
||||
data.add(0);
|
||||
}
|
||||
}
|
||||
print("${commandType!.typeName} SM4Data:$data");
|
||||
// 拿到数据之后通过LockId进行SM4 ECB加密 key:544d485f633335373034383064613864
|
||||
ebcData = SM4.encrypt(data, key: privateKey, mode: SM4CryptoMode.ECB);
|
||||
return ebcData;
|
||||
}
|
||||
}
|
||||
|
||||
class SenderGetWifiListReply extends Reply {
|
||||
SenderGetWifiListReply.parseData(CommandType commandType, List<int> dataDetail)
|
||||
: super.parseData(commandType, dataDetail) {
|
||||
data = dataDetail;
|
||||
}
|
||||
}
|
||||
@ -32,6 +32,7 @@ import 'io_protocol/io_configuringWifi.dart';
|
||||
import 'io_protocol/io_getPrivateKey.dart';
|
||||
import 'io_protocol/io_getPublicKey.dart';
|
||||
import 'io_protocol/io_getStarLockStatusInfo.dart';
|
||||
import 'io_protocol/io_getWifiList.dart';
|
||||
import 'io_protocol/io_openLock.dart';
|
||||
import 'io_protocol/io_queryingFingerprintStatus.dart';
|
||||
import 'io_protocol/io_referEventRecordNumber.dart';
|
||||
@ -287,6 +288,12 @@ class CommandReciverManager {
|
||||
SenderConfiguringWifiReply.parseData(commandType, data);
|
||||
}
|
||||
break;
|
||||
case 54:
|
||||
{
|
||||
// 门锁搜索2.4G WIFI SSID 结果
|
||||
reply = SenderGetWifiListReply.parseData(commandType, data);
|
||||
}
|
||||
break;
|
||||
case 60:
|
||||
{
|
||||
// 注册胁迫密码
|
||||
|
||||
@ -20,6 +20,7 @@ import 'io_protocol/io_factoryDataReset.dart';
|
||||
import 'io_protocol/io_getPrivateKey.dart';
|
||||
import 'io_protocol/io_getPublicKey.dart';
|
||||
import 'io_protocol/io_getStarLockStatusInfo.dart';
|
||||
import 'io_protocol/io_getWifiList.dart';
|
||||
import 'io_protocol/io_openLock.dart';
|
||||
import 'io_protocol/io_queryingFingerprintStatus.dart';
|
||||
import 'io_protocol/io_readSupportFunctionsNoParameters.dart';
|
||||
@ -615,6 +616,27 @@ class IoSenderManage {
|
||||
callBack: callBack);
|
||||
}
|
||||
|
||||
//todo:wifi列表
|
||||
static void getWifiListCommand(
|
||||
{required String? keyID,
|
||||
required String? userID,
|
||||
required List<int>? token,
|
||||
required int? needAuthor,
|
||||
required List<int>? publicKey,
|
||||
required List<int>? privateKey,
|
||||
CommandSendCallBack? callBack}) {
|
||||
CommandSenderManager().managerSendData(
|
||||
command: SenderGetWifiCommand(
|
||||
keyID: keyID,
|
||||
userID: userID,
|
||||
token: token,
|
||||
needAuthor: needAuthor,
|
||||
publicKey: publicKey,
|
||||
privateKey: privateKey,
|
||||
),
|
||||
callBack: callBack);
|
||||
}
|
||||
|
||||
//todo:配置wifi
|
||||
static void senderConfiguringWifiCommand(
|
||||
{required String? keyID,
|
||||
|
||||
@ -296,7 +296,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
Get.toNamed(Routers.sendEmailNotificationPage);
|
||||
} else {
|
||||
// _openModalBottomSheet();
|
||||
NativeInteractionTool.loadNativeShare(
|
||||
NativeInteractionTool().loadNativeShare(
|
||||
shareText: state.pwdShareStr);
|
||||
}
|
||||
// Get.toNamed(state.emailOrPhoneController.text.contains("@")? Routers.sendEmailNotificationPage:Routers.sendEmailNotificationPage);
|
||||
@ -309,7 +309,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
btnName: '微信通知',
|
||||
onClick: () {
|
||||
// _openModalBottomSheet();
|
||||
NativeInteractionTool.loadNativeShare(shareText: state.pwdShareStr);
|
||||
NativeInteractionTool().loadNativeShare(shareText: state.pwdShareStr);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
@ -517,13 +517,13 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
case 0:
|
||||
//微信好友
|
||||
{
|
||||
NativeInteractionTool.loadNativeShare(shareText: state.pwdShareStr);
|
||||
NativeInteractionTool().loadNativeShare(shareText: state.pwdShareStr);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
//短信
|
||||
{
|
||||
NativeInteractionTool.loadNativeShare(shareText: state.pwdShareStr);
|
||||
NativeInteractionTool().loadNativeShare(shareText: state.pwdShareStr);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@ -535,7 +535,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
|
||||
case 3:
|
||||
//更多
|
||||
{
|
||||
NativeInteractionTool.loadNativeShare(shareText: state.pwdShareStr);
|
||||
NativeInteractionTool().loadNativeShare(shareText: state.pwdShareStr);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -181,6 +181,14 @@ class _AddCardPageState extends State<AddCardPage> {
|
||||
Widget keyBottomWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: "是否是管理员",
|
||||
rightTitle: "",
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: _isAdmin())),
|
||||
SizedBox(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.stressCard!.tr,
|
||||
rightTitle: "",
|
||||
@ -357,4 +365,20 @@ class _AddCardPageState extends State<AddCardPage> {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// 是否是管理员
|
||||
CupertinoSwitch _isAdmin() {
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.isStressFingerprint.value,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
state.isStressFingerprint.value = value;
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -643,14 +643,14 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
//微信好友
|
||||
{
|
||||
String pwdShareStr = '您好,您的电子钥匙生成成功';
|
||||
NativeInteractionTool.loadNativeShare(shareText: pwdShareStr);
|
||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
//短信
|
||||
{
|
||||
String pwdShareStr = '您好,您的电子钥匙生成成功';
|
||||
NativeInteractionTool.loadNativeShare(shareText: pwdShareStr);
|
||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@ -663,7 +663,7 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
//更多
|
||||
{
|
||||
String pwdShareStr = '您好,您的电子钥匙生成成功';
|
||||
NativeInteractionTool.loadNativeShare(shareText: pwdShareStr);
|
||||
NativeInteractionTool().loadNativeShare(shareText: pwdShareStr);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -181,6 +181,14 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
||||
Widget keyBottomWidget() {
|
||||
return Column(
|
||||
children: [
|
||||
CommonItem(
|
||||
leftTitel: "是否是管理员",
|
||||
rightTitle: "",
|
||||
isTipsImg: false,
|
||||
isHaveRightWidget: true,
|
||||
rightWidget: SizedBox(
|
||||
width: 60.w, height: 50.h, child: _isAdmin())),
|
||||
SizedBox(height: 10.h),
|
||||
CommonItem(
|
||||
leftTitel: TranslationLoader.lanKeys!.stressFingerprint!.tr,
|
||||
rightTitle: "",
|
||||
@ -337,4 +345,20 @@ class _AddFingerprintTypePageState extends State<AddFingerprintTypePage> {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// 是否是管理员
|
||||
CupertinoSwitch _isAdmin() {
|
||||
return CupertinoSwitch(
|
||||
activeColor: CupertinoColors.activeBlue,
|
||||
trackColor: CupertinoColors.systemGrey5,
|
||||
thumbColor: CupertinoColors.white,
|
||||
value: state.isStressFingerprint.value,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
state.isStressFingerprint.value = value;
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:star_lock/main/lockDetail/electronicKey/electronicKeyDetail/keyOperationRecord/keyOperationRecord_entity.dart';
|
||||
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
@ -44,12 +46,12 @@ class LockDetailLogic extends BaseGetXController {
|
||||
// }
|
||||
|
||||
// 获取星锁状态信息
|
||||
if (reply is GetStarLockStatuInfoReply) {
|
||||
if (reply is GetStarLockStatuInfoReply && state.ifCurrentScreen.value == true) {
|
||||
_replyGetStarLockStatusInfo(reply);
|
||||
}
|
||||
|
||||
// 开完锁之后上传记录
|
||||
if (reply is SenderReferEventRecordTimeReply) {
|
||||
if (reply is SenderReferEventRecordTimeReply && state.ifCurrentScreen.value == true) {
|
||||
_replyReferEventRecordTime(reply);
|
||||
}
|
||||
|
||||
@ -597,27 +599,31 @@ class LockDetailLogic extends BaseGetXController {
|
||||
|
||||
//
|
||||
startOpenLock() {
|
||||
if (state.openLockBtnState.value == 1) {
|
||||
return;
|
||||
}
|
||||
state.iSOpenLock.value = true;
|
||||
state.iSClosedUnlockSuccessfulPopup.value = false;
|
||||
state.openLockBtnState.value = 1;
|
||||
state.animationController.forward();
|
||||
|
||||
if (state.lockUserNo == 0) {
|
||||
// 电子钥匙lockUserNo为0 要先添加用户
|
||||
addUserConnectBlue();
|
||||
} else {
|
||||
print("state.isOpenLockNeedOnline.value:${state.isOpenLockNeedOnline.value}");
|
||||
if (state.isOpenLockNeedOnline.value == 0) {
|
||||
// 不需要联网
|
||||
openDoorAction(1);
|
||||
} else {
|
||||
// 需要联网
|
||||
getLockNetToken();
|
||||
print("11111111");
|
||||
// checkBlueIsOpen((){
|
||||
print("33333333");
|
||||
if (state.openLockBtnState.value == 1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
state.iSOpenLock.value = true;
|
||||
state.iSClosedUnlockSuccessfulPopup.value = false;
|
||||
state.openLockBtnState.value = 1;
|
||||
state.animationController.forward();
|
||||
|
||||
if (state.lockUserNo == 0) {
|
||||
// 电子钥匙lockUserNo为0 要先添加用户
|
||||
addUserConnectBlue();
|
||||
} else {
|
||||
print("state.isOpenLockNeedOnline.value:${state.isOpenLockNeedOnline.value}");
|
||||
if (state.isOpenLockNeedOnline.value == 0) {
|
||||
// 不需要联网
|
||||
openDoorAction(1);
|
||||
} else {
|
||||
// 需要联网
|
||||
getLockNetToken();
|
||||
}
|
||||
}
|
||||
// });
|
||||
}
|
||||
|
||||
startUnLock() {
|
||||
@ -859,11 +865,44 @@ class LockDetailLogic extends BaseGetXController {
|
||||
return formattedTime;
|
||||
}
|
||||
|
||||
openBlueSet() {
|
||||
if (!Platform.isIOS) {
|
||||
getMicrophonePermission().then((value) {
|
||||
if (!value) {
|
||||
//没有权限 打开app系统设置
|
||||
openAppSettings();
|
||||
} else {
|
||||
// 有权限
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
///请求权限
|
||||
Future<bool> getMicrophonePermission() async {
|
||||
// You can request multiple permissions at once.
|
||||
Map<Permission, PermissionStatus> statuses = await [
|
||||
Permission.bluetoothScan,
|
||||
Permission.bluetoothConnect,
|
||||
Permission.location,
|
||||
].request();
|
||||
|
||||
//granted 通过,denied 被拒绝,permanentlyDenied 拒绝且不在提示
|
||||
if (statuses[Permission.bluetoothScan]!.isGranted &&
|
||||
statuses[Permission.bluetoothConnect]!.isGranted &&
|
||||
statuses[Permission.location]!.isGranted) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
|
||||
openBlueSet();
|
||||
|
||||
_initReplySubscription();
|
||||
_initLockSetOpenOrCloseCheckInRefreshLockDetailWithAttendanceAction();
|
||||
_scanListDiscoveredDeviceSubscriptionAction();
|
||||
|
||||
@ -7,14 +7,14 @@ import 'package:network_info_plus/network_info_plus.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
import '../../../../blue/io_protocol/io_configuringWifi.dart';
|
||||
import '../../../../blue/io_reply.dart';
|
||||
import '../../../../blue/io_tool/io_tool.dart';
|
||||
import '../../../../blue/io_tool/manager_event_bus.dart';
|
||||
import '../../../../blue/sender_manage.dart';
|
||||
import '../../../../network/api_repository.dart';
|
||||
import '../../../../tools/storage.dart';
|
||||
import '../../../../../blue/blue_manage.dart';
|
||||
import '../../../../../blue/io_protocol/io_configuringWifi.dart';
|
||||
import '../../../../../blue/io_reply.dart';
|
||||
import '../../../../../blue/io_tool/io_tool.dart';
|
||||
import '../../../../../blue/io_tool/manager_event_bus.dart';
|
||||
import '../../../../../blue/sender_manage.dart';
|
||||
import '../../../../../network/api_repository.dart';
|
||||
import '../../../../../tools/storage.dart';
|
||||
import 'configuringWifi_state.dart';
|
||||
|
||||
class ConfiguringWifiLogic extends BaseGetXController{
|
||||
@ -243,10 +243,12 @@ class ConfiguringWifiLogic extends BaseGetXController{
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
|
||||
getWifiName().then((value) {
|
||||
print("wifiName:$value");
|
||||
state.wifiNameController.text = value;
|
||||
});
|
||||
if(state.wifiName.value.isEmpty){
|
||||
getWifiName().then((value) {
|
||||
print("wifiName:$value");
|
||||
state.wifiNameController.text = value;
|
||||
});
|
||||
}
|
||||
|
||||
getWifiLockServiceIpAndPort();
|
||||
_initReplySubscription();
|
||||
@ -4,13 +4,13 @@ import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../app_settings/app_colors.dart';
|
||||
import '../../../../blue/blue_manage.dart';
|
||||
import '../../../../tools/appRouteObserver.dart';
|
||||
import '../../../../tools/commonItem.dart';
|
||||
import '../../../../tools/submitBtn.dart';
|
||||
import '../../../../tools/titleAppBar.dart';
|
||||
import '../../../../translations/trans_lib.dart';
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../blue/blue_manage.dart';
|
||||
import '../../../../../tools/appRouteObserver.dart';
|
||||
import '../../../../../tools/commonItem.dart';
|
||||
import '../../../../../tools/submitBtn.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import '../../../../../translations/trans_lib.dart';
|
||||
import 'configuringWifi_logic.dart';
|
||||
|
||||
class ConfiguringWifiPage extends StatefulWidget {
|
||||
@ -2,7 +2,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../lockSet/lockSetInfo_entity.dart';
|
||||
import '../../lockSet/lockSetInfo_entity.dart';
|
||||
import 'configuringWifiEntity.dart';
|
||||
|
||||
class ConfiguringWifiState{
|
||||
@ -10,6 +10,7 @@ class ConfiguringWifiState{
|
||||
var lockSetInfoData = LockSetInfoData().obs;
|
||||
var lockBasicInfo = LockBasicInfo().obs;
|
||||
|
||||
var wifiName = "".obs;
|
||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
var sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用)
|
||||
|
||||
@ -19,6 +20,10 @@ class ConfiguringWifiState{
|
||||
var map = Get.arguments;
|
||||
lockSetInfoData.value = map["lockSetInfoData"];
|
||||
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
|
||||
if ((map["wifiName"] != null)) {
|
||||
wifiName.value = map["wifiName"];
|
||||
wifiNameController.text = wifiName.value;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,157 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/blue/io_protocol/io_getWifiList.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
|
||||
import '../../../../../blue/blue_manage.dart';
|
||||
import '../../../../../blue/io_reply.dart';
|
||||
import '../../../../../blue/io_tool/io_tool.dart';
|
||||
import '../../../../../blue/io_tool/manager_event_bus.dart';
|
||||
import '../../../../../blue/sender_manage.dart';
|
||||
import '../../../../../tools/storage.dart';
|
||||
import 'wifiList_state.dart';
|
||||
|
||||
class WifiListLogic extends BaseGetXController {
|
||||
final WifiListState state = WifiListState();
|
||||
|
||||
// 获取解析后的数据
|
||||
late StreamSubscription<Reply> _replySubscription;
|
||||
void _initReplySubscription() {
|
||||
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) {
|
||||
if(reply is SenderGetWifiListReply) {
|
||||
_replyGetWifiListParameters(reply);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 设置自动落锁数据解析
|
||||
Future<void> _replyGetWifiListParameters(Reply reply) async {
|
||||
int status = reply.data[2];
|
||||
switch(status){
|
||||
case 0x00:
|
||||
//成功
|
||||
print("${reply.commandType}数据解析成功");
|
||||
// showEasyLoading();
|
||||
Future.delayed(4.seconds, (){
|
||||
dismissEasyLoading();
|
||||
});
|
||||
state.sureBtnState.value = 0;
|
||||
cancelBlueConnetctToastTimer();
|
||||
|
||||
if (reply.data[6] > 0) {
|
||||
reply.data.removeRange(0, 7);
|
||||
// 把得到的数据按33位分割成数组 然后塞进一个新的数组里面
|
||||
var getList = splitList(reply.data, 33);
|
||||
// print("getList:$getList");
|
||||
var uploadList = <Map<String, String>>[];
|
||||
for (int i = 0; i < getList.length; i++) {
|
||||
var indexList = getList[i];
|
||||
// print("indexList:$indexList");
|
||||
var indexMap = <String, String>{};
|
||||
var wifiName = indexList.sublist(0, 32);
|
||||
// print("wifiName:$wifiName");
|
||||
indexMap["wifiName"] = utf8String(wifiName);
|
||||
indexMap["rssi"] = (indexList.last - 255).toString();
|
||||
uploadList.add(indexMap);
|
||||
state.wifiNameDataList.value = uploadList;
|
||||
}
|
||||
// print("reply.data:${reply.data} getList:$getList}");
|
||||
}
|
||||
|
||||
break;
|
||||
case 0x06:
|
||||
//无权限
|
||||
print("${reply.commandType}需要鉴权");
|
||||
|
||||
break;
|
||||
case 0x07:
|
||||
//无权限
|
||||
print("${reply.commandType}用户无权限");
|
||||
|
||||
break;
|
||||
case 0x09:
|
||||
// 权限校验错误
|
||||
print("${reply.commandType}权限校验错误");
|
||||
|
||||
break;
|
||||
default:
|
||||
//失败
|
||||
print("${reply.commandType}失败");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取wifi列表
|
||||
Future<void> senderGetWifiListWifiAction() async {
|
||||
if(state.sureBtnState.value == 1){
|
||||
return;
|
||||
}
|
||||
state.sureBtnState.value = 1;
|
||||
|
||||
showEasyLoading();
|
||||
showBlueConnetctToastTimer(action: (){
|
||||
dismissEasyLoading();
|
||||
state.sureBtnState.value = 0;
|
||||
});
|
||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (DeviceConnectionState connectionState) async {
|
||||
if (connectionState == DeviceConnectionState.connected){
|
||||
var token = await Storage.getStringList(saveBlueToken);
|
||||
List<int> getTokenList = changeStringListToIntList(token!);
|
||||
print("openDoorTokenPubToken:$getTokenList");
|
||||
|
||||
var privateKey = await Storage.getStringList(saveBluePrivateKey);
|
||||
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
|
||||
|
||||
var publicKey = await Storage.getStringList(saveBluePublicKey);
|
||||
List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
|
||||
|
||||
IoSenderManage.getWifiListCommand(
|
||||
keyID: state.lockSetInfoData.value.lockBasicInfo!.keyId.toString(),
|
||||
userID: await Storage.getUid(),
|
||||
token: getTokenList,
|
||||
needAuthor: 1,
|
||||
publicKey: publicKeyDataList,
|
||||
privateKey: getPrivateKeyList,
|
||||
);
|
||||
} else if (connectionState == DeviceConnectionState.disconnected) {
|
||||
dismissEasyLoading();
|
||||
state.sureBtnState.value = 0;
|
||||
cancelBlueConnetctToastTimer();
|
||||
if(state.ifCurrentScreen.value == true){
|
||||
showBlueConnetctToast();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
super.onReady();
|
||||
print("onReady()");
|
||||
|
||||
_initReplySubscription();
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// TODO: implement onInit
|
||||
super.onInit();
|
||||
print("onInit()");
|
||||
|
||||
senderGetWifiListWifiAction();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
_replySubscription.cancel();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,127 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../../appRouters.dart';
|
||||
import '../../../../../app_settings/app_colors.dart';
|
||||
import '../../../../../tools/noData.dart';
|
||||
import '../../../../../tools/submitBtn.dart';
|
||||
import '../../../../../tools/titleAppBar.dart';
|
||||
import 'wifiList_logic.dart';
|
||||
|
||||
class WifiListPage extends StatefulWidget {
|
||||
const WifiListPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<WifiListPage> createState() => _WifiListPageState();
|
||||
}
|
||||
|
||||
class _WifiListPageState extends State<WifiListPage> {
|
||||
final logic = Get.put(WifiListLogic());
|
||||
final state = Get.find<WifiListLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: "WIFI列表",
|
||||
haveBack: true,
|
||||
actionsList: [
|
||||
TextButton(
|
||||
child: Text(
|
||||
"刷新", style: TextStyle(color: Colors.white, fontSize: 24.sp),
|
||||
),
|
||||
onPressed: () {
|
||||
logic.senderGetWifiListWifiAction();
|
||||
},
|
||||
),
|
||||
],
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Obx(() => state.wifiNameDataList.value.isNotEmpty ? ListView.builder(
|
||||
itemCount: state.wifiNameDataList.value.length,
|
||||
itemBuilder: (c, index) {
|
||||
Map wifiNameStr = state.wifiNameDataList.value[index];
|
||||
return _messageListItem(wifiNameStr["wifiName"], wifiNameStr["rssi"], () {
|
||||
Get.toNamed(Routers.configuringWifiPage, arguments: {
|
||||
'lockSetInfoData': state.lockSetInfoData.value,
|
||||
'wifiName': wifiNameStr["wifiName"],
|
||||
});
|
||||
});
|
||||
}) : NoData(noDataHeight: 1.sh - ScreenUtil().statusBarHeight - ScreenUtil().bottomBarHeight - 64.h)),
|
||||
),
|
||||
SubmitBtn(
|
||||
btnName: "手动配网",
|
||||
fontSize: 28.sp,
|
||||
borderRadius: 20.w,
|
||||
padding: EdgeInsets.only(top: 25.w, bottom: 25.w),
|
||||
onClick: () {
|
||||
Get.toNamed(Routers.configuringWifiPage, arguments: {
|
||||
'lockSetInfoData': state.lockSetInfoData.value
|
||||
});
|
||||
}),
|
||||
SizedBox(
|
||||
height: 64.h,
|
||||
)
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Widget _messageListItem(String wifiName, String rssi, Function() action) {
|
||||
return GestureDetector(
|
||||
onTap: action,
|
||||
child: Container(
|
||||
height: 90.h,
|
||||
width: 1.sw,
|
||||
margin: EdgeInsets.only(bottom: 2.h),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(10.w),
|
||||
),
|
||||
child: Container(
|
||||
width: 1.sw,
|
||||
height: 80.h,
|
||||
margin: EdgeInsets.only(left: 20.w, right: 40.w),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 79.h,
|
||||
width: 1.sw - 20.w*2,
|
||||
child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(
|
||||
"$wifiName(${rssi}db)",
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 22.sp, color: AppColors.blackColor),
|
||||
),
|
||||
),
|
||||
// Text(
|
||||
// rssi,
|
||||
// maxLines: 1,
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// style: TextStyle(
|
||||
// fontSize: 22.sp, color: AppColors.blackColor),
|
||||
// )
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 1.h,
|
||||
color: AppColors.greyLineColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../lockSet/lockSetInfo_entity.dart';
|
||||
|
||||
class WifiListState{
|
||||
final wifiNameDataList = <Map<String, String>>[].obs;
|
||||
var lockSetInfoData = LockSetInfoData().obs;
|
||||
var lockBasicInfo = LockBasicInfo().obs;
|
||||
|
||||
var ifCurrentScreen = true.obs; // 是否是当前界面,用于判断是否需要针对当前界面进行展示
|
||||
var sureBtnState = 0.obs;// 0普通状态(可用) 1连接中(不可用)
|
||||
WifiListState() {
|
||||
var map = Get.arguments;
|
||||
lockSetInfoData.value = map["lockSetInfoData"];
|
||||
lockBasicInfo.value = lockSetInfoData.value.lockBasicInfo!;
|
||||
}
|
||||
}
|
||||
@ -269,7 +269,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
showBlueConnetctToastTimer(isShowBlueConnetctToast: false, action: (){
|
||||
dismissEasyLoading();
|
||||
// print("1111111");
|
||||
showDeletAlertTipDialog(Get.context!);
|
||||
showDeletAlertTipDialog();
|
||||
});
|
||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (DeviceConnectionState connectionState) async {
|
||||
if (connectionState == DeviceConnectionState.connected) {
|
||||
@ -299,7 +299,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
cancelBlueConnetctToastTimer();
|
||||
print("222222");
|
||||
if(state.ifCurrentScreen.value == true){
|
||||
showDeletAlertTipDialog(Get.context!);
|
||||
showDeletAlertTipDialog();
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -311,7 +311,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
showBlueConnetctToastTimer(isShowBlueConnetctToast: false, action: (){
|
||||
dismissEasyLoading();
|
||||
print("333333");
|
||||
showDeletAlertTipDialog(Get.context!);
|
||||
showDeletAlertTipDialog();
|
||||
});
|
||||
BlueManage().bludSendData(BlueManage().connectDeviceName, (DeviceConnectionState connectionState) async {
|
||||
if (connectionState == DeviceConnectionState.connected) {
|
||||
@ -337,7 +337,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
cancelBlueConnetctToastTimer();
|
||||
print("444444");
|
||||
if(state.ifCurrentScreen.value == true){
|
||||
showDeletAlertTipDialog(Get.context!);
|
||||
showDeletAlertTipDialog();
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -564,7 +564,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
BlueManage().stopScan();
|
||||
dismissEasyLoading();
|
||||
print("555555");
|
||||
showDeletAlertTipDialog(Get.context!);
|
||||
showDeletAlertTipDialog();
|
||||
}else{
|
||||
// 每秒判断获取是否搜到了当前设备
|
||||
if (state.currentDeviceUUid.isNotEmpty) {
|
||||
@ -612,7 +612,7 @@ class LockSetLogic extends BaseGetXController {
|
||||
}else if(state.currentDeviceUUid.value[31] == "0"){
|
||||
// 未配对 表示这把锁已被强制初始化 处于可添加状态 直接弹窗删除即可
|
||||
print("666666");
|
||||
showDeletAlertTipDialog(Get.context!);
|
||||
showDeletAlertTipDialog(showContent:"当前锁已被强制初始化,可直接添加。");
|
||||
}
|
||||
}
|
||||
|
||||
@ -700,31 +700,34 @@ class LockSetLogic extends BaseGetXController {
|
||||
});
|
||||
}
|
||||
|
||||
void showDeletAlertTipDialog(BuildContext context) {
|
||||
void showDeletAlertTipDialog({String? showContent = ""}) {
|
||||
bool isContains = BlueManage().connectDeviceName!.contains("T9A");
|
||||
var content = showContent!.isEmpty ? "删除设备失败,请确保在设备附近,设备未被连接,设备已打开${isContains == true ? "。如果是全自动锁,请使屏幕变亮" : ""}" : showContent;
|
||||
showCupertinoDialog(
|
||||
context: context,
|
||||
context: Get.context!,
|
||||
builder: (context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: const Text("提示"),
|
||||
content: const Text('删除门锁后如需重新添加需要在门锁设置的"蓝牙功能"选项下先"清除配对",确定吗?'),
|
||||
content: Text(content),
|
||||
// content: const Text('删除门锁后如需重新添加需要在门锁设置的"蓝牙功能"选项下先"清除配对",确定吗?'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
// CupertinoDialogAction(
|
||||
// child: Text(TranslationLoader.lanKeys!.cancel!.tr),
|
||||
// onPressed: () {
|
||||
// Navigator.pop(context);
|
||||
// },
|
||||
// ),
|
||||
CupertinoDialogAction(
|
||||
child: Text(TranslationLoader.lanKeys!.sure!.tr),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
if (state.lockSetInfoData.value.lockBasicInfo!.isLockOwner == 1) {
|
||||
// 直接调用删除锁接口
|
||||
deletLockInfoData();
|
||||
} else {
|
||||
// 直接调用删除要是接口
|
||||
deletKeyData();
|
||||
}
|
||||
// if (state.lockSetInfoData.value.lockBasicInfo!.isLockOwner == 1) {
|
||||
// // 直接调用删除锁接口
|
||||
// deletLockInfoData();
|
||||
// } else {
|
||||
// // 直接调用删除要是接口
|
||||
// deletKeyData();
|
||||
// }
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
@ -526,9 +526,12 @@ class _LockSetPageState extends State<LockSetPage> with RouteAware {
|
||||
isHaveLine: true,
|
||||
isHaveDirection: true,
|
||||
action: () {
|
||||
Get.toNamed(Routers.configuringWifiPage, arguments: {
|
||||
Get.toNamed(Routers.wifiListPage, arguments: {
|
||||
'lockSetInfoData': state.lockSetInfoData.value
|
||||
});
|
||||
// Get.toNamed(Routers.configuringWifiPage, arguments: {
|
||||
// 'lockSetInfoData': state.lockSetInfoData.value
|
||||
// });
|
||||
})),
|
||||
),
|
||||
// Obx(() =>
|
||||
|
||||
@ -319,13 +319,13 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
||||
case 0:
|
||||
//微信好友
|
||||
{
|
||||
NativeInteractionTool.loadNativeShare(shareText:pwdShareStr);
|
||||
NativeInteractionTool().loadNativeShare(shareText:pwdShareStr);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
//短信
|
||||
{
|
||||
NativeInteractionTool.loadNativeShare(shareText:pwdShareStr);
|
||||
NativeInteractionTool().loadNativeShare(shareText:pwdShareStr);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@ -337,7 +337,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
||||
case 3:
|
||||
//更多
|
||||
{
|
||||
NativeInteractionTool.loadNativeShare(shareText:pwdShareStr);
|
||||
NativeInteractionTool().loadNativeShare(shareText:pwdShareStr);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -682,13 +682,13 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
||||
case 0:
|
||||
//微信好友
|
||||
{
|
||||
NativeInteractionTool.loadNativeShare(shareText:pwdShareStr);
|
||||
NativeInteractionTool().loadNativeShare(shareText:pwdShareStr);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
//短信
|
||||
{
|
||||
NativeInteractionTool.loadNativeShare(shareText:pwdShareStr);
|
||||
NativeInteractionTool().loadNativeShare(shareText:pwdShareStr);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@ -700,7 +700,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> wit
|
||||
case 3:
|
||||
//更多
|
||||
{
|
||||
NativeInteractionTool.loadNativeShare(shareText:pwdShareStr);
|
||||
NativeInteractionTool().loadNativeShare(shareText:pwdShareStr);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@ -43,11 +43,20 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
getHttpData();
|
||||
// WidgetsBinding.instance!.addPostFrameCallback((_) {
|
||||
// getHttpData();
|
||||
// });
|
||||
initAliyunPush();
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
||||
getHttpData();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -125,14 +134,12 @@ class _StarLockMainPageState extends State<StarLockMainPage> with BaseWidget {
|
||||
Storage.setBool(ifIsDemoModeOrNot, false);
|
||||
returnWidget = LockDetailPage(
|
||||
isOnlyOneData: true,
|
||||
lockListInfoItemEntity: state
|
||||
.lockListInfoEntity.value.data!.groupList![0].lockList![0]);
|
||||
lockListInfoItemEntity: state.lockListInfoEntity.value.data!.groupList![0].lockList![0]);
|
||||
break;
|
||||
case 2:
|
||||
// 有多条数据
|
||||
Storage.setBool(ifIsDemoModeOrNot, false);
|
||||
returnWidget = LockListPage(
|
||||
lockListInfoGroupEntity: state.lockListInfoEntity.value.data!);
|
||||
returnWidget = LockListPage(lockListInfoGroupEntity: state.lockListInfoEntity.value.data!);
|
||||
break;
|
||||
default:
|
||||
returnWidget = NoData();
|
||||
|
||||
@ -354,6 +354,7 @@ class NearbyLockLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
void stopScanBlueList(){
|
||||
BlueManage().disconnect("state.selectLockName.value");
|
||||
BlueManage().stopScan();
|
||||
}
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ import '../../../tools/eventBusEventManage.dart';
|
||||
import 'messageList_entity.dart';
|
||||
import 'messageList_state.dart';
|
||||
|
||||
typedef BlockDeletSuccssCallback = void Function();
|
||||
class MessageListLogic extends BaseGetXController {
|
||||
final MessageListState state = MessageListState();
|
||||
|
||||
@ -31,18 +32,19 @@ class MessageListLogic extends BaseGetXController {
|
||||
}
|
||||
|
||||
// 删除消息
|
||||
void deletMessageDataRequest(String messageId) async {
|
||||
void deletMessageDataRequest(String messageId, BlockDeletSuccssCallback blockDeletSuccssCallback) async {
|
||||
MessageListEntity entity = await ApiRepository.to.deletMessageLoadData(messageId:messageId);
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
messageListDataRequest();
|
||||
blockDeletSuccssCallback();
|
||||
}
|
||||
}
|
||||
|
||||
/// 刷新密码列表
|
||||
/// 刷新消息列表
|
||||
StreamSubscription? _readMessageRefreshUIEvent;
|
||||
void _readMessageRefreshUIAction() {
|
||||
// 蓝牙协议通知传输跟蓝牙之外的数据传输类不一样 eventBus
|
||||
_readMessageRefreshUIEvent = eventBus.on<ReadMessageRefreshUI>().listen((event) {
|
||||
pageNo == 1;
|
||||
messageListDataRequest();
|
||||
});
|
||||
}
|
||||
|
||||
@ -69,7 +69,10 @@ class _MessageListPageState extends State<MessageListPage> with TickerProviderSt
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (BuildContext context){
|
||||
logic.deletMessageDataRequest(messageItemEntity.id!);
|
||||
logic.deletMessageDataRequest(messageItemEntity.id!, (){
|
||||
logic.pageNo = 1;
|
||||
getHttpData();
|
||||
});
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
|
||||
@ -35,7 +35,7 @@ import '../main/lockDetail/checkingIn/checkingInStaff/checkingInSetAddStaff/chec
|
||||
import '../main/lockDetail/checkingIn/checkingInStaff/checkingInSetStaffList/checkingInStaffList_entity.dart';
|
||||
import '../main/lockDetail/fingerprint/addFingerprint/addFingerprint_entity.dart';
|
||||
import '../main/lockDetail/fingerprint/fingerprintList/fingerprintListData_entity.dart';
|
||||
import '../main/lockDetail/lockSet/configuringWifi/configuringWifiEntity.dart';
|
||||
import '../main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifiEntity.dart';
|
||||
import '../main/lockDetail/lockSet/lockSet/checkingInInfoData_entity.dart';
|
||||
import '../main/lockDetail/lockSet/lockSet/lockSetInfo_entity.dart';
|
||||
import '../main/lockDetail/lockSet/lockTime/getServerDatetime_entity.dart';
|
||||
|
||||
@ -3,15 +3,41 @@ import 'package:flutter/services.dart';
|
||||
|
||||
///原生交互配置
|
||||
class NativeInteractionConfig{
|
||||
static String eventChannel = 'starLockFlutterReceive';
|
||||
static String methodChannel = 'starLockFlutterSend';
|
||||
static String methodSendChannel = 'starLockFlutterSend';
|
||||
static String receiveEventChannel = 'starLockFlutterReceive';
|
||||
}
|
||||
|
||||
///原生交互flutter向原生发送消息
|
||||
typedef BlockBlueStatus = void Function(String status);
|
||||
class NativeInteractionTool{
|
||||
var sendChannel = MethodChannel(NativeInteractionConfig.methodSendChannel);
|
||||
var receiveChannel = MethodChannel(NativeInteractionConfig.receiveEventChannel);
|
||||
|
||||
static loadNativeShare({required String shareText}){
|
||||
MethodChannel(NativeInteractionConfig.methodChannel).invokeMethod('loadNativeShare', {'shareText':shareText});
|
||||
///加载原生分享
|
||||
loadNativeShare({required String shareText}){
|
||||
sendChannel.invokeMethod('loadNativeShare', {'shareText':shareText});
|
||||
}
|
||||
|
||||
///获取设备蓝牙状态
|
||||
sendGetBlueStatus(){
|
||||
sendChannel.invokeMethod('sendGetBlueStatus');
|
||||
}
|
||||
|
||||
///获取设备蓝牙是否打开
|
||||
receiveChannelBlueIsOnEvent(BlockBlueStatus blockBlueStatus){
|
||||
receiveChannel.setMethodCallHandler((MethodCall call) async {
|
||||
print('收到原生发送的信息call.method: ${call.method} call.arguments:${call.arguments}');
|
||||
switch (call.method) {
|
||||
case 'getBlueStatus':
|
||||
// 获取设备蓝牙开启/关闭状态
|
||||
final String message = call.arguments;
|
||||
blockBlueStatus(message);
|
||||
print('收到原生发送的信息getBlueStatus: $message');
|
||||
break;
|
||||
default:
|
||||
throw MissingPluginException();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,13 +1,19 @@
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/blue/blue_manage.dart';
|
||||
import 'package:system_settings/system_settings.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'NativeInteractionTool.dart';
|
||||
import 'manager/client_manager.dart';
|
||||
import 'showIosTipView.dart';
|
||||
|
||||
class BaseGetXController extends GetxController{
|
||||
int currentTimeSeconds = 0;
|
||||
@ -119,6 +125,51 @@ class BaseGetXController extends GetxController{
|
||||
Get.offAllNamed(Routers.starLockLoginPage);
|
||||
}
|
||||
|
||||
void checkBlueIsOpen(void Function() action) {
|
||||
NativeInteractionTool().sendGetBlueStatus();
|
||||
NativeInteractionTool().receiveChannelBlueIsOnEvent((String status) {
|
||||
print("22222222");
|
||||
if(status == "1"){
|
||||
// 蓝牙已打开
|
||||
Get.log('蓝牙已打开');
|
||||
action();
|
||||
}else if(status == "0"){
|
||||
// 蓝牙未打开
|
||||
Get.log('蓝牙未打开');
|
||||
showIosTipViewDialog();
|
||||
return;
|
||||
}else{
|
||||
// 蓝牙未打开
|
||||
Get.log('设备不支持蓝牙');
|
||||
showToast("设备不支持蓝牙");
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void showIosTipViewDialog() {
|
||||
showDialog(
|
||||
context: Get.context!,
|
||||
builder: (BuildContext context) {
|
||||
return ShowIosTipView(
|
||||
title: "提示",
|
||||
tipTitle: "蓝牙未打开,请到设置里面打开蓝牙",
|
||||
sureClick: () {
|
||||
Get.back();
|
||||
if (Platform.isIOS) {
|
||||
launch('App-Prefs:');
|
||||
}else{
|
||||
SystemSettings.system();
|
||||
}
|
||||
},
|
||||
cancelClick: () {
|
||||
Get.back();
|
||||
},
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
String getUseKeyTypeStr(int? startDate, int? endDate,int? keyType) {
|
||||
String useDateStr = '';
|
||||
if (keyType == XSConstantMacro.keyTypeTime) {
|
||||
|
||||
@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
|
||||
version: 1.0.12+20240308
|
||||
version: 1.0.13+20240309
|
||||
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
@ -74,7 +74,7 @@ dependencies:
|
||||
camera: ^0.10.5+5
|
||||
path_provider: ^2.1.0
|
||||
#跳转到外部
|
||||
url_launcher: ^6.1.12
|
||||
url_launcher: ^6.1.10
|
||||
#蓝牙
|
||||
flutter_reactive_ble: ^5.1.1
|
||||
#
|
||||
@ -115,7 +115,7 @@ dependencies:
|
||||
aliyun_push: ^0.1.6
|
||||
|
||||
#视频播放器
|
||||
video_player: ^2.7.2
|
||||
video_player: ^2.7.1
|
||||
#控制横竖屏控件
|
||||
auto_orientation: ^2.3.1
|
||||
audioplayers: ^5.2.1
|
||||
@ -140,6 +140,7 @@ dependencies:
|
||||
#侧滑删除
|
||||
flutter_slidable: ^3.0.1
|
||||
|
||||
system_settings: ^2.0.0
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user