1,优化未注册用户发送钥匙流程

2,解决点击通讯录无法获取到手机号问题
3,完成分享底部弹出框,并实现系统分享以及邮件跳转
This commit is contained in:
Daisy 2023-10-16 17:18:10 +08:00
parent a4a92b79fd
commit 04b7a0e9f5
19 changed files with 493 additions and 258 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@ -10,7 +10,7 @@
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
3EF1E85D6F1EE0C0DCF8449F /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 09D8B2FA2B26BA5BFF31AB2A /* Pods_Runner.framework */; }; 3EF1E85D6F1EE0C0DCF8449F /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 09D8B2FA2B26BA5BFF31AB2A /* Pods_Runner.framework */; };
82BD91202ADA6FBB0018E523 /* SharePasswordViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 82BD911F2ADA6FBB0018E523 /* SharePasswordViewController.m */; }; 82BD91202ADA6FBB0018E523 /* XSFlutterManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 82BD911F2ADA6FBB0018E523 /* XSFlutterManager.m */; };
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
@ -40,8 +40,8 @@
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
82BD911E2ADA6FBB0018E523 /* SharePasswordViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SharePasswordViewController.h; sourceTree = "<group>"; }; 82BD911E2ADA6FBB0018E523 /* XSFlutterManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XSFlutterManager.h; sourceTree = "<group>"; };
82BD911F2ADA6FBB0018E523 /* SharePasswordViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SharePasswordViewController.m; sourceTree = "<group>"; }; 82BD911F2ADA6FBB0018E523 /* XSFlutterManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XSFlutterManager.m; sourceTree = "<group>"; };
82BD91212ADA72360018E523 /* CommonDefine.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CommonDefine.h; sourceTree = "<group>"; }; 82BD91212ADA72360018E523 /* CommonDefine.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CommonDefine.h; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
@ -78,6 +78,15 @@
path = Pods; path = Pods;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
826570C02ADCDD0200A92776 /* XSController */ = {
isa = PBXGroup;
children = (
82BD911E2ADA6FBB0018E523 /* XSFlutterManager.h */,
82BD911F2ADA6FBB0018E523 /* XSFlutterManager.m */,
);
name = XSController;
sourceTree = "<group>";
};
9304F75C378DB3447BB2408C /* Frameworks */ = { 9304F75C378DB3447BB2408C /* Frameworks */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -119,6 +128,7 @@
97C146F01CF9000F007C117D /* Runner */ = { 97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
826570C02ADCDD0200A92776 /* XSController */,
33BF41252A96174D009D92E2 /* Runner.entitlements */, 33BF41252A96174D009D92E2 /* Runner.entitlements */,
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
@ -129,8 +139,6 @@
97C146F11CF9000F007C117D /* Supporting Files */, 97C146F11CF9000F007C117D /* Supporting Files */,
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
82BD911E2ADA6FBB0018E523 /* SharePasswordViewController.h */,
82BD911F2ADA6FBB0018E523 /* SharePasswordViewController.m */,
82BD91212ADA72360018E523 /* CommonDefine.h */, 82BD91212ADA72360018E523 /* CommonDefine.h */,
); );
path = Runner; path = Runner;
@ -180,6 +188,7 @@
TargetAttributes = { TargetAttributes = {
97C146ED1CF9000F007C117D = { 97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1; CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 1430;
}; };
}; };
}; };
@ -294,7 +303,7 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,
82BD91202ADA6FBB0018E523 /* SharePasswordViewController.m in Sources */, 82BD91202ADA6FBB0018E523 /* XSFlutterManager.m in Sources */,
97C146F31CF9000F007C117D /* main.m in Sources */, 97C146F31CF9000F007C117D /* main.m in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
); );
@ -379,6 +388,7 @@
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES; ALWAYS_SEARCH_USER_PATHS = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
@ -393,6 +403,8 @@
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock"; PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };
name = Profile; name = Profile;
@ -510,6 +522,7 @@
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES; ALWAYS_SEARCH_USER_PATHS = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
@ -524,6 +537,9 @@
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock"; PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };
name = Debug; name = Debug;
@ -534,6 +550,7 @@
buildSettings = { buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES; ALWAYS_SEARCH_USER_PATHS = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
@ -548,6 +565,8 @@
PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock"; PRODUCT_BUNDLE_IDENTIFIER = "cn.star-lock.lock";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };
name = Release; name = Release;

View File

@ -1,21 +1,16 @@
#import "AppDelegate.h" #import "AppDelegate.h"
#import "GeneratedPluginRegistrant.h" #import "GeneratedPluginRegistrant.h"
#import "SharePasswordViewController.h" #import "XSFlutterManager.h"
#import "CommonDefine.h" #import "CommonDefine.h"
@implementation AppDelegate @implementation AppDelegate
- (BOOL)application:(UIApplication *)application - (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
/** FlutterViewController*/ XSFlutterManager * VC = [[XSFlutterManager alloc]init];
SharePasswordViewController * VC = [[SharePasswordViewController alloc]init]; self.window.rootViewController = VC;
UINavigationController * NVC = [[UINavigationController alloc]initWithRootViewController:VC]; [self.window makeKeyAndVisible];
[self.window setRootViewController:NVC]; return YES;
/** flutter*/
[GeneratedPluginRegistrant registerWithRegistry:self];
// Override point for customization after application launch.
return [super application:application didFinishLaunchingWithOptions:launchOptions];
} }
@end @end

