diff --git a/Classes_cocos/JcWallet.mm b/Classes_cocos/JcWallet.mm index 744a769..5f5b4f6 100644 --- a/Classes_cocos/JcWallet.mm +++ b/Classes_cocos/JcWallet.mm @@ -242,10 +242,46 @@ bool jsb_scanQRCode(se::State& s) { } SE_BIND_FUNC(jsb_scanQRCode) +bool jsb_signWithGoogle(se::State& s) { + const auto& args = s.args(); + size_t argc = args.size(); + if (argc >= 1) { + bool ok; + std::string funid; + ok = seval_to_std_string(args[0], &funid); + SE_PRECONDITION2(ok, false, "Error processing arguments"); + NSString *nfunid = [NSString stringWithCString:funid.c_str() encoding:NSUTF8StringEncoding]; + UIWindow* window = [[[UIApplication sharedApplication] delegate] window]; + [window.rootViewController signWithGoogle:nfunid]; + return true; + } + return false; +} +SE_BIND_FUNC(jsb_signWithGoogle) + +bool jsb_signOutGoogle(se::State& s) { + const auto& args = s.args(); + size_t argc = args.size(); + if (argc >= 1) { + bool ok; + std::string funid; + ok = seval_to_std_string(args[0], &funid); + SE_PRECONDITION2(ok, false, "Error processing arguments"); + NSString *nfunid = [NSString stringWithCString:funid.c_str() encoding:NSUTF8StringEncoding]; + UIWindow* window = [[[UIApplication sharedApplication] delegate] window]; + [window.rootViewController signOutGoogle:nfunid]; + return true; + } + return false; +} +SE_BIND_FUNC(jsb_signOutGoogle) + bool jsb_register_walletevent_modules(se::Object* global) { getOrCreatePlainObject_r("jsb", global, &__jsbObj); __jsbObj->defineFunction("jcCallback", _SE(jsb_wallet_callback)); __jsbObj->defineFunction("scanQRCode", _SE(jsb_scanQRCode)); + __jsbObj->defineFunction("signWithGoogle", _SE(jsb_signWithGoogle)); + __jsbObj->defineFunction("signOutGoogle", _SE(jsb_signOutGoogle)); return true; } diff --git a/Classes_cocos/UIViewController+Wallet.h b/Classes_cocos/UIViewController+Wallet.h index 002a763..0e64ba9 100644 --- a/Classes_cocos/UIViewController+Wallet.h +++ b/Classes_cocos/UIViewController+Wallet.h @@ -14,5 +14,6 @@ +(void)toWallet:(NSString *)url; -(void)scanQRCode:(NSString *)funid title:(NSString *) title; - +-(void)signWithGoogle:(NSString *)funid; +-(void)signOutGoogle:(NSString *)funid; @end diff --git a/Classes_cocos/UIViewController+Wallet.mm b/Classes_cocos/UIViewController+Wallet.mm index 8a7252e..af9b2a5 100644 --- a/Classes_cocos/UIViewController+Wallet.mm +++ b/Classes_cocos/UIViewController+Wallet.mm @@ -11,8 +11,11 @@ #import "QRCodeReaderDelegate.h" #include #include "WalletEvent.h" +#import +@import GoogleSignIn; - +static NSString * const kClientID = +@"165555585193-alshovj5m91vlmj8uuhb11e6msvq32gm.apps.googleusercontent.com"; @implementation UIViewController (Wallet) @@ -52,36 +55,102 @@ }]; [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]; - }); + } + 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()); - } + std::string sresult = "{errcode: 1, errmsg: 'no camera permission'}"; + WalletEvent::Emit(sfunid.c_str(), sresult.c_str()); + } +} + +-(void)signToGoogle { + GIDConfiguration *_configuration = [[GIDConfiguration alloc] initWithClientID:kClientID]; + [GIDSignIn.sharedInstance signInWithConfiguration:_configuration + presentingViewController:self + completion:^(GIDGoogleUser *user, NSError *error) { + if (error) { + NSLog(@"Status: Authentication error: %@", error); + } + [self refreshUserInfo]; + [self refreshTokenID: user]; + }]; +} +-(void) refreshTokenID:(GIDGoogleUser *)user { + [user.authentication doWithFreshTokens:^(GIDAuthentication * _Nullable authentication, + NSError * _Nullable error) { + if (error) { return; } + if (authentication == nil) { return; } + + NSString *idToken = authentication.idToken; + // Send ID token to backend (example below). + NSLog(@"idToken: %@", idToken); + }]; +} + +-(void)signWithGoogle:(NSString *)funid { + [GIDSignIn.sharedInstance restorePreviousSignInWithCompletion:^(GIDGoogleUser * _Nullable user, + NSError * _Nullable error) { + if (error) { + // Show the app's signed-out state. + [self signToGoogle]; + } else { + // Show the app's signed-in state. + [self refreshTokenID: user]; + } + }]; + +} + +-(void)signOutGoogle:(NSString *)funid { + [GIDSignIn.sharedInstance signOut]; +} + +- (void)reportAuthStatus { + GIDGoogleUser *googleUser = [GIDSignIn.sharedInstance currentUser]; + if (googleUser.authentication) { + NSLog(@"Status: Authenticated"); + } else { + // To authenticate, use Google Sign-In button. + NSLog(@"Status: Not authenticated"); + } + + [self refreshUserInfo]; +} + +- (void)refreshUserInfo { + if (GIDSignIn.sharedInstance.currentUser.authentication == nil) { + return; + } + NSLog(@"email: %@", GIDSignIn.sharedInstance.currentUser.profile.email); + NSLog(@"username: %@", GIDSignIn.sharedInstance.currentUser.profile.name); + NSLog(@"userid: %@", GIDSignIn.sharedInstance.currentUser.userID); + NSLog(@"givenName: %@", GIDSignIn.sharedInstance.currentUser.profile.givenName); + NSLog(@"familyName: %@", GIDSignIn.sharedInstance.currentUser.profile.familyName); + NSLog(@"hostedDomain: %@", GIDSignIn.sharedInstance.currentUser.hostedDomain); } diff --git a/Info.plist b/Info.plist index b793bcc..901431e 100644 --- a/Info.plist +++ b/Info.plist @@ -2,10 +2,6 @@ - NSCameraUsageDescription - The camera is need to scan QR codes - UIApplicationExitsOnSuspend - CADisableMinimumFrameDuration CFBundleDevelopmentRegion @@ -24,6 +20,17 @@ APPL CFBundleShortVersionString 0.1 + CFBundleURLTypes + + + CFBundleTypeRole + Editor + CFBundleURLSchemes + + com.googleusercontent.apps.165555585193-alshovj5m91vlmj8uuhb11e6msvq32gm + + + CFBundleVersion 0 LSRequiresIPhoneOS @@ -33,6 +40,10 @@ NSAllowsArbitraryLoads + NSCameraUsageDescription + The camera is need to scan QR codes + UIApplicationExitsOnSuspend + UILaunchStoryboardName~ipad LaunchScreen-iPad UILaunchStoryboardName~iphone diff --git a/Podfile b/Podfile new file mode 100644 index 0000000..ea7b6fe --- /dev/null +++ b/Podfile @@ -0,0 +1,6 @@ +platform :ios, '9.0' +use_frameworks! + +target 'Unity-iPhone' do + pod 'GoogleSignIn', :path => '/Users/zhl/Downloads/sourcecode/ios/GoogleSignIn-iOS/' +end diff --git a/Unity-iPhone.xcodeproj/project.pbxproj b/Unity-iPhone.xcodeproj/project.pbxproj index e321f52..bf4d7db 100644 --- a/Unity-iPhone.xcodeproj/project.pbxproj +++ b/Unity-iPhone.xcodeproj/project.pbxproj @@ -9,6 +9,7 @@ /* Begin PBXBuildFile section */ 00000000008063A1000160D3 /* libiPhone-lib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D8A1C72A0E8063A1000160D3 /* libiPhone-lib.a */; }; 03F528631B447098000F4FB8 /* Il2CppOptions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 03F528621B447098000F4FB8 /* Il2CppOptions.cpp */; }; + 11D10E290B9C7BABBF144797 /* Pods_Unity_iPhone.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B0207025791C682891488AD /* Pods_Unity_iPhone.framework */; }; 1859EA9B19214E7B0022C3D3 /* MetalHelper.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1859EA9A19214E7B0022C3D3 /* MetalHelper.mm */; }; 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 35DD4E0BA71A8E4480E79156 /* LaunchScreen-iPhonePortrait.png in Resources */ = {isa = PBXBuildFile; fileRef = A03A47E096662C4BAF1D598F /* LaunchScreen-iPhonePortrait.png */; }; @@ -242,6 +243,7 @@ 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 1D6058910D05DD3D006BFB54 /* ProductName.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ProductName.app; sourceTree = BUILT_PRODUCTS_DIR; }; 4A5A4C7E840E8BFA450026D8 /* IUnityGraphics.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = IUnityGraphics.h; path = Classes/Unity/IUnityGraphics.h; sourceTree = SOURCE_ROOT; }; + 4B0207025791C682891488AD /* Pods_Unity_iPhone.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Unity_iPhone.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 4C5D493DAA759EC62F5C506E /* LaunchScreen-iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "LaunchScreen-iPhone.xib"; sourceTree = SOURCE_ROOT; }; 4E090A331F27884B0077B28D /* StoreReview.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StoreReview.m; sourceTree = ""; }; 5623C57317FDCB0800090B9E /* Unity-iPhone Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; name = "Unity-iPhone Tests.xctest"; path = ProductName.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -260,6 +262,7 @@ 5BAA49C5B6C1A0380C7D1843 /* IUnityGraphicsMetal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = IUnityGraphicsMetal.h; path = Classes/Unity/IUnityGraphicsMetal.h; sourceTree = SOURCE_ROOT; }; 5BAD78601F2B5A59006103DE /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; 5C824C7597221AFF9649D008 /* LaunchScreen-iPad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "LaunchScreen-iPad.png"; sourceTree = SOURCE_ROOT; }; + 64D951E2E197936FF46DBB4A /* Pods-Unity-iPhone.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Unity-iPhone.debug.xcconfig"; path = "Target Support Files/Pods-Unity-iPhone/Pods-Unity-iPhone.debug.xcconfig"; sourceTree = ""; }; 65204119BF754354B5DD4D0C /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; }; 7F36C10E13C5C673007FBDD9 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; 7F36C10F13C5C673007FBDD9 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; @@ -353,6 +356,7 @@ AAC3E38C1A68945900F6174A /* RegisterFeatures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegisterFeatures.h; sourceTree = ""; }; AAFE69D019F187C200638316 /* UnityViewControllerListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnityViewControllerListener.h; sourceTree = ""; }; AAFE69D119F187C200638316 /* UnityViewControllerListener.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UnityViewControllerListener.mm; sourceTree = ""; }; + B41A4D99DD320B1E06F51AE6 /* Pods-Unity-iPhone.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Unity-iPhone.release.xcconfig"; path = "Target Support Files/Pods-Unity-iPhone/Pods-Unity-iPhone.release.xcconfig"; sourceTree = ""; }; C6CC4EECB3BBA57C6F9A8015 /* IUnityInterface.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = IUnityInterface.h; path = Classes/Unity/IUnityInterface.h; sourceTree = SOURCE_ROOT; }; D52A8D9F288E6547006574E8 /* libuv_a.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libuv_a.a; sourceTree = ""; }; D5538BA3287E9908000BDFB6 /* WalletEvent.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WalletEvent.cpp; sourceTree = ""; }; @@ -492,10 +496,12 @@ D8A1C7240E80637F000160D3 /* RegisterMonoModules.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegisterMonoModules.cpp; path = Libraries/RegisterMonoModules.cpp; sourceTree = SOURCE_ROOT; }; D8A1C7250E80637F000160D3 /* RegisterMonoModules.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegisterMonoModules.h; path = Libraries/RegisterMonoModules.h; sourceTree = SOURCE_ROOT; }; D8A1C72A0E8063A1000160D3 /* libiPhone-lib.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libiPhone-lib.a"; path = "Libraries/libiPhone-lib.a"; sourceTree = SOURCE_ROOT; }; + DF09136C644F6C0DE6044DC4 /* Pods-Unity-iPhone.releaseforrunning.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Unity-iPhone.releaseforrunning.xcconfig"; path = "Target Support Files/Pods-Unity-iPhone/Pods-Unity-iPhone.releaseforrunning.xcconfig"; sourceTree = ""; }; FC0B20A11B7A4F0B00FDFC55 /* OnDemandResources.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OnDemandResources.mm; sourceTree = ""; }; FC3D7EBE16D2621600D1BD0D /* CrashReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CrashReporter.h; sourceTree = ""; }; FC85CCB916C3ED8000BAF7C7 /* CrashReporter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CrashReporter.mm; sourceTree = ""; }; FC85CCBA16C3ED8000BAF7C7 /* PLCrashReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PLCrashReporter.h; sourceTree = ""; }; + FD1C45EFD70F96442D46270D /* Pods-Unity-iPhone.releaseforprofiling.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Unity-iPhone.releaseforprofiling.xcconfig"; path = "Target Support Files/Pods-Unity-iPhone/Pods-Unity-iPhone.releaseforprofiling.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -530,6 +536,7 @@ D0DD4D8D8AC82F06A4331428 /* libil2cpp.a in Frameworks */, E9D340DABD2259166E8A82AF /* Metal.framework in Frameworks */, D5F2D102287C092D003C2B62 /* libcocos2d.a in Frameworks */, + 11D10E290B9C7BABBF144797 /* Pods_Unity_iPhone.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -576,6 +583,7 @@ 910F4CC7BAC9F179C0C2F5D1 /* LaunchScreen-iPhoneLandscape.png */, 90994FBFA981DC89AB1ADF90 /* LaunchScreen-iPad.xib */, 5C824C7597221AFF9649D008 /* LaunchScreen-iPad.png */, + B874123C858A9B88D7B58415 /* Pods */, ); name = CustomTemplate; sourceTree = ""; @@ -606,6 +614,7 @@ 56BCBA380FCF049A0030C3B2 /* SystemConfiguration.framework */, 830B5C100E5ED4C100C7819F /* UIKit.framework */, 65204119BF754354B5DD4D0C /* Metal.framework */, + 4B0207025791C682891488AD /* Pods_Unity_iPhone.framework */, ); name = Frameworks; sourceTree = ""; @@ -727,6 +736,17 @@ name = UnityAds; sourceTree = ""; }; + B874123C858A9B88D7B58415 /* Pods */ = { + isa = PBXGroup; + children = ( + B41A4D99DD320B1E06F51AE6 /* Pods-Unity-iPhone.release.xcconfig */, + FD1C45EFD70F96442D46270D /* Pods-Unity-iPhone.releaseforprofiling.xcconfig */, + DF09136C644F6C0DE6044DC4 /* Pods-Unity-iPhone.releaseforrunning.xcconfig */, + 64D951E2E197936FF46DBB4A /* Pods-Unity-iPhone.debug.xcconfig */, + ); + path = Pods; + sourceTree = ""; + }; D5AB1D2728BF782200AA6AFA /* QRCodeReaderViewController */ = { isa = PBXGroup; children = ( @@ -931,11 +951,13 @@ isa = PBXNativeTarget; buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "Unity-iPhone" */; buildPhases = ( + 6CEA41FA163B3F3677EADF3F /* [CP] Check Pods Manifest.lock */, 1D60588D0D05DD3D006BFB54 /* Resources */, 83D0C1FD0E6C8D7700EBCE5D /* CopyFiles */, 1D60588E0D05DD3D006BFB54 /* Sources */, 1D60588F0D05DD3D006BFB54 /* Frameworks */, 033966F41B18B03000ECD701 /* ShellScript */, + 3019DFB992AFEEDC432FD501 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -972,7 +994,7 @@ attributes = { TargetAttributes = { 1D6058900D05DD3D006BFB54 = { - DevelopmentTeam = 8TB4N4YTJ3; + DevelopmentTeam = 3M965CAG25; ProvisioningStyle = Automatic; SystemCapabilities = { com.apple.GameControllers.appletvos = { @@ -998,6 +1020,7 @@ en, ); mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; + productRefGroup = 19C28FACFE9D520D11CA2CBB /* Products */; projectDirPath = ""; projectReferences = ( { @@ -1064,6 +1087,52 @@ shellPath = /bin/sh; shellScript = "\"$PROJECT_DIR/MapFileParser.sh\""; }; + 3019DFB992AFEEDC432FD501 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Unity-iPhone/Pods-Unity-iPhone-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/AppAuth/AppAuth.framework", + "${BUILT_PRODUCTS_DIR}/GTMAppAuth/GTMAppAuth.framework", + "${BUILT_PRODUCTS_DIR}/GTMSessionFetcher/GTMSessionFetcher.framework", + "${BUILT_PRODUCTS_DIR}/GoogleSignIn/GoogleSignIn.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AppAuth.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GTMAppAuth.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GTMSessionFetcher.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleSignIn.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Unity-iPhone/Pods-Unity-iPhone-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + 6CEA41FA163B3F3677EADF3F /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Unity-iPhone-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -1264,6 +1333,7 @@ /* Begin XCBuildConfiguration section */ 1D6058940D05DD3E006BFB54 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 64D951E2E197936FF46DBB4A /* Pods-Unity-iPhone.debug.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = ( @@ -1274,13 +1344,14 @@ ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = NO; - DEVELOPMENT_TEAM = 8TB4N4YTJ3; + DEVELOPMENT_TEAM = 3M965CAG25; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_DYNAMIC_NO_PIC = NO; @@ -1321,6 +1392,8 @@ OTHER_CPLUSPLUSFLAGS = ( "$(inherited)", "$(OTHER_CFLAGS)", + "-fmodules", + "-fcxx-modules", ); OTHER_LDFLAGS = ( "$(inherited)", @@ -1349,6 +1422,7 @@ }; 1D6058950D05DD3E006BFB54 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = B41A4D99DD320B1E06F51AE6 /* Pods-Unity-iPhone.release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = ( @@ -1359,13 +1433,14 @@ ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = YES; - DEVELOPMENT_TEAM = 8TB4N4YTJ3; + DEVELOPMENT_TEAM = 3M965CAG25; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_ENABLE_CPP_EXCEPTIONS = YES; @@ -1403,6 +1478,8 @@ OTHER_CPLUSPLUSFLAGS = ( "$(inherited)", "$(OTHER_CFLAGS)", + "-fmodules", + "-fcxx-modules", ); OTHER_LDFLAGS = ( "$(inherited)", @@ -1560,6 +1637,7 @@ }; 56E860811D6757FF00A1AB2B /* ReleaseForRunning */ = { isa = XCBuildConfiguration; + baseConfigurationReference = DF09136C644F6C0DE6044DC4 /* Pods-Unity-iPhone.releaseforrunning.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = ( @@ -1570,6 +1648,7 @@ ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CODE_SIGN_IDENTITY = "Apple Development"; @@ -1577,7 +1656,7 @@ CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = dwarf; - DEVELOPMENT_TEAM = 8TB4N4YTJ3; + DEVELOPMENT_TEAM = 3M965CAG25; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_ENABLE_CPP_EXCEPTIONS = YES; @@ -1615,6 +1694,8 @@ OTHER_CPLUSPLUSFLAGS = ( "$(inherited)", "$(OTHER_CFLAGS)", + "-fmodules", + "-fcxx-modules", ); OTHER_LDFLAGS = ( "$(inherited)", @@ -1715,6 +1796,7 @@ }; 56E860841D67581C00A1AB2B /* ReleaseForProfiling */ = { isa = XCBuildConfiguration; + baseConfigurationReference = FD1C45EFD70F96442D46270D /* Pods-Unity-iPhone.releaseforprofiling.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = ( @@ -1725,13 +1807,14 @@ ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CODE_SIGN_IDENTITY = "Apple Development"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; COPY_PHASE_STRIP = YES; - DEVELOPMENT_TEAM = 8TB4N4YTJ3; + DEVELOPMENT_TEAM = 3M965CAG25; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; GCC_ENABLE_CPP_EXCEPTIONS = YES; @@ -1769,6 +1852,8 @@ OTHER_CPLUSPLUSFLAGS = ( "$(inherited)", "$(OTHER_CFLAGS)", + "-fmodules", + "-fcxx-modules", ); OTHER_LDFLAGS = ( "$(inherited)", diff --git a/Unity-iPhone.xcworkspace/contents.xcworkspacedata b/Unity-iPhone.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..41e9af4 --- /dev/null +++ b/Unity-iPhone.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/Unity-iPhone.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Unity-iPhone.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Unity-iPhone.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Unity-iPhone.xcworkspace/xcuserdata/zhl.xcuserdatad/UserInterfaceState.xcuserstate b/Unity-iPhone.xcworkspace/xcuserdata/zhl.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..fd35494 Binary files /dev/null and b/Unity-iPhone.xcworkspace/xcuserdata/zhl.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/js/main.js b/js/main.js index 9a336e0..0bbeb2f 100644 --- a/js/main.js +++ b/js/main.js @@ -240,3 +240,20 @@ function scanQRCode(funId, title) { } } +function signWithGoogle(funId) { + try { + jsb.signWithGoogle(funId); + } catch(err) { + return JSON.stringify({errcode: 1, errmsg: err}); + } +} + +function signOutGoogle(funId) { + try { + jsb.signOutGoogle(funId); + return JSON.stringify({errcode: 0, data: 'success'}); + } catch(err) { + return JSON.stringify({errcode: 1, errmsg: err}); + } +} +