将扫码和二维码识别代码独立出来

This commit is contained in:
cebgcontract 2022-11-28 13:07:37 +08:00
parent 885a023bc4
commit 8cf0f57665
10 changed files with 346 additions and 342 deletions

View File

@ -16,6 +16,7 @@
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
#include "AppDelegate.h"
#import "UIViewController+Wallet.h"
#import "UIViewController+QR.h"
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)

View File

@ -0,0 +1,18 @@
//
// UIViewController+QR.h
// Unity-iPhone
//
// Created by zhl on 2022/11/28.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIViewController (QR)
-(void)scanQRCode:(NSString *)funid title:(NSString *) title;
-(void)showQRCode:(NSString *) content title:(NSString *) title oid:(NSString *) oid;
-(void)loadRestoreKey:(NSString *)funid oid:(NSString *) oid;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,212 @@
//
// UIViewController+QR.m
// Unity-iPhone
//
// Created by zhl on 2022/11/28.
//
#import "UIViewController+QR.h"
#import "QRCodeReaderViewController.h"
#import "QRCodeReader.h"
#import "QRCodeReaderDelegate.h"
#include "permission/LBXPermission.h"
#include "permission/LBXPermissionSetting.h"
#include "LBXScanNative.h"
#include "LBXScanTypes.h"
#include "QrCodeViewController.h"
#include <string>
@interface UIViewController (QR)<UIImagePickerControllerDelegate, UINavigationControllerDelegate>
@end
@implementation UIViewController (QR)
-(void)showQRCode:(NSString *) content title:(NSString *) title oid:(NSString *) oid {
NSLog(@"showQRCode content: %@, title: %@, oid: %@", content, title, oid);
dispatch_async(dispatch_get_main_queue(), ^{
QrCodeViewController *vc = [QrCodeViewController new];
vc.content = content;
vc.tipTitle = title;
vc.autosave = TRUE;
NSString *tipTxt = @"This QR code is only used to export account recovery private key.\n \
\n \
1. Use CEBG client to scan the QR code to get the account recovery private key. \n\
\n \
2. Account of ios cannot login to Andorid device. \n \
\n \
3. Please keep your private key as safe as possible.";
vc.tipTxt = tipTxt;
[self presentViewController:vc animated:YES completion:nil];
});
}
-(void)loadRestoreKey:(NSString *)funid oid:(NSString *) oid{
NSLog(@"loadRestoreKey::funid: %@, oid:%@", funid, oid);
// if ([NSThread isMainThread]) {
//
// }
dispatch_async(dispatch_get_main_queue(), ^{
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Tips"
message:@"In order to restore recovery key, please Scan QRCode or Pick from Photo Library."
preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *actionCancel = [UIAlertAction actionWithTitle:@"Cancel"
style:UIAlertActionStyleCancel
handler: ^(UIAlertAction *action){
NSLog(@"alert cancel pressed");
}];
UIAlertAction *scanAction = [UIAlertAction actionWithTitle:@"Scan"
style:UIAlertActionStyleDefault
handler: ^(UIAlertAction *action){
NSLog(@"scan pressed");
[self scanQRCode:funid title: @"" ];
}];
UIAlertAction *photoAction = [UIAlertAction actionWithTitle:@"Photo"
style:UIAlertActionStyleDefault
handler: ^(UIAlertAction *action){
NSLog(@"photo pressed");
[self openLocalPhotoAlbum];
}];
[alertController addAction:actionCancel];
[alertController addAction:scanAction];
[alertController addAction:photoAction];
[self presentViewController:alertController animated:YES completion:nil];
});
}
-(void)startScanQRCode:(NSString *)funid title:(NSString *) title{
std::string sfunid = std::string([funid UTF8String], [funid lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
if ([QRCodeReader supportsMetadataObjectTypes:@[AVMetadataObjectTypeQRCode]]) {
static QRCodeReaderViewController *vc = nil;
static dispatch_once_t onceToken;
dispatch_async(dispatch_get_main_queue(), ^{
// if we are active again, we don't need to do this anymore
if (vc == nil) {
QRCodeReader *reader = [QRCodeReader readerWithMetadataObjectTypes:@[AVMetadataObjectTypeQRCode]];
vc = [QRCodeReaderViewController readerWithCancelButtonTitle:@"Cancel" codeReader:reader startScanningAtLoad:YES showSwitchCameraButton:YES showTorchButton:YES];
vc.modalPresentationStyle = UIModalPresentationFormSheet;
}
[vc setCompletionWithBlock:^(NSString *resultAsString) {
NSLog(@"Completion with result: %@", resultAsString);
[self dismissViewControllerAnimated:YES completion:^{
NSString *result;
if (resultAsString.length > 0) {
result = [NSString stringWithFormat:@"{errcode: 0, data: '%@'}", resultAsString];
} else {
result = [NSString stringWithFormat:@"{errcode: 1, errmsg: 'cancel'}"];
}
std::string sresult = std::string([result UTF8String], [result lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
// WalletEvent::Emit(sfunid.c_str(), sresult.c_str());
}];
}];
[self presentViewController:vc animated:YES completion:NULL];
});
}
}
-(void)scanQRCode:(NSString *)funid title:(NSString *) title{
NSLog(@"scanQRCode:: funId: %@ title: %@", funid, title);
// [self openLocalPhotoAlbum];
// [self signWithApple];
__weak __typeof(self) weakSelf = self;
[LBXPermission authorizeWithType:LBXPermissionType_Camera completion:^(BOOL granted, BOOL firstTime) {
if (granted) {
[weakSelf startScanQRCode:funid title:title];
}
else if(!firstTime)
{
[LBXPermissionSetting showAlertToDislayPrivacySettingWithTitle:@"Error" msg:@"The camera is need to scan QR codes" cancel:@"Cancel" setting:@"Setting" ];
}
}];
}
#pragma mark- - PhotoAlbum
- (void)openLocalPhotoAlbum {
__weak __typeof(self) weakSelf = self;
dispatch_async(dispatch_get_main_queue(), ^{
[LBXPermission authorizeWithType:LBXPermissionType_Photos completion:^(BOOL granted, BOOL firstTime) {
if (granted) {
[weakSelf openLocalPhoto];
}
else if (!firstTime )
{
[LBXPermissionSetting showAlertToDislayPrivacySettingWithTitle:@"Error" msg:@"The Photo Library is need to restore recovery key." cancel:@"Cancel" setting:@"Setting"];
}
}];
});
}
/*!
* open local Photo Library
*/
- (void)openLocalPhoto
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.delegate = self;
// crash on some mobile
picker.allowsEditing = NO;
[self presentViewController:picker animated:YES completion:nil];
}
#pragma mark- - UIImagePickerControllerDelegate
-(void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[picker dismissViewControllerAnimated:YES completion:^{
[self handPhotoDidFinishPickingMediaWithInfo:info];
}];
}
- (void)handPhotoDidFinishPickingMediaWithInfo:(NSDictionary *)info
{
__block UIImage* image = [info objectForKey:UIImagePickerControllerEditedImage];
if (!image){
image = [info objectForKey:UIImagePickerControllerOriginalImage];
}
if (@available(iOS 8.0, *)) {
__weak __typeof(self) weakSelf = self;
[LBXScanNative recognizeImage:image success:^(NSArray<LBXScanResult *> *array) {
[weakSelf scanResultWithArray:array];
}];
}else{
NSLog(@"native低于ios8.0不支持识别图片");
}
}
- (void)scanResultWithArray:(NSArray<LBXScanResult*>*)array
{
if (!array || array.count < 1)
{
NSLog(@"error scan photo");
return;
}
for (LBXScanResult *result in array) {
NSLog(@"scanResult:%@",result.strScanned);
}
if (!array[0].strScanned || [array[0].strScanned isEqualToString:@""] ) {
NSLog(@"识别失败了");
return;
}
LBXScanResult *scanResult = array[0];
}
@end

View File

@ -13,9 +13,6 @@
@interface UIViewController (Wallet)
+(void)toWallet:(NSString *)url;
-(void)scanQRCode:(NSString *)funid title:(NSString *) title;
-(void)showQRCode:(NSString *) content title:(NSString *) title oid:(NSString *) oid;
-(void)loadRestoreKey:(NSString *)funid oid:(NSString *) oid;
-(void)signWithGoogle:(NSString *)funid;
-(void)signOutGoogle:(NSString *)funid;
-(void)saveKey:(NSString *) account key:(NSString *) key;

View File

@ -6,26 +6,20 @@
//
#import "UIViewController+Wallet.h"
#import "QRCodeReaderViewController.h"
#import "QRCodeReader.h"
#import "QRCodeReaderDelegate.h"
#include <string>
#include "WalletEvent.h"
#include "JcWallet.h"
#import <GoogleSignIn/GoogleSignIn.h>
#include "KeyChain/DataManager.h"
#include "permission/LBXPermission.h"
#include "permission/LBXPermissionSetting.h"
#include "LBXScanNative.h"
#include "LBXScanTypes.h"
#include "QrCodeViewController.h"
#import <AuthenticationServices/AuthenticationServices.h>
@import GoogleSignIn;
static NSString * const kClientID =
@"53206975661-0d6q9pqljn84n9l63gm0to1ulap9cbk4.apps.googleusercontent.com";
@interface UIViewController (Wallet)<UIImagePickerControllerDelegate, UINavigationControllerDelegate>
@interface UIViewController (Wallet)<ASAuthorizationControllerDelegate>
@end
@implementation UIViewController (Wallet)
@ -35,28 +29,7 @@ static NSString * const kClientID =
[app openURL:[NSURL URLWithString:url]];
}
-(void)showQRCode:(NSString *) content title:(NSString *) title oid:(NSString *) oid {
NSLog(@"showQRCode content: %@, title: %@, oid: %@", content, title, oid);
dispatch_async(dispatch_get_main_queue(), ^{
QrCodeViewController *vc = [QrCodeViewController new];
vc.content = content;
vc.tipTitle = title;
vc.autosave = TRUE;
NSString *tipTxt = @"This QR code is only used to export account recovery private key.\n \
\n \
1. Use CEBG client to scan the QR code to get the account recovery private key. \n\
\n \
2. Account of ios cannot login to Andorid device. \n \
\n \
3. Please keep your private key as safe as possible.";
vc.tipTxt = tipTxt;
[self presentViewController:vc animated:YES completion:nil];
});
}
-(void)loadRestoreKey:(NSString *)funid oid:(NSString *) oid{
NSLog(@"loadRestoreKey::funid: %@, oid:%@", funid, oid);
}
// save key to key chain
-(void)saveKey:(NSString *) account key:(NSString *) key {
@ -69,72 +42,8 @@ static NSString * const kClientID =
return [[DataManager sharedInstanceWith: SynLock] loadKey: account];
}
-(void)scanQRCode:(NSString *)funid title:(NSString *) title{
NSLog(@"scanQRCode:: funId: %@ title: %@", funid, title);
[self openLocalPhotoAlbum];
// std::string sfunid = std::string([funid UTF8String], [funid lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
// if ([QRCodeReader supportsMetadataObjectTypes:@[AVMetadataObjectTypeQRCode]]) {
// static QRCodeReaderViewController *vc = nil;
// static dispatch_once_t onceToken;
//
// dispatch_async(dispatch_get_main_queue(), ^{
// // if we are active again, we don't need to do this anymore
// if (vc == nil) {
// QRCodeReader *reader = [QRCodeReader readerWithMetadataObjectTypes:@[AVMetadataObjectTypeQRCode]];
// vc = [QRCodeReaderViewController readerWithCancelButtonTitle:@"Cancel" codeReader:reader startScanningAtLoad:YES showSwitchCameraButton:YES showTorchButton:YES];
// vc.modalPresentationStyle = UIModalPresentationFormSheet;
// }
//
// [vc setCompletionWithBlock:^(NSString *resultAsString) {
// NSLog(@"Completion with result: %@", resultAsString);
// [self dismissViewControllerAnimated:YES completion:^{
//
// NSString *result;
// if (resultAsString.length > 0) {
// result = [NSString stringWithFormat:@"{errcode: 0, data: '%@'}", resultAsString];
// } else {
// result = [NSString stringWithFormat:@"{errcode: 1, errmsg: 'cancel'}"];
// }
// std::string sresult = std::string([result UTF8String], [result lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
// WalletEvent::Emit(sfunid.c_str(), sresult.c_str());
// }];
// }];
// [self presentViewController:vc animated:YES completion:NULL];
// });
// }
// else {
// dispatch_async(dispatch_get_main_queue(), ^{
// UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Error"
// message:@"The camera is need to scan QR codes"
// preferredStyle:UIAlertControllerStyleAlert];
// //We add buttons to the alert controller by creating UIAlertActions:
// UIAlertAction *actionOk = [UIAlertAction actionWithTitle:@"Cancel"
// style:UIAlertActionStyleCancel
// handler: ^(UIAlertAction *action){
// NSLog(@"alert cancel pressed");
// }]; //You can use a block here to handle a press on this button
// //
// UIAlertAction *setting = [UIAlertAction actionWithTitle:@"Setting"
// style:UIAlertActionStyleDefault
// handler: ^(UIAlertAction *action){
// NSLog(@"setting pressed");
// NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
// if ([[UIApplication sharedApplication] canOpenURL:url]){
// [[UIApplication sharedApplication] openURL:url];
// }
// }];
// [alertController addAction:actionOk];
// [alertController addAction:setting];
// [self presentViewController:alertController animated:YES completion:nil];
// });
//
// std::string sresult = "{errcode: 1, errmsg: 'no camera permission'}";
// WalletEvent::Emit(sfunid.c_str(), sresult.c_str());
// }
}
-(void)signToGoogle:(NSString *) funid {
GIDConfiguration *_configuration = [[GIDConfiguration alloc] initWithClientID:kClientID];
[GIDSignIn.sharedInstance signInWithConfiguration:_configuration
@ -206,103 +115,82 @@ static NSString * const kClientID =
NSLog(@"hostedDomain: %@", GIDSignIn.sharedInstance.currentUser.hostedDomain);
}
-(void)checkOnSvr:(NSString *) idToken {
// NSString *signinEndpoint = @"https://yourbackend.example.com/tokensignin";
// NSDictionary *params = @{@"idtoken": idToken};
//
// NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:signinEndpoint];
// [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
// [request setHTTPMethod:@"POST"];
// [request setHTTPBody:[self httpBodyForParamsDictionary:params]];
//
// NSOperationQueue *queue = [[NSOperationQueue alloc] init];
// [NSURLConnection sendAsynchronousRequest:request
// queue:queue
// completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
// if (error) {
// NSLog(@"Error: %@", error.localizedDescription);
// } else {
// NSLog(@"Signed in as %@", data.bytes);
// }
// }];
}
#pragma mark- - PhotoAlbum
- (void)openLocalPhotoAlbum {
__weak __typeof(self) weakSelf = self;
dispatch_async(dispatch_get_main_queue(), ^{
[LBXPermission authorizeWithType:LBXPermissionType_Photos completion:^(BOOL granted, BOOL firstTime) {
if (granted) {
[weakSelf openLocalPhoto];
}
else if (!firstTime )
{
[LBXPermissionSetting showAlertToDislayPrivacySettingWithTitle:@"提示" msg:@"没有相册权限,是否前往设置" cancel:@"取消" setting:@"设置"];
}
}];
});
}
/*!
* open local Photo Library
*/
- (void)openLocalPhoto
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.delegate = self;
// crash on some mobile
picker.allowsEditing = NO;
[self presentViewController:picker animated:YES completion:nil];
}
#pragma mark- - UIImagePickerControllerDelegate
-(void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[picker dismissViewControllerAnimated:YES completion:^{
[self handPhotoDidFinishPickingMediaWithInfo:info];
}];
}
- (void)handPhotoDidFinishPickingMediaWithInfo:(NSDictionary *)info
{
__block UIImage* image = [info objectForKey:UIImagePickerControllerEditedImage];
if (!image){
image = [info objectForKey:UIImagePickerControllerOriginalImage];
}
if (@available(iOS 8.0, *)) {
__weak __typeof(self) weakSelf = self;
[LBXScanNative recognizeImage:image success:^(NSArray<LBXScanResult *> *array) {
[weakSelf scanResultWithArray:array];
}];
#pragma mark- - Sign In With Apple
- (void) signWithApple {
if (@available(iOS 13.0, *)) {
ASAuthorizationAppleIDProvider *appleIdProvider = [[ASAuthorizationAppleIDProvider alloc] init];
ASAuthorizationAppleIDRequest *request = appleIdProvider.createRequest;
request.requestedScopes = @[ASAuthorizationScopeEmail, ASAuthorizationScopeFullName];
ASAuthorizationController *controller = [[ASAuthorizationController alloc] initWithAuthorizationRequests:@[request]];
controller.delegate = self;
[controller performRequests];
} else {
NSLog(@"native低于ios8.0不支持识别图片");
NSLog(@"system is lower");
}
}
- (void)scanResultWithArray:(NSArray<LBXScanResult*>*)array
{
if (!array || array.count < 1)
{
NSLog(@"error scan photo");
return;
- (void)authorizationController:(ASAuthorizationController *)controller didCompleteWithAuthorization:(ASAuthorization *)authorization API_AVAILABLE(ios(13.0)) {
if ([authorization.credential isKindOfClass:[ASAuthorizationAppleIDCredential class]]) {
// 用户登录使用ASAuthorizationAppleIDCredential
ASAuthorizationAppleIDCredential *credential = authorization.credential;
NSString *user = credential.user;
NSData *identityToken = credential.identityToken;
NSLog(@"fullName - %@",credential.fullName);
//授权成功后,你可以拿到苹果返回的全部数据,根据需要和后台交互。
NSLog(@"user - %@ %@",user,identityToken);
//保存apple返回的唯一标识符
[[NSUserDefaults standardUserDefaults] setObject:user forKey:@"userIdentifier"];
[[NSUserDefaults standardUserDefaults] synchronize];
} else if ([authorization.credential isKindOfClass:[ASPasswordCredential class]]) {
// 用户登录使用现有的密码凭证
ASPasswordCredential *psdCredential = authorization.credential;
// 密码凭证对象的用户标识 用户的唯一标识
NSString *user = psdCredential.user;
NSString *psd = psdCredential.password;
NSLog(@"psduser - %@ %@",psd,user);
} else {
NSLog(@"授权信息不符");
}
}
for (LBXScanResult *result in array) {
NSLog(@"scanResult:%@",result.strScanned);
#pragma mark - 授权回调失败
- (void)authorizationController:(ASAuthorizationController *)controller didCompleteWithError:(NSError *)error API_AVAILABLE(ios(13.0)){
NSLog(@"错误信息:%@", error);
NSString *errorMsg;
switch (error.code) {
case ASAuthorizationErrorCanceled:
errorMsg = @"用户取消了授权请求";
NSLog(@"errorMsg - %@",errorMsg);
break;
case ASAuthorizationErrorFailed:
errorMsg = @"授权请求失败";
NSLog(@"errorMsg - %@",errorMsg);
break;
case ASAuthorizationErrorInvalidResponse:
errorMsg = @"授权请求响应无效";
NSLog(@"errorMsg - %@",errorMsg);
break;
case ASAuthorizationErrorNotHandled:
errorMsg = @"未能处理授权请求";
NSLog(@"errorMsg - %@",errorMsg);
break;
case ASAuthorizationErrorUnknown:
errorMsg = @"授权请求失败未知原因";
NSLog(@"errorMsg - %@",errorMsg);
break;
default:
break;
}
}
if (!array[0].strScanned || [array[0].strScanned isEqualToString:@""] ) {
NSLog(@"识别失败了");
return;
}
LBXScanResult *scanResult = array[0];
}
@end

View File

@ -81,6 +81,7 @@
D5538BA5287E9908000BDFB6 /* WalletEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D5538BA3287E9908000BDFB6 /* WalletEvent.cpp */; };
D56436422930AAF700E2B633 /* UIView+Toast.m in Sources */ = {isa = PBXBuildFile; fileRef = D56436412930AAF700E2B633 /* UIView+Toast.m */; };
D56436462930ABAB00E2B633 /* UIUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = D56436452930ABAB00E2B633 /* UIUtils.m */; };
D56436492930BC1300E2B633 /* AuthenticationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D56436472930BC0900E2B633 /* AuthenticationServices.framework */; };
D579209F292F3C94004DBD4F /* LBXScanNative.m in Sources */ = {isa = PBXBuildFile; fileRef = D579209E292F3C94004DBD4F /* LBXScanNative.m */; };
D57920A2292F3D28004DBD4F /* LBXScanTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = D57920A1292F3D28004DBD4F /* LBXScanTypes.m */; };
D57920A5292F4738004DBD4F /* QrCodeViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D57920A4292F4738004DBD4F /* QrCodeViewController.xib */; };
@ -99,6 +100,7 @@
D5AB1D3628BF782300AA6AFA /* QRCodeReaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = D5AB1D2E28BF782200AA6AFA /* QRCodeReaderView.m */; };
D5AB1D3728BF782300AA6AFA /* QRCodeReader.m in Sources */ = {isa = PBXBuildFile; fileRef = D5AB1D3228BF782300AA6AFA /* QRCodeReader.m */; };
D5AB1D4328C0539600AA6AFA /* UIViewController+Wallet.mm in Sources */ = {isa = PBXBuildFile; fileRef = D5AB1D4228C0539600AA6AFA /* UIViewController+Wallet.mm */; };
D5D9BAF9293477E700F18A7F /* UIViewController+QR.mm in Sources */ = {isa = PBXBuildFile; fileRef = D5D9BAF8293477E700F18A7F /* UIViewController+QR.mm */; };
D5F2CED6287BE9C4003C2B62 /* Data in Resources */ = {isa = PBXBuildFile; fileRef = D5F2CED5287BE9C4003C2B62 /* Data */; };
D5F2CF41287BEC0D003C2B62 /* Bulk_Generics_3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D5F2CED8287BEC0D003C2B62 /* Bulk_Generics_3.cpp */; };
D5F2CF42287BEC0D003C2B62 /* Il2CppMethodPointerTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D5F2CED9287BEC0D003C2B62 /* Il2CppMethodPointerTable.cpp */; };
@ -378,6 +380,7 @@
D56436412930AAF700E2B633 /* UIView+Toast.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIView+Toast.m"; sourceTree = "<group>"; };
D56436442930ABAB00E2B633 /* UIUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UIUtils.h; sourceTree = "<group>"; };
D56436452930ABAB00E2B633 /* UIUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UIUtils.m; sourceTree = "<group>"; };
D56436472930BC0900E2B633 /* AuthenticationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AuthenticationServices.framework; path = System/Library/Frameworks/AuthenticationServices.framework; sourceTree = SDKROOT; };
D579209C292F3C94004DBD4F /* LBXScanNative.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LBXScanNative.h; sourceTree = "<group>"; };
D579209E292F3C94004DBD4F /* LBXScanNative.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LBXScanNative.m; sourceTree = "<group>"; };
D57920A0292F3D28004DBD4F /* LBXScanTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LBXScanTypes.h; sourceTree = "<group>"; };
@ -413,6 +416,8 @@
D5AB1D3228BF782300AA6AFA /* QRCodeReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QRCodeReader.m; sourceTree = "<group>"; };
D5AB1D4128C0539600AA6AFA /* UIViewController+Wallet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIViewController+Wallet.h"; sourceTree = "<group>"; };
D5AB1D4228C0539600AA6AFA /* UIViewController+Wallet.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = "UIViewController+Wallet.mm"; sourceTree = "<group>"; };
D5D9BAF7293477E700F18A7F /* UIViewController+QR.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIViewController+QR.h"; sourceTree = "<group>"; };
D5D9BAF8293477E700F18A7F /* UIViewController+QR.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = "UIViewController+QR.mm"; sourceTree = "<group>"; };
D5F2CED5287BE9C4003C2B62 /* Data */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Data; path = /Users/zhl/Documents/workspace/unity/first/first/target/ios/Data; sourceTree = "<group>"; };
D5F2CED8287BEC0D003C2B62 /* Bulk_Generics_3.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Bulk_Generics_3.cpp; sourceTree = "<group>"; };
D5F2CED9287BEC0D003C2B62 /* Il2CppMethodPointerTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Il2CppMethodPointerTable.cpp; sourceTree = "<group>"; };
@ -553,6 +558,7 @@
D5F2CFCA287BF7E4003C2B62 /* libicucore.A.tbd in Frameworks */,
5BAD78611F2B5A59006103DE /* Security.framework in Frameworks */,
960391221D6CE46E003BF157 /* MediaToolbox.framework in Frameworks */,
D56436492930BC1300E2B633 /* AuthenticationServices.framework in Frameworks */,
00000000008063A1000160D3 /* libiPhone-lib.a in Frameworks */,
AA5D99871AFAD3C800B27605 /* CoreText.framework in Frameworks */,
8358D1B80ED1CC3700E3A684 /* AudioToolbox.framework in Frameworks */,
@ -631,6 +637,7 @@
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
D56436472930BC0900E2B633 /* AuthenticationServices.framework */,
D59AB423292DBACE00714392 /* CloudKit.framework */,
D5F2CFCF287BF80A003C2B62 /* libz.tbd */,
D5F2CFCD287BF7FE003C2B62 /* JavaScriptCore.framework */,
@ -968,6 +975,8 @@
D5F2CFAF287BF3BD003C2B62 /* AppDelegate.mm */,
D5AB1D4128C0539600AA6AFA /* UIViewController+Wallet.h */,
D5AB1D4228C0539600AA6AFA /* UIViewController+Wallet.mm */,
D5D9BAF7293477E700F18A7F /* UIViewController+QR.h */,
D5D9BAF8293477E700F18A7F /* UIViewController+QR.mm */,
D5F2D105287C12DD003C2B62 /* JcWallet.h */,
D5F2D104287C12DD003C2B62 /* JcWallet.mm */,
D5538BA4287E9908000BDFB6 /* WalletEvent.h */,
@ -1390,6 +1399,7 @@
D5F2CF66287BEC0D003C2B62 /* Bulk_mscorlib_4.cpp in Sources */,
D59AB4AE292F325E00714392 /* LBXPermissionCamera.m in Sources */,
AAC3E38D1A68945900F6174A /* RegisterFeatures.cpp in Sources */,
D5D9BAF9293477E700F18A7F /* UIViewController+QR.mm in Sources */,
84DC28F61C5137FE00BC67D7 /* UnityReplayKit.mm in Sources */,
D5F2CF73287BEC0D003C2B62 /* Bulk_System_0.cpp in Sources */,
8ACB801C177081D4005D0019 /* DeviceSettings.mm in Sources */,
@ -1473,6 +1483,7 @@
INFOPLIST_FILE = Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_GENERATE_MAP_FILE = YES;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",
@ -1559,6 +1570,7 @@
INFOPLIST_FILE = Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_GENERATE_MAP_FILE = YES;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",
@ -1775,6 +1787,7 @@
INFOPLIST_FILE = Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_GENERATE_MAP_FILE = YES;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",
@ -1933,6 +1946,7 @@
INFOPLIST_FILE = Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_GENERATE_MAP_FILE = YES;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",