View File

@ -57,6 +57,11 @@
</array> </array>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>
<string>LaunchScreen</string> <string>LaunchScreen</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UISceneConfigurations</key>
<dict />
</dict>
<key>UIMainStoryboardFile</key> <key>UIMainStoryboardFile</key>
<string>Main</string> <string>Main</string>
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>

View File

@ -9,7 +9,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface SharePasswordViewController : FlutterViewController @interface XSFlutterManager : FlutterViewController
@end @end

View File

@ -1,23 +1,23 @@
// //
// SharePasswordViewController.m // XSFlutterManager.m
// Runner // Runner
// //
// Created by DaisyWu on 2023/10/14. // Created by DaisyWu on 2023/10/14.
// //
#import "SharePasswordViewController.h" #import "XSFlutterManager.h"
#include "GeneratedPluginRegistrant.h" #include "GeneratedPluginRegistrant.h"
#import "CommonDefine.h" #import "CommonDefine.h"
@interface SharePasswordViewController () @interface XSFlutterManager ()
@property(nonatomic,strong) FlutterMethodChannel* methodChannel; @property(nonatomic,strong) FlutterMethodChannel* methodChannel;
@property (nonatomic, copy) NSString *textToShare; @property (nonatomic, copy) NSString *textToShare;
@end @end
@implementation SharePasswordViewController @implementation XSFlutterManager
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
@ -34,6 +34,7 @@
[self.methodChannel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) { [self.methodChannel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) {
// TODO // TODO
NSString *method=call.method; NSString *method=call.method;
//
if ([method isEqualToString:flutterMethodSharePassword]) { if ([method isEqualToString:flutterMethodSharePassword]) {
id params = call.arguments; id params = call.arguments;
self.textToShare = @"您好,您的密码是:"; self.textToShare = @"您好,您的密码是:";

View File

@ -27,7 +27,7 @@ class AuthorizedAdminSendEntity {
} }
class Data { class Data {
String? receiverUid; int? receiverUid;
ReceiverUser? receiverUser; ReceiverUser? receiverUser;
int? keyId; int? keyId;
@ -105,7 +105,7 @@ class Phone {
int? userId; int? userId;
String? phoneNumberHash; String? phoneNumberHash;
String? phoneNumberEncrypt; String? phoneNumberEncrypt;
String? countryCode; int? countryCode;
String? phoneNumberVerifiedAt; String? phoneNumberVerifiedAt;
String? updatedAt; String? updatedAt;
String? createdAt; String? createdAt;
@ -149,7 +149,7 @@ class Phone {
class Cloud { class Cloud {
String? username; String? username;
String? password; String? password;
String? cloudUid; int? cloudUid;
int? userId; int? userId;
String? updatedAt; String? updatedAt;
String? createdAt; String? createdAt;

View File

@ -1,7 +1,11 @@
import 'dart:async'; import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter_reactive_ble/flutter_reactive_ble.dart'; import 'package:flutter_reactive_ble/flutter_reactive_ble.dart';
import 'package:get/get.dart';
import 'package:star_lock/appRouters.dart';
import 'package:star_lock/blue/io_type.dart'; import 'package:star_lock/blue/io_type.dart';
import 'package:star_lock/translations/trans_lib.dart';
import '../../../../blue/blue_manage.dart'; import '../../../../blue/blue_manage.dart';
import '../../../../blue/io_protocol/io_addUser.dart'; import '../../../../blue/io_protocol/io_addUser.dart';
@ -23,7 +27,8 @@ class AuthorizedAdminLogic extends BaseGetXController {
// //
late StreamSubscription<Reply> _replySubscription; late StreamSubscription<Reply> _replySubscription;
void _initReplySubscription() { void _initReplySubscription() {
_replySubscription = EventBusManager().eventBus!.on<Reply>().listen((reply) async { _replySubscription =
EventBusManager().eventBus!.on<Reply>().listen((reply) async {
// //
if (reply is TransferPermissionsReply) { if (reply is TransferPermissionsReply) {
var token = reply.data.sublist(2, 6); var token = reply.data.sublist(2, 6);
@ -73,7 +78,7 @@ class AuthorizedAdminLogic extends BaseGetXController {
break; break;
case 0x14: case 0x14:
// //
print("${reply.commandType!.typeValue} 用户已存在"); print("${reply.commandType!.typeValue} 用户已存在");
break; break;
@ -85,7 +90,7 @@ class AuthorizedAdminLogic extends BaseGetXController {
} }
} }
if(reply is AddUserReply) { if (reply is AddUserReply) {
_replyAddUserKey(reply); _replyAddUserKey(reply);
} }
}); });
@ -105,16 +110,16 @@ class AuthorizedAdminLogic extends BaseGetXController {
// userNo = reply.data[46]; // userNo = reply.data[46];
// print("status:$status"); // print("status:$status");
switch(status){ switch (status) {
case 0x00: case 0x00:
// //
print("添加用户数据解析成功"); print("添加用户数据解析成功");
state.isSendSuccess.value = true; state.isSendSuccess.value = true;
Toast.show(msg: "添加成功"); Toast.show(msg: "添加成功");
// bindBlueAdmin(); // bindBlueAdmin();
break; break;
case 0x06: case 0x06:
// //
print("需要鉴权"); print("需要鉴权");
var privateKey = await Storage.getStringList(saveBluePrivateKey); var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
@ -124,33 +129,32 @@ class AuthorizedAdminLogic extends BaseGetXController {
IoSenderManage.senderAddUser( IoSenderManage.senderAddUser(
lockID: BlueManage().connectDeviceName, lockID: BlueManage().connectDeviceName,
authUserID:await Storage.getUid(), authUserID: await Storage.getUid(),
keyID:"1", keyID: "1",
userID:state.addUserId.value, userID: state.addUserId.value,
openMode:1, openMode: 1,
keyType:(state.type.value == "1") ? 0 : 1, keyType: (state.type.value == "1") ? 0 : 1,
startDate:state.effectiveDateTime.value.millisecondsSinceEpoch, startDate: state.effectiveDateTime.value.millisecondsSinceEpoch,
expireDate:state.failureDateTime.value.millisecondsSinceEpoch, expireDate: state.failureDateTime.value.millisecondsSinceEpoch,
role:0, role: 0,
password:"123456", password: "123456",
needAuthor:1, needAuthor: 1,
publicKey:publicKeyDataList, publicKey: publicKeyDataList,
privateKey:getPrivateKeyList, privateKey: getPrivateKeyList,
token: token token: token);
);
break; break;
case 0x07: case 0x07:
// //
print("用户无权限"); print("用户无权限");
break; break;
case 0x09: case 0x09:
// //
print("添加用户权限校验错误"); print("添加用户权限校验错误");
break; break;
default: default:
// //
print("领锁失败"); print("领锁失败");
break; break;
@ -190,8 +194,10 @@ class AuthorizedAdminLogic extends BaseGetXController {
// //
Future<void> addUserConnectBlue(String receiveId) async { Future<void> addUserConnectBlue(String receiveId) async {
// //
BlueManage().judgeReconnect(BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName, (DeviceConnectionState connecteState) async { BlueManage().judgeReconnect(
if (connecteState == DeviceConnectionState.connected){ BlueManage().connectDeviceMacAddress, BlueManage().connectDeviceName,
(DeviceConnectionState connecteState) async {
if (connecteState == DeviceConnectionState.connected) {
// //
var privateKey = await Storage.getStringList(saveBluePrivateKey); var privateKey = await Storage.getStringList(saveBluePrivateKey);
List<int> getPrivateKeyList = changeStringListToIntList(privateKey!); List<int> getPrivateKeyList = changeStringListToIntList(privateKey!);
@ -200,59 +206,60 @@ class AuthorizedAdminLogic extends BaseGetXController {
List<int> publicKeyDataList = changeStringListToIntList(publicKey!); List<int> publicKeyDataList = changeStringListToIntList(publicKey!);
var token = await Storage.getStringList(saveBlueToken); var token = await Storage.getStringList(saveBlueToken);
List<int> getTokenList = [0,0,0,0]; List<int> getTokenList = [0, 0, 0, 0];
if(token != null){ if (token != null) {
getTokenList = changeStringListToIntList(token); getTokenList = changeStringListToIntList(token);
} }
IoSenderManage.senderAddUser( IoSenderManage.senderAddUser(
lockID: BlueManage().connectDeviceName, lockID: BlueManage().connectDeviceName,
authUserID:await Storage.getUid(), authUserID: await Storage.getUid(),
keyID:"1", keyID: "1",
userID:receiveId, userID: receiveId,
openMode:1, openMode: 1,
keyType:(state.type.value == "1") ? 0 : 1, keyType: (state.type.value == "1") ? 0 : 1,
startDate:state.effectiveDateTime.value.millisecondsSinceEpoch, startDate: state.effectiveDateTime.value.millisecondsSinceEpoch,
expireDate:state.failureDateTime.value.millisecondsSinceEpoch, expireDate: state.failureDateTime.value.millisecondsSinceEpoch,
role:0, role: 0,
password:"123456", password: "123456",
needAuthor:1, needAuthor: 1,
publicKey:publicKeyDataList, publicKey: publicKeyDataList,
privateKey:getPrivateKeyList, privateKey: getPrivateKeyList,
token: getTokenList token: getTokenList);
);
} }
}); });
} }
// //
Future<void> sendElectronicKeyRequest() async { Future<void> sendElectronicKeyRequest(BuildContext widgetContext) async {
String getFailureDateTime = '0'; String getFailureDateTime = '0';
String getEffectiveDateTime = '0'; String getEffectiveDateTime = '0';
String lockID = state.keyInfo.value.lockId.toString(); String lockID = state.keyInfo.value.lockId.toString();
String getKeyType = (int.parse(state.type.value) + 1).toString(); String getKeyType = (int.parse(state.type.value) + 1).toString();
if (state.type.value == '0') { if (state.type.value == '0') {
getFailureDateTime = state.failureDateTime.value.millisecondsSinceEpoch.toString(); getFailureDateTime =
state.failureDateTime.value.millisecondsSinceEpoch.toString();
getEffectiveDateTime = getEffectiveDateTime =
state.effectiveDateTime.value.millisecondsSinceEpoch.toString(); state.effectiveDateTime.value.millisecondsSinceEpoch.toString();
} }
var entity = await ApiRepository.to.sendElectronicKey( var entity = await ApiRepository.to.sendElectronicKey(
state.isCreateUser.value ? "1" : "0", createUser: state.isCreateUser.value ? "1" : "0",
state.countryCode.value, countryCode: state.countryCode.value,
'1', usernameType: '1',
getFailureDateTime, endDate: getFailureDateTime,
state.isAuthentication.value == true ? '1' : '2', faceAuthentication: state.isAuthentication.value == true ? '1' : '2',
'2', isCameraEnable: '2',
'2', isRemoteUnlock: '2',
state.keyNameController.text, keyNameForAdmin: state.keyNameController.text,
'1', keyRight: '1',
getKeyType, keyType: getKeyType,
lockID, lockId: lockID,
'', operatorUid: '',
state.emailOrPhoneController.text, receiverUsername: state.emailOrPhoneController.text,
'', remarks: '',
getEffectiveDateTime, startDate: getEffectiveDateTime,
state.weekdaysList); weekDays: state.weekdaysList);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
print('发送电子钥匙成功'); print('发送电子钥匙成功');
state.isSendSuccess.value = true; state.isSendSuccess.value = true;
@ -260,15 +267,48 @@ class AuthorizedAdminLogic extends BaseGetXController {
state.addUserId.value = entity.data!.receiverUser!.id.toString(); state.addUserId.value = entity.data!.receiverUser!.id.toString();
addUserConnectBlue(state.addUserId.value); addUserConnectBlue(state.addUserId.value);
} else { } else {
// Toast.show(msg: '${entity.errorMsg}');
if (entity.errorCode == 425) { if (entity.errorCode == 425) {
// //
state.isCreateUser.value = true; _showDialog(widgetContext, '${entity.errorMsg}');
sendElectronicKeyRequest();
} }
} }
} }
//
void _showDialog(widgetContext, String errMsg) {
showCupertinoDialog(
context: widgetContext,
builder: (context) {
return CupertinoAlertDialog(
title: const Text('接收者号码未注册,请选择号码所在的国家并重新发送'),
actions: [
CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
onPressed: () {
Navigator.of(context).pop();
},
),
CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.selet!.tr),
onPressed: () async {
//
state.isCreateUser.value = true;
Navigator.of(context).pop();
var result = await Get.toNamed(Routers.seletCountryRegionPage);
if (result != null) {
result as Map<String, dynamic>;
state.countryCode.value = result['code'];
state.countryName.value = result['countryName'];
}
},
),
],
);
},
);
}
@override @override
void onReady() { void onReady() {
// TODO: implement onReady // TODO: implement onReady

View File

@ -202,7 +202,7 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
if (state.emailOrPhoneController.text.isNotEmpty && if (state.emailOrPhoneController.text.isNotEmpty &&
state.keyNameController.value.text.isNotEmpty) { state.keyNameController.value.text.isNotEmpty) {
// logic.addUserConnectBlue(); // logic.addUserConnectBlue();
logic.sendElectronicKeyRequest(); logic.sendElectronicKeyRequest(context);
} }
}), }),
Container( Container(
@ -358,11 +358,15 @@ class _AuthorizedAdminPageState extends State<AuthorizedAdminPage> {
alignment: Alignment.center, alignment: Alignment.center,
child: InkWell( child: InkWell(
onTap: () async { onTap: () async {
Contact? contact = Contact? currentContact =
await state.contactPicker.selectContact(); await state.contactPicker.selectContact();
setState(() { setState(() {
state.contact = contact!; state.contact = currentContact!;
// print("object111111111111 ${_contact.fullName} ${_contact.phoneNumbers}"); if (currentContact.phoneNumbers!.isNotEmpty) {
state.emailOrPhoneController.text = currentContact
.phoneNumbers![0]
.replaceAll(RegExp(r"\s+\b|\b\s"), "");
}
}); });
}, },
), ),

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get_utils/get_utils.dart'; import 'package:get/get_utils/get_utils.dart';
import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserListEntity.dart'; import 'package:star_lock/main/lockDetail/electronicKey/massSendElectronicKey/massSendLockGroupList/lockUserList/lockUserListEntity.dart';
@ -9,6 +10,8 @@ class MassSendReceiverCell extends StatelessWidget {
final int currentIndex; final int currentIndex;
LockUserData userData; LockUserData userData;
final VoidCallback clickDeleteUser; final VoidCallback clickDeleteUser;
final FlutterContactPicker contactPicker = FlutterContactPicker();
late Contact contact;
MassSendReceiverCell(int index, MassSendReceiverCell(int index,
{Key? key, {Key? key,
@ -138,10 +141,14 @@ class MassSendReceiverCell extends StatelessWidget {
child: InkWell( child: InkWell(
onTap: () async { onTap: () async {
// Contact? currentContact = // Contact? currentContact =
// await _contactPicker.selectContact(); // await contactPicker.selectContact();
// setState(() { // setState(() {
// _contact = currentContact!; // state.contact = currentContact!;
// // print("object111111111111 ${_contact.fullName} ${_contact.phoneNumbers}"); // if (currentContact.phoneNumbers!.isNotEmpty) {
// state.emailOrPhoneController.text = currentContact
// .phoneNumbers![0]
// .replaceAll(RegExp(r"\s+\b|\b\s"), "");
// }
// }); // });
}, },
), ),

View File

@ -1,13 +1,18 @@
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:get/get_utils/get_utils.dart';
import 'package:star_lock/appRouters.dart';
import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart'; import 'package:star_lock/main/lockDetail/electronicKey/sendElectronicKey/sendElectronicKey/sendElectronicKey_state.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
import 'package:star_lock/tools/baseGetXController.dart'; import 'package:star_lock/tools/baseGetXController.dart';
import 'package:star_lock/tools/toast.dart'; import 'package:star_lock/tools/toast.dart';
import 'package:star_lock/translations/trans_lib.dart';
class SendElectronicKeyLogic extends BaseGetXController { class SendElectronicKeyLogic extends BaseGetXController {
final SendElectronicKeyState state = SendElectronicKeyState(); final SendElectronicKeyState state = SendElectronicKeyState();
// //
Future<void> sendElectronicKeyRequest() async { Future<void> sendElectronicKeyRequest(BuildContext widgetContext) async {
String getFailureDateTime = '0'; String getFailureDateTime = '0';
String getEffectiveDateTime = '0'; String getEffectiveDateTime = '0';
String lockID = state.keyInfo.value.lockId.toString(); String lockID = state.keyInfo.value.lockId.toString();
@ -18,33 +23,67 @@ class SendElectronicKeyLogic extends BaseGetXController {
getEffectiveDateTime = getEffectiveDateTime =
state.effectiveDateTime.value.millisecondsSinceEpoch.toString(); state.effectiveDateTime.value.millisecondsSinceEpoch.toString();
} }
var entity = await ApiRepository.to.sendElectronicKey( var entity = await ApiRepository.to.sendElectronicKey(
state.isCreateUser.value ? "1" : "0", createUser: state.isCreateUser.value ? "1" : "0",
state.countryCode.value, countryCode: state.countryCode.value,
'1', usernameType: '1',
getFailureDateTime, endDate: getFailureDateTime,
state.isAuthentication.value == true ? '1' : '2', faceAuthentication: state.isAuthentication.value == true ? '1' : '2',
'2', isCameraEnable: '2',
state.isRemoteUnlock.value == true ? '1' : '2', isRemoteUnlock: state.isRemoteUnlock.value == true ? '1' : '2',
state.keyNameController.text, keyNameForAdmin: state.keyNameController.text,
'0', keyRight: '0',
getKeyType, keyType: getKeyType,
lockID, lockId: lockID,
'', operatorUid: '',
state.emailOrPhoneController.text, receiverUsername: state.emailOrPhoneController.text,
'', remarks: '',
getEffectiveDateTime, startDate: getEffectiveDateTime,
state.weekdaysList); weekDays: state.weekdaysList);
if (entity.errorCode!.codeIsSuccessful) { if (entity.errorCode!.codeIsSuccessful) {
print('发送电子钥匙成功'); print('发送电子钥匙成功');
state.isSendSuccess.value = true; state.isSendSuccess.value = true;
} else { } else {
Toast.show(msg: '${entity.errorMsg}');
if (entity.errorCode == 425) { if (entity.errorCode == 425) {
// //
state.isCreateUser.value = true; _showDialog(widgetContext, '${entity.errorMsg}');
sendElectronicKeyRequest();
} }
} }
} }
//
void _showDialog(widgetContext, String errMsg) {
showCupertinoDialog(
context: widgetContext,
builder: (context) {
return CupertinoAlertDialog(
title: const Text('接收者号码未注册,请选择号码所在的国家并重新发送'),
actions: [
CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.cancel!.tr),
onPressed: () {
Navigator.of(context).pop();
},
),
CupertinoDialogAction(
child: Text(TranslationLoader.lanKeys!.selet!.tr),
onPressed: () async {
//
state.isCreateUser.value = true;
Navigator.of(context).pop();
var result = await Get.toNamed(Routers.seletCountryRegionPage);
if (result != null) {
result as Map<String, dynamic>;
state.countryCode.value = result['code'];
state.countryName.value = result['countryName'];
}
},
),
],
);
},
);
}
} }

View File

@ -260,12 +260,12 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
if (state.failureDateTime.value if (state.failureDateTime.value
.compareTo(state.effectiveDateTime.value) == .compareTo(state.effectiveDateTime.value) ==
1) { 1) {
logic.sendElectronicKeyRequest(); logic.sendElectronicKeyRequest(context);
} else { } else {
Toast.show(msg: '失效时间需大于生效时间'); Toast.show(msg: '失效时间需大于生效时间');
} }
} else { } else {
logic.sendElectronicKeyRequest(); logic.sendElectronicKeyRequest(context);
} }
} else { } else {
Toast.show(msg: '请完善信息'); Toast.show(msg: '请完善信息');
@ -428,7 +428,11 @@ class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
await state.contactPicker.selectContact(); await state.contactPicker.selectContact();
setState(() { setState(() {
state.contact = currentContact!; state.contact = currentContact!;
// print("object111111111111 ${_contact.fullName} ${_contact.phoneNumbers}"); if (currentContact.phoneNumbers!.isNotEmpty) {
state.emailOrPhoneController.text = currentContact
.phoneNumbers![0]
.replaceAll(RegExp(r"\s+\b|\b\s"), "");
}
}); });
}, },
), ),

View File

@ -1,3 +1,4 @@
import 'package:date_format/date_format.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -37,15 +38,6 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
_inputNameController = TextEditingController(); _inputNameController = TextEditingController();
} }
static Future<dynamic> tokNative(String method,
{required Map arguments}) async {
if (arguments == null) {
return await methodChannel.invokeMethod(method);
} else {
return await methodChannel.invokeMethod(method, arguments);
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
dynamic obj = ModalRoute.of(context)?.settings.arguments; dynamic obj = ModalRoute.of(context)?.settings.arguments;
@ -66,36 +58,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
width: 30.w, width: 30.w,
), ),
onPressed: () { onPressed: () {
String pwdShareStr = _openModalBottomSheet();
'您好,您的密码是:${itemData.keyboardPwd}\n生效时间:${itemData.startDate}\n类型:永久\n锁名:${itemData.keyboardPwdName}';
tokNative('flutter_sharePassword_to_ios',
arguments: {'pwdShareStr': pwdShareStr}).then((result) {
print('$result');
});
print('与原生交互');
/*
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (context) {
return Container(
decoration: const BoxDecoration(
color: Colors.white,
),
constraints: const BoxConstraints(maxHeight: 700),
child: Row(
children: [
Image.asset(
'images/icon_wechat.png',
width: 50.0,
height: 50.0,
fit: BoxFit.fill,
)
],
),
); //maxHeight为你想要的数字就行
});
*/
}, },
), ),
], ],
@ -361,91 +324,124 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
); );
} }
Widget _shareWidget(BuildContext context) { Future _openModalBottomSheet() async {
List<String> nameItems = <String>[ showModalBottomSheet(
'微信', context: context,
'朋友圈', shape: RoundedRectangleBorder(
'QQ', borderRadius: BorderRadiusDirectional.circular(10)),
'QQ空间', constraints: BoxConstraints(maxHeight: 260.h),
'微博', builder: (BuildContext context) {
'FaceBook', return Column(
'邮件', children: [
'链接' SizedBox(
]; width: ScreenUtil().screenWidth,
List<String> urlItems = <String>[ height: 180.h,
'icon_wechat.png', child: ListView(
'icon_wechat_moments.png', scrollDirection: Axis.horizontal, //
'icon_qq.png', children: initBottomSheetList()),
'icon_qzone.png',
'icon_sina.png',
'icon_facebook.png',
'icon_email.png',
'icon_copylink.png'
];
return Container(
color: Colors.red,
height: 250.0,
child: GridView.builder(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4, mainAxisSpacing: 5.0, childAspectRatio: 1.0),
itemBuilder: (BuildContext context, int index) {
return Image.asset(
'images/${urlItems[index]}',
width: 50.0,
height: 50.0,
fit: BoxFit.fill,
);
},
itemCount: nameItems.length,
),
/*
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 0.0),
child: SizedBox(
height: 190.0,
child: GridView.builder(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
mainAxisSpacing: 5.0,
childAspectRatio: 1.0),
itemBuilder: (BuildContext context, int index) {
return Column(
children: <Widget>[
Padding(
padding:
const EdgeInsets.fromLTRB(0.0, 6.0, 0.0, 6.0),
child: Image.asset(
'images/${urlItems[index]}',
width: 50.0,
height: 50.0,
fit: BoxFit.fill,
)),
Text(nameItems[index])
],
);
},
itemCount: nameItems.length,
), ),
), Container(
), height: 8.h,
Container( color: AppColors.greyBackgroundColor,
height: 0.5, ),
color: Colors.blueGrey, TextButton(
), style: ButtonStyle(
const Center( overlayColor:
child: Padding( MaterialStateProperty.all<Color>(Colors.white)),
padding: EdgeInsets.fromLTRB(0.0, 8.0, 0.0, 8.0),
child: Text( child: Text(
'取 消', '取消',
style: TextStyle(fontSize: 18.0, color: Colors.blueGrey), style: TextStyle(
)), color: Colors.black, fontSize: ScreenUtil().setSp(24)),
) ),
], onPressed: () {
Navigator.pop(context);
},
)
],
);
});
}
List<Widget> initBottomSheetList() {
List<Widget> widgetList = [];
widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友', 0));
widgetList.add(buildCenter3('images/icon_message.png', '短信', 1));
widgetList.add(buildCenter3('images/icon_email.png', '邮件', 2));
widgetList.add(buildCenter3('images/icon_more.png', '更多', 3));
return widgetList;
}
GestureDetector buildCenter3(
String imageName, String titleStr, int itemIndex) {
return GestureDetector(
child: Container(
width: 120.w,
// height: 64.h,
margin:
EdgeInsets.only(top: 20.w, bottom: 20.w, left: 10.w, right: 10.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
imageName,
width: 50.w,
height: 50.h,
),
SizedBox(
height: 16.w,
),
Text(
titleStr,
style: TextStyle(
fontSize: ScreenUtil().setSp(20), color: Colors.black),
),
],
),
), ),
*/ onTap: () => _jumpSmartDeviceRoute(itemIndex),
); );
} }
_jumpSmartDeviceRoute(int itemIndex) {
switch (itemIndex) {
case 0:
//
{
String pwdShareStr =
'您好,您的密码是:${itemData.keyboardPwd}\n生效时间:${itemData.startDate}\n类型:永久\n锁名:${itemData.keyboardPwdName}';
tokNative('flutter_sharePassword_to_ios',
arguments: {'pwdShareStr': pwdShareStr}).then((result) {
print('$result');
});
print('与原生交互');
}
break;
case 1:
//
{}
break;
case 2:
//
{
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
}
break;
case 3:
//
{}
break;
default:
}
}
static Future<dynamic> tokNative(String method,
{required Map arguments}) async {
if (arguments == null) {
return await methodChannel.invokeMethod(method);
} else {
return await methodChannel.invokeMethod(method, arguments);
}
}
} }

View File

@ -1,11 +1,13 @@
import 'package:date_format/date_format.dart'; import 'package:date_format/date_format.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_pickers/pickers.dart'; import 'package:flutter_pickers/pickers.dart';
import 'package:flutter_pickers/style/default_style.dart'; import 'package:flutter_pickers/style/default_style.dart';
import 'package:flutter_pickers/time_picker/model/date_mode.dart'; import 'package:flutter_pickers/time_picker/model/date_mode.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:star_lock/app_settings/app_colors.dart';
import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart'; import 'package:star_lock/main/lockDetail/passwordKey/passwordKey_perpetual/passwordKey_perpetual_logic.dart';
import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart'; import 'package:star_lock/main/lockMian/entity/lockInfoEntity.dart';
import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/network/api_repository.dart';
@ -37,6 +39,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
final TextEditingController _nameController = TextEditingController(); final TextEditingController _nameController = TextEditingController();
final TextEditingController _pwdController = TextEditingController(); final TextEditingController _pwdController = TextEditingController();
final logic = Get.put(PasswordKeyPerpetualLogic()); final logic = Get.put(PasswordKeyPerpetualLogic());
static const methodChannel = MethodChannel('flutter_native_ios');
late bool _isSendSuccess; // late bool _isSendSuccess; //
late bool _isPermanent; // late bool _isPermanent; //
@ -581,7 +584,7 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
OutLineBtn( OutLineBtn(
btnName: '分享', btnName: '分享',
onClick: () { onClick: () {
Navigator.pushNamed(context, Routers.sendEmailNotificationPage); _openModalBottomSheet();
}, },
), ),
SizedBox( SizedBox(
@ -644,4 +647,125 @@ class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
String intToStr(int v) { String intToStr(int v) {
return (v < 10) ? "0$v" : "$v"; return (v < 10) ? "0$v" : "$v";
} }
Future _openModalBottomSheet() async {
showModalBottomSheet(
context: context,
shape: RoundedRectangleBorder(
borderRadius: BorderRadiusDirectional.circular(10)),
constraints: BoxConstraints(maxHeight: 260.h),
builder: (BuildContext context) {
return Column(
children: [
SizedBox(
width: ScreenUtil().screenWidth,
height: 180.h,
child: ListView(
scrollDirection: Axis.horizontal, //
children: initBottomSheetList()),
),
Container(
height: 8.h,
color: AppColors.greyBackgroundColor,
),
TextButton(
style: ButtonStyle(
overlayColor:
MaterialStateProperty.all<Color>(Colors.white)),
child: Text(
'取消',
style: TextStyle(
color: Colors.black, fontSize: ScreenUtil().setSp(24)),
),
onPressed: () {
Navigator.pop(context);
},
)
],
);
});
}
List<Widget> initBottomSheetList() {
List<Widget> widgetList = [];
widgetList.add(buildCenter3('images/icon_wechat.png', '微信好友', 0));
widgetList.add(buildCenter3('images/icon_message.png', '短信', 1));
widgetList.add(buildCenter3('images/icon_email.png', '邮件', 2));
widgetList.add(buildCenter3('images/icon_more.png', '更多', 3));
return widgetList;
}
GestureDetector buildCenter3(
String imageName, String titleStr, int itemIndex) {
return GestureDetector(
child: Container(
width: 120.w,
// height: 64.h,
margin:
EdgeInsets.only(top: 20.w, bottom: 20.w, left: 10.w, right: 10.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
imageName,
width: 50.w,
height: 50.h,
),
SizedBox(
height: 16.w,
),
Text(
titleStr,
style: TextStyle(
fontSize: ScreenUtil().setSp(20), color: Colors.black),
),
],
),
),
onTap: () => _jumpSmartDeviceRoute(itemIndex),
);
}
//\n生效时间${itemData.startDate}\n类型\n锁名${itemData.keyboardPwdName}
_jumpSmartDeviceRoute(int itemIndex) {
switch (itemIndex) {
case 0:
//
{
String pwdShareStr = '您好,您的密码是:$_getPwdStr';
tokNative('flutter_sharePassword_to_ios',
arguments: {'pwdShareStr': pwdShareStr}).then((result) {
print('$result');
});
print('与原生交互');
}
break;
case 1:
//
{}
break;
case 2:
//
{
Navigator.pushNamed(context, Routers.sendEmailNotificationPage);
}
break;
case 3:
//
{}
break;
default:
}
}
static Future<dynamic> tokNative(String method,
{required Map arguments}) async {
if (arguments == null) {
return await methodChannel.invokeMethod(method);
} else {
return await methodChannel.invokeMethod(method, arguments);
}
}
} }

