diff --git a/Classes_cocos/JcWallet.mm b/Classes_cocos/JcWallet.mm index 7d55c44..d1cd760 100644 --- a/Classes_cocos/JcWallet.mm +++ b/Classes_cocos/JcWallet.mm @@ -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) diff --git a/Classes_cocos/UIViewController+QR.h b/Classes_cocos/UIViewController+QR.h new file mode 100644 index 0000000..4603f9d --- /dev/null +++ b/Classes_cocos/UIViewController+QR.h @@ -0,0 +1,18 @@ +// +// UIViewController+QR.h +// Unity-iPhone +// +// Created by zhl on 2022/11/28. +// + +#import + +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 diff --git a/Classes_cocos/UIViewController+QR.mm b/Classes_cocos/UIViewController+QR.mm new file mode 100644 index 0000000..b147bef --- /dev/null +++ b/Classes_cocos/UIViewController+QR.mm @@ -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 + +@interface UIViewController (QR) +@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 *array) { + [weakSelf scanResultWithArray:array]; + }]; + }else{ + NSLog(@"native低于ios8.0不支持识别图片"); + } +} + +- (void)scanResultWithArray:(NSArray*)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 diff --git a/Classes_cocos/UIViewController+Wallet.h b/Classes_cocos/UIViewController+Wallet.h index b42214a..23665d6 100644 --- a/Classes_cocos/UIViewController+Wallet.h +++ b/Classes_cocos/UIViewController+Wallet.h @@ -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; diff --git a/Classes_cocos/UIViewController+Wallet.mm b/Classes_cocos/UIViewController+Wallet.mm index 0f1e631..357c61c 100644 --- a/Classes_cocos/UIViewController+Wallet.mm +++ b/Classes_cocos/UIViewController+Wallet.mm @@ -6,26 +6,20 @@ // #import "UIViewController+Wallet.h" -#import "QRCodeReaderViewController.h" -#import "QRCodeReader.h" -#import "QRCodeReaderDelegate.h" + #include #include "WalletEvent.h" #include "JcWallet.h" #import #include "KeyChain/DataManager.h" -#include "permission/LBXPermission.h" -#include "permission/LBXPermissionSetting.h" -#include "LBXScanNative.h" -#include "LBXScanTypes.h" -#include "QrCodeViewController.h" +#import @import GoogleSignIn; static NSString * const kClientID = @"53206975661-0d6q9pqljn84n9l63gm0to1ulap9cbk4.apps.googleusercontent.com"; -@interface UIViewController (Wallet) +@interface UIViewController (Wallet) @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,71 +42,7 @@ 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]; @@ -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 *array) { - [weakSelf scanResultWithArray:array]; - }]; - }else{ - NSLog(@"native低于ios8.0不支持识别图片"); +#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(@"system is lower"); } } -- (void)scanResultWithArray:(NSArray*)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); - } - - if (!array[0].strScanned || [array[0].strScanned isEqualToString:@""] ) { - NSLog(@"识别失败了"); - return; - } - LBXScanResult *scanResult = array[0]; - } + +#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; + } +} + + + + + @end diff --git a/Unity-iPhone.xcodeproj/project.pbxproj b/Unity-iPhone.xcodeproj/project.pbxproj index 567ed78..184a14c 100644 --- a/Unity-iPhone.xcodeproj/project.pbxproj +++ b/Unity-iPhone.xcodeproj/project.pbxproj @@ -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 = ""; }; D56436442930ABAB00E2B633 /* UIUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UIUtils.h; sourceTree = ""; }; D56436452930ABAB00E2B633 /* UIUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UIUtils.m; sourceTree = ""; }; + 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 = ""; }; D579209E292F3C94004DBD4F /* LBXScanNative.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LBXScanNative.m; sourceTree = ""; }; D57920A0292F3D28004DBD4F /* LBXScanTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LBXScanTypes.h; sourceTree = ""; }; @@ -413,6 +416,8 @@ D5AB1D3228BF782300AA6AFA /* QRCodeReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QRCodeReader.m; sourceTree = ""; }; D5AB1D4128C0539600AA6AFA /* UIViewController+Wallet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIViewController+Wallet.h"; sourceTree = ""; }; D5AB1D4228C0539600AA6AFA /* UIViewController+Wallet.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = "UIViewController+Wallet.mm"; sourceTree = ""; }; + D5D9BAF7293477E700F18A7F /* UIViewController+QR.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIViewController+QR.h"; sourceTree = ""; }; + D5D9BAF8293477E700F18A7F /* UIViewController+QR.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = "UIViewController+QR.mm"; sourceTree = ""; }; D5F2CED5287BE9C4003C2B62 /* Data */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Data; path = /Users/zhl/Documents/workspace/unity/first/first/target/ios/Data; sourceTree = ""; }; D5F2CED8287BEC0D003C2B62 /* Bulk_Generics_3.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Bulk_Generics_3.cpp; sourceTree = ""; }; D5F2CED9287BEC0D003C2B62 /* Il2CppMethodPointerTable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Il2CppMethodPointerTable.cpp; sourceTree = ""; }; @@ -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)", diff --git a/Unity-iPhone.xcworkspace/xcuserdata/zhl.xcuserdatad/UserInterfaceState.xcuserstate b/Unity-iPhone.xcworkspace/xcuserdata/zhl.xcuserdatad/UserInterfaceState.xcuserstate index 2d2b469..b6540c2 100644 Binary files a/Unity-iPhone.xcworkspace/xcuserdata/zhl.xcuserdatad/UserInterfaceState.xcuserstate and b/Unity-iPhone.xcworkspace/xcuserdata/zhl.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/Unity-iPhone.xcworkspace/xcuserdata/zhl.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Unity-iPhone.xcworkspace/xcuserdata/zhl.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 3db1f8d..e29978b 100644 --- a/Unity-iPhone.xcworkspace/xcuserdata/zhl.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/Unity-iPhone.xcworkspace/xcuserdata/zhl.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -4,86 +4,6 @@ type = "0" version = "2.0"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -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"> @@ -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"> + + + + diff --git a/Unity-iPhone/Unity-iPhone.entitlements b/Unity-iPhone/Unity-iPhone.entitlements index d41b41f..2dbc472 100644 --- a/Unity-iPhone/Unity-iPhone.entitlements +++ b/Unity-iPhone/Unity-iPhone.entitlements @@ -8,21 +8,6 @@ Default - com.apple.developer.icloud-container-identifiers - - iCloud.com.jc.tebg - - com.apple.developer.icloud-services - - CloudDocuments - CloudKit - - com.apple.developer.ubiquity-container-identifiers - - iCloud.com.jc.tebg - - com.apple.developer.ubiquity-kvstore-identifier - $(TeamIdentifierPrefix)$(CFBundleIdentifier) keychain-access-groups $(AppIdentifierPrefix)com.jc.tebg diff --git a/js/main.js b/js/main.js index cf4ea76..596d078 100644 --- a/js/main.js +++ b/js/main.js @@ -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);