View File

@ -4,86 +4,6 @@
type = "0"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "E0288EC9-2219-448E-B2DD-6DDA4F630BA8"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/UIViewController+Wallet.mm"
startingColumnNumber = "11"
endingColumnNumber = "11"
startingLineNumber = "114"
endingLineNumber = "114"
landmarkName = "-scanQRCode:title:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "9F010FF7-8933-4BD6-BC43-6849397915A8"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/UIViewController+Wallet.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "112"
endingLineNumber = "112"
landmarkName = "-scanQRCode:title:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "0122C416-0F1D-462A-BC01-2963ECF9616B"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/UIViewController+Wallet.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "114"
endingLineNumber = "114"
landmarkName = "-scanQRCode:title:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "82332A3C-7E7D-474A-946A-216488F38FF0"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/UIViewController+Wallet.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "113"
endingLineNumber = "113"
landmarkName = "-scanQRCode:title:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "E16E4501-C8B9-4FBB-B5DD-797119FF44F9"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/UIViewController+Wallet.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "119"
endingLineNumber = "119"
landmarkName = "-scanQRCode:title:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
@ -100,54 +20,6 @@
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "47347B45-DB23-4252-AFCD-8D070482488B"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/UIViewController+Wallet.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "73"
endingLineNumber = "73"
landmarkName = "-scanQRCode:title:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "DF8812E4-AA7D-42CD-BA48-816CB6377C98"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/UIViewController+Wallet.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "77"
endingLineNumber = "77"
landmarkName = "-scanQRCode:title:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "6DA3708B-7F80-4969-83A7-4AE84264C340"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/UIViewController+Wallet.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "72"
endingLineNumber = "72"
landmarkName = "-scanQRCode:title:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
@ -158,8 +30,8 @@
filePath = "Classes_cocos/JcWallet.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "205"
endingLineNumber = "205"
startingLineNumber = "206"
endingLineNumber = "206"
landmarkName = "runWalletMethod(funId, methodName, paramCount, paramList)"
landmarkType = "9">
</BreakpointContent>
@ -174,8 +46,8 @@
filePath = "Classes_cocos/JcWallet.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "169"
endingLineNumber = "169"
startingLineNumber = "170"
endingLineNumber = "170"
landmarkName = "JcWallet::tickRun()"
landmarkType = "7">
</BreakpointContent>
@ -190,11 +62,27 @@
filePath = "Classes_cocos/JcWallet.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "272"
endingLineNumber = "272"
startingLineNumber = "273"
endingLineNumber = "273"
landmarkName = "jsb_wallet_callback(s)"
landmarkType = "9">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "CD5DBE0E-A7FC-4F93-B4A6-3E7E540525FA"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Classes_cocos/UIViewController+Wallet.mm"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "133"
endingLineNumber = "133"
landmarkName = "-authorizationController:didCompleteWithAuthorization:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>

View File

@ -8,21 +8,6 @@
<array>
<string>Default</string>
</array>
<key>com.apple.developer.icloud-container-identifiers</key>
<array>
<string>iCloud.com.jc.tebg</string>
</array>
<key>com.apple.developer.icloud-services</key>
<array>
<string>CloudDocuments</string>
<string>CloudKit</string>
</array>
<key>com.apple.developer.ubiquity-container-identifiers</key>
<array>
<string>iCloud.com.jc.tebg</string>
</array>
<key>com.apple.developer.ubiquity-kvstore-identifier</key>
<string>$(TeamIdentifierPrefix)$(CFBundleIdentifier)</string>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)com.jc.tebg</string>

View File

@ -165,7 +165,8 @@ function createAccount(funId) {
*/
function importAccount(funId, privateKey) {
console.log('importAccount: ' + funId);
jsb.scanQRCode(funId, '111');
jsb.restoreKey(funId, '1111');
// jsb.scanQRCode(funId, '111');
// jsb.showQRCode('00123', '0x12312312313123123123', 'CEBG RECOVERY KEY', '0x1231231231321231');
// try {
// let address = jc.wallet.importAccount(privateKey);