View File

@ -74,9 +74,10 @@ class BaseProvider extends GetConnect with Api {
case 430: //ErrorMsg case 430: //ErrorMsg
Toast.show(msg: T["errorMsg"]); Toast.show(msg: T["errorMsg"]);
break; break;
case 425: //
Toast.show(msg: "用户不存在"); // case 425:
break; // Toast.show(msg: "用户不存在");
// break;
case 10001: case 10001:
Toast.show(msg: "数据不存在"); Toast.show(msg: "数据不存在");
break; break;

View File

@ -136,22 +136,22 @@ class ApiRepository {
// //
Future<AuthorizedAdminSendEntity> sendElectronicKey( Future<AuthorizedAdminSendEntity> sendElectronicKey(
String createUser, {required String createUser,
String countryCode, required String countryCode,
String usernameType, required String usernameType,
String endDate, required String endDate,
String faceAuthentication, required String faceAuthentication,
String isCameraEnable, required String isCameraEnable,
String isRemoteUnlock, required String isRemoteUnlock,
String keyNameForAdmin, required String keyNameForAdmin,
String keyRight, required String keyRight,
String keyType, required String keyType,
String lockId, required String lockId,
String operatorUid, required String operatorUid,
String receiverUsername, required String receiverUsername,
String remarks, required String remarks,
String startDate, required String startDate,
List weekDays) async { required List weekDays}) async {
final res = await apiProvider.sendElectronicKey( final res = await apiProvider.sendElectronicKey(
createUser, createUser,
countryCode, countryCode,