diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 4f75b791..b495038f 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -57,7 +57,7 @@ jobs: VALIDATE_ALL_CODEBASE: true DEFAULT_BRANCH: main GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - FILTER_REGEX_EXCLUDE: (.*src/Packages/Passport/Runtime/ThirdParty/.*|.*src/Packages/Passport/Runtime/Resources/.*|.*Plugins/.*|.*src/Packages/Passport/Runtime/Assets/ImmutableAndroid.androidlib/.*) + FILTER_REGEX_EXCLUDE: (.*src/Packages/Passport/Runtime/ThirdParty/.*|.*src/Packages/Passport/Runtime/Resources/.*|.*Plugins/.*|.*src/Packages/Passport/Runtime/Assets/ImmutableAndroid.androidlib/.*|.*src/Packages/Orderbook|.*sample|.*src/Packages/Passport/WebGLTemplates~) VALIDATE_MARKDOWN: false VALIDATE_GITLEAKS: false VALIDATE_JSCPD: false diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 40728c78..56991855 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,13 +25,13 @@ jobs: projectPath: './sample' githubToken: ${{ secrets.GITHUB_TOKEN }} testMode: 'EditMode' - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 if: always() with: name: Test results path: ${{ steps.passportTest.outputs.artifactsPath }} - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 if: always() with: name: Coverage results diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index e5e932a0..6f48d0d7 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -1,12 +1,21 @@ --- -name: "Update version in package.json" +name: "Update SDK version" on: workflow_dispatch: inputs: - version: - description: 'Version to update to (e.g. 1.20.0)' + upgrade_type: + type: choice + description: Upgrade Type + options: + - patch + - minor + # - major required: true + default: patch + +env: + UPGRADE_TYPE: ${{ github.event.inputs.upgrade_type || 'patch' }} jobs: update: @@ -37,19 +46,53 @@ jobs: - name: Install jq run: sudo apt-get install -y jq - - name: Replace version string + - name: Update Version in package.json id: replace_version run: | - FILE=./src/Packages/Passport/package.json - VERSION=${{ github.event.inputs.version }} - jq --arg version "$VERSION" '.version = $version' $FILE > tmp.$$.json && mv tmp.$$.json $FILE + PASSPORT_FILE=./src/Packages/Passport/package.json + MARKETPLACE_FILE=./src/Packages/Marketplace/package.json + + CURRENT_VERSION=$(jq -r '.version' $PASSPORT_FILE) + IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION" + + # Increment version based on UPGRADE_TYPE + case "$UPGRADE_TYPE" in + major) + MAJOR=$((MAJOR + 1)) + MINOR=0 + PATCH=0 + ;; + minor) + MINOR=$((MINOR + 1)) + PATCH=0 + ;; + patch) + PATCH=$((PATCH + 1)) + ;; + *) + echo "Invalid upgrade type: $UPGRADE_TYPE" + exit 1 + ;; + esac + + NEW_VERSION="$MAJOR.$MINOR.$PATCH" + + # Update Passport package.json + jq --arg version "$NEW_VERSION" '.version = $version' $PASSPORT_FILE > tmp.$$.json && mv tmp.$$.json $PASSPORT_FILE + echo "Updated version in Passport package.json from $CURRENT_VERSION to $NEW_VERSION" + + # Update Marketplace package.json + jq --arg version "$NEW_VERSION" '.version = $version' $MARKETPLACE_FILE > tmp.$$.json && mv tmp.$$.json $MARKETPLACE_FILE + echo "Updated version in Marketplace package.json from $CURRENT_VERSION to $NEW_VERSION" + echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT" - - name: Replace engine sdk version string + - name: Update SDK Version in SdkVersionInfoHelpers.cs id: replace_engine_sdk_version run: | FILE=./src/Packages/Passport/Runtime/Scripts/Private/Helpers/SdkVersionInfoHelpers.cs - VERSION=${{ github.event.inputs.version }} - sed -i -E "s/[0-9]+\.[0-9]+\.[0-9]+/$VERSION/g" $FILE + NEW_VERSION="${{ steps.replace_version.outputs.version }}" + sed -i -E "s/[0-9]+\.[0-9]+\.[0-9]+/$NEW_VERSION/g" $FILE + echo "Updated SDK version in SdkVersionInfoHelpers.cs to $NEW_VERSION" - uses: gr2m/create-or-update-pull-request-action@v1 env: @@ -57,6 +100,6 @@ jobs: with: title: "chore: update version" body: "Update version in package.json" - branch: "chore/update-version-${{ github.event.inputs.version }}" + branch: "chore/update-version-${{ steps.replace_version.outputs.version }}" commit-message: "chore: update version" labels: release diff --git a/.gitignore b/.gitignore index 62c972de..9bd49653 100644 --- a/.gitignore +++ b/.gitignore @@ -81,6 +81,7 @@ crashlytics-build.properties sample-passport-unity-game/ sample/iosBuild +!/sample/webgl/Build/ # Android src/Packages/Passport/Runtime/Assets/ImmutableAndroid.androidlib/**/*.meta diff --git a/Plugins/Mac/Sources/WebView.mm b/Plugins/Mac/Sources/WebView.mm deleted file mode 100644 index 300168a7..00000000 --- a/Plugins/Mac/Sources/WebView.mm +++ /dev/null @@ -1,428 +0,0 @@ -/* - * Copyright (C) 2011 Keijiro Takahashi - * Copyright (C) 2012 GREE, Inc. - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - */ - -#import -#import -#import - -extern "C" typedef void (*DelegateCallbackFunction)(const char * key, const char * message); - -DelegateCallbackFunction delegateCallback = NULL; - -// cf. https://stackoverflow.com/questions/26383031/wkwebview-causes-my-view-controller-to-leak/33365424#33365424 -@interface WeakScriptMessageDelegate : NSObject - -@property (nonatomic, weak) id scriptDelegate; - -- (instancetype)initWithDelegate:(id)scriptDelegate; - -@end - -@implementation WeakScriptMessageDelegate - -- (instancetype)initWithDelegate:(id)scriptDelegate -{ - self = [super init]; - if (self) { - _scriptDelegate = scriptDelegate; - } - return self; -} - -- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message -{ - [self.scriptDelegate userContentController:userContentController didReceiveScriptMessage:message]; -} - -@end - -@protocol WebViewProtocol -@property (nullable, nonatomic, weak) id navigationDelegate; -@property (nullable, nonatomic, weak) id UIDelegate; -@property (nullable, nonatomic, readonly, copy) NSURL *URL; -- (void)stopLoading; -- (void)load:(NSURLRequest *)request; -- (void)evaluateJavaScript:(NSString *)javaScriptString completionHandler:(void (^ __nullable)(__nullable id, NSError * __nullable error))completionHandler; -@end - -@interface WKWebView(WebViewProtocolConformed) -@end - -@implementation WKWebView(WebViewProtocolConformed) - -- (void)load:(NSURLRequest *)request -{ - WKWebView *webView = (WKWebView *)self; - NSURL *url = [request URL]; - if ([url.absoluteString hasPrefix:@"file:"]) { - NSString *htmlContent = [NSString stringWithContentsOfFile:url.path encoding:NSUTF8StringEncoding error:nil]; - [webView loadHTMLString:htmlContent baseURL:url]; - } else { - [webView loadRequest:request]; - } -} -@end - -@interface CWebViewPlugin : NSObject -{ - WKWebView *webView; -} -@end - -@implementation CWebViewPlugin - -static WKProcessPool *_sharedProcessPool; -static NSMutableArray *_instances = [[NSMutableArray alloc] init]; -static CWebViewPlugin *__delegate = nil; -static ASWebAuthenticationSession *_authSession; - -- (id)initWithUa:(const char *)ua -{ - self = [super init]; - - CGRect frame = CGRectMake(0, 0, 500, 400); - - if (_sharedProcessPool == NULL) { - _sharedProcessPool = [[WKProcessPool alloc] init]; - } - - WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init]; - WKUserContentController *controller = [[WKUserContentController alloc] init]; - [controller addScriptMessageHandler:[[WeakScriptMessageDelegate alloc] initWithDelegate:self] name:@"unityControl"]; - [controller addScriptMessageHandler:[[WeakScriptMessageDelegate alloc] initWithDelegate:self] name:@"saveDataURL"]; - [controller addScriptMessageHandler:[[WeakScriptMessageDelegate alloc] initWithDelegate:self] name:@"logHandler"]; - NSString *str = @"\ - window.Unity = { \ - call: function(msg) { \ - window.webkit.messageHandlers.unityControl.postMessage(msg); \ - }, \ - saveDataURL: function(fileName, dataURL) { \ - window.webkit.messageHandlers.saveDataURL.postMessage(fileName + '\t' + dataURL); \ - } \ - }; \ - function captureLog(msg) { window.webkit.messageHandlers.logHandler.postMessage(msg); } window.console.log = captureLog; \ - "; - - WKUserScript *script - = [[WKUserScript alloc] initWithSource:str injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:YES]; - [controller addUserScript:script]; - configuration.userContentController = controller; - configuration.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone; - configuration.websiteDataStore = [WKWebsiteDataStore defaultDataStore]; - configuration.processPool = _sharedProcessPool; - - WKWebView *wkwebView = [[WKWebView alloc] initWithFrame:frame configuration:configuration]; -#if UNITYWEBVIEW_DEVELOPMENT - [[[webView configuration] preferences] setValue:@YES forKey:@"developerExtrasEnabled"]; - - // enable Safari debugging if exists - if ([wkwebView respondsToSelector:@selector(setInspectable:)]) { - [wkwebView performSelector:@selector(setInspectable:) withObject:@true]; - } -#endif - - webView = wkwebView; - webView.UIDelegate = self; - webView.navigationDelegate = self; - webView.hidden = YES; - - if (ua != NULL && strcmp(ua, "") != 0) { - ((WKWebView *)webView).customUserAgent = [[NSString alloc] initWithUTF8String:ua]; - } - - return self; -} - -- (void)dispose -{ - if (webView != nil) { - WKWebView *webView0 = webView; - webView = nil; - if ([webView0 isKindOfClass:[WKWebView class]]) { - webView0.UIDelegate = nil; - webView0.navigationDelegate = nil; - [((WKWebView *)webView0).configuration.userContentController removeScriptMessageHandlerForName:@"saveDataURL"]; - [((WKWebView *)webView0).configuration.userContentController removeScriptMessageHandlerForName:@"unityControl"]; - [((WKWebView *)webView0).configuration.userContentController removeScriptMessageHandlerForName:@"logHandler"]; - } - [webView0 stopLoading]; - [webView0 removeFromSuperview]; - } - delegateCallback = nil; -} - -+ (void)resetSharedProcessPool -{ - // cf. https://stackoverflow.com/questions/33156567/getting-all-cookies-from-wkwebview/49744695#49744695 - _sharedProcessPool = [[WKProcessPool alloc] init]; - [_instances enumerateObjectsUsingBlock:^(CWebViewPlugin *obj, NSUInteger idx, BOOL *stop) { - if ([obj->webView isKindOfClass:[WKWebView class]]) { - WKWebView *webView = (WKWebView *)obj->webView; - webView.configuration.processPool = _sharedProcessPool; - } - }]; -} - -- (void)userContentController:(WKUserContentController *)userContentController - didReceiveScriptMessage:(WKScriptMessage *)message -{ - if ([message.name isEqualToString:@"logHandler"]) { - [self sendUnityCallback:"CallOnLog" message:[[NSString stringWithFormat:@"%@", message.body] UTF8String]]; - } else if ([message.name isEqualToString:@"unityControl"]) { - [self sendUnityCallback:"CallFromJS" message:[[NSString stringWithFormat:@"%@", message.body] UTF8String]]; - } else if ([message.name isEqualToString:@"saveDataURL"]) { - NSRange range = [message.body rangeOfString:@"\t"]; - if (range.location == NSNotFound) { - return; - } - NSString *fileName = [[message.body substringWithRange:NSMakeRange(0, range.location)] lastPathComponent]; - NSString *dataURL = [message.body substringFromIndex:(range.location + 1)]; - range = [dataURL rangeOfString:@"data:"]; - if (range.location != 0) { - return; - } - NSString *tmp = [dataURL substringFromIndex:[@"data:" length]]; - range = [tmp rangeOfString:@";"]; - if (range.location == NSNotFound) { - return; - } - NSString *base64data = [tmp substringFromIndex:(range.location + 1 + [@"base64," length])]; - NSData *data = [[NSData alloc] initWithBase64EncodedString:base64data options:0]; - NSString *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0]; - path = [path stringByAppendingString:@"/Downloads"]; - BOOL isDir; - NSError *err = nil; - if ([[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDir]) { - if (!isDir) { - return; - } - } else { - [[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&err]; - if (err != nil) { - return; - } - } - NSString *prefix = [path stringByAppendingString:@"/"]; - path = [prefix stringByAppendingString:fileName]; - int count = 0; - while ([[NSFileManager defaultManager] fileExistsAtPath:path]) { - count++; - NSString *name = [fileName stringByDeletingPathExtension]; - NSString *ext = [fileName pathExtension]; - if (ext.length == 0) { - path = [NSString stringWithFormat:@"%@%@ (%d)", prefix, name, count]; - } else { - path = [NSString stringWithFormat:@"%@%@ (%d).%@", prefix, name, count, ext]; - } - } - [data writeToFile:path atomically:YES]; - } -} - -- (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView -{ - [self sendUnityCallback:"CallOnError" message:"webViewWebContentProcessDidTerminate"]; -} - -- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error -{ - [self sendUnityCallback:"CallOnError" message:[[error description] UTF8String]]; -} - -- (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error -{ - [self sendUnityCallback:"CallOnError" message:[[error description] UTF8String]]; -} - -- (WKWebView *)webView:(WKWebView *)wkWebView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures -{ - // cf. for target="_blank", cf. http://qiita.com/ShingoFukuyama/items/b3a1441025a36ab7659c - if (!navigationAction.targetFrame.isMainFrame) { - [wkWebView loadRequest:navigationAction.request]; - } - return nil; -} - -- (void)webView:(WKWebView *)wkWebView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler -{ - if (webView == nil) { - decisionHandler(WKNavigationActionPolicyCancel); - return; - } - NSURL *nsurl = [navigationAction.request URL]; - NSString *url = [nsurl absoluteString]; - - if ([url rangeOfString:@"//itunes.apple.com/"].location != NSNotFound) { - [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:url]]; - decisionHandler(WKNavigationActionPolicyCancel); - return; - } else if ([url hasPrefix:@"unity:"]) { - [self sendUnityCallback:"CallFromJS" message:[[url substringFromIndex:6] UTF8String]]; - decisionHandler(WKNavigationActionPolicyCancel); - return; - } else if (![url hasPrefix:@"about:blank"] // for loadHTML(), cf. #365 - && ![url hasPrefix:@"file:"] - && ![url hasPrefix:@"http:"] - && ![url hasPrefix:@"https:"]) { - - [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:url]]; - decisionHandler(WKNavigationActionPolicyCancel); - return; - } else if (navigationAction.navigationType == WKNavigationTypeLinkActivated - && (!navigationAction.targetFrame || !navigationAction.targetFrame.isMainFrame)) { - // cf. for target="_blank", cf. http://qiita.com/ShingoFukuyama/items/b3a1441025a36ab7659c - [webView load:navigationAction.request]; - decisionHandler(WKNavigationActionPolicyCancel); - return; - } - [self sendUnityCallback:"CallOnStarted" message:[url UTF8String]]; - decisionHandler(WKNavigationActionPolicyAllow); -} - -- (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler { - - if ([navigationResponse.response isKindOfClass:[NSHTTPURLResponse class]]) { - - NSHTTPURLResponse * response = (NSHTTPURLResponse *)navigationResponse.response; - if (response.statusCode >= 400) { - [self sendUnityCallback:"CallOnHttpError" message:[[NSString stringWithFormat:@"%ld", (long)response.statusCode] UTF8String]]; - } - - } - decisionHandler(WKNavigationResponsePolicyAllow); -} - -- (void)sendUnityCallback:(const char *)key message:(const char *)message { - if (delegateCallback != nil) { - delegateCallback(key, message); - } else { - NSLog(@"delegateCallback is nil, message not sent."); - } -} - -- (void)loadURL:(const char *)url -{ - if (webView == nil) - return; - - WKWebView *_webView = (WKWebView *)webView; - NSString *urlStr = [NSString stringWithUTF8String:url]; - NSURL *nsurl = [NSURL URLWithString:urlStr]; - NSURLRequest *request = [NSURLRequest requestWithURL:nsurl]; - [_webView load:request]; -} - -- (void)launchAuthURL:(const char *)url redirectUri:(const char *)redirectUri -{ - NSURL *URL = [[NSURL alloc] initWithString: [NSString stringWithUTF8String:url]]; - // Bundle identifier does not work like iOS, so using callback URL scheme - // from redirect URI instead - NSString *redirectUriString = [[NSString alloc] initWithUTF8String:redirectUri]; - NSString *callbackURLScheme = [[redirectUriString componentsSeparatedByString:@":"] objectAtIndex:0]; - - _authSession = [[ASWebAuthenticationSession alloc] initWithURL:URL callbackURLScheme:callbackURLScheme completionHandler:^(NSURL * _Nullable callbackURL, NSError * _Nullable error) { - _authSession = nil; - - if (error != nil && (error.code == 1 || error.code == ASWebAuthenticationSessionErrorCodeCanceledLogin)) { - // Cancelled - [self sendUnityCallback:"CallFromAuthCallbackError" message: ""]; - } else if (error != nil) { - [self sendUnityCallback:"CallFromAuthCallbackError" message:error.localizedDescription.UTF8String]; - } else { - [self sendUnityCallback:"CallFromAuthCallback" message: callbackURL.absoluteString.UTF8String]; - } - }]; - - _authSession.presentationContextProvider = self; - [_authSession start]; -} - -- (void)evaluateJS:(const char *)js -{ - if (webView == nil) - return; - NSString *jsStr = [NSString stringWithUTF8String:js]; - [webView evaluateJavaScript:jsStr completionHandler:^(NSString *result, NSError *error) {}]; -} - -- (nonnull ASPresentationAnchor)presentationAnchorForWebAuthenticationSession:(nonnull ASWebAuthenticationSession *)session { - if (webView.window != nil) { - return webView.window; - } - - return NSApplication.sharedApplication.windows.firstObject; -} - -@end - -extern "C" { -void *_CWebViewPlugin_Init(const char *ua); -void _CWebViewPlugin_Destroy(void *instance); -void _CWebViewPlugin_LoadURL(void *instance, const char *url); -void _CWebViewPlugin_EvaluateJS(void *instance, const char *url); -void _CWebViewPlugin_SetDelegate(DelegateCallbackFunction callback); -void _CWebViewPlugin_LaunchAuthURL(void *instance, const char *url, const char *redirectUri); -} - -void _CWebViewPlugin_SetDelegate(DelegateCallbackFunction callback) { - delegateCallback = callback; -} - -void *_CWebViewPlugin_Init(const char *ua) -{ - CWebViewPlugin *webViewPlugin = [[CWebViewPlugin alloc] initWithUa:ua]; - [_instances addObject:webViewPlugin]; - return (__bridge_retained void *)webViewPlugin; -} - -void _CWebViewPlugin_Destroy(void *instance) -{ - if (instance == NULL) - return; - CWebViewPlugin *webViewPlugin = (__bridge_transfer CWebViewPlugin *)instance; - [_instances removeObject:webViewPlugin]; - [webViewPlugin dispose]; - webViewPlugin = nil; -} - -void _CWebViewPlugin_LoadURL(void *instance, const char *url) -{ - if (instance == NULL) - return; - CWebViewPlugin *webViewPlugin = (__bridge CWebViewPlugin *)instance; - [webViewPlugin loadURL:url]; -} - -void _CWebViewPlugin_EvaluateJS(void *instance, const char *js) -{ - if (instance == NULL) - return; - CWebViewPlugin *webViewPlugin = (__bridge CWebViewPlugin *)instance; - [webViewPlugin evaluateJS:js]; -} - -void _CWebViewPlugin_LaunchAuthURL(void *instance, const char *url, const char *redirectUri) -{ - if (instance == NULL) - return; - CWebViewPlugin *webViewPlugin = (__bridge CWebViewPlugin *)instance; - [webViewPlugin launchAuthURL:url redirectUri: redirectUri]; -} diff --git a/Plugins/Mac/WebView.xcodeproj/project.pbxproj b/Plugins/Mac/WebView.xcodeproj/project.pbxproj deleted file mode 100644 index 62c5f4aa..00000000 --- a/Plugins/Mac/WebView.xcodeproj/project.pbxproj +++ /dev/null @@ -1,335 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 54; - objects = { - -/* Begin PBXBuildFile section */ - 6A117D6B2AD79D2D009BE8CD /* AuthenticationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A117D6A2AD79D2D009BE8CD /* AuthenticationServices.framework */; }; - 8102525814C569D80022296D /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8102525514C569D80022296D /* InfoPlist.strings */; }; - 81B8C535151078DB000C56DC /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 81B8C534151078DB000C56DC /* WebKit.framework */; }; - 81B8C53815108B89000C56DC /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 81B8C53715108B89000C56DC /* Carbon.framework */; }; - 81E2C20C14C5684A004CE5C2 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 81E2C20B14C5684A004CE5C2 /* Cocoa.framework */; }; - 81F4B4D914C6888B001B4465 /* WebView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 81F4B4D814C6888B001B4465 /* WebView.mm */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 18E976051EA4873F00083D49 /* Info-WebViewSeparated.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; name = "Info-WebViewSeparated.plist"; path = "Resources/Info-WebViewSeparated.plist"; sourceTree = ""; }; - 6A117D6A2AD79D2D009BE8CD /* AuthenticationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AuthenticationServices.framework; path = System/Library/Frameworks/AuthenticationServices.framework; sourceTree = SDKROOT; }; - 8102525414C569D80022296D /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Resources/Info.plist; sourceTree = SOURCE_ROOT; }; - 8102525514C569D80022296D /* InfoPlist.strings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = InfoPlist.strings; path = Resources/InfoPlist.strings; sourceTree = SOURCE_ROOT; }; - 8102525614C569D80022296D /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Prefix.pch; path = Resources/Prefix.pch; sourceTree = SOURCE_ROOT; }; - 81B8C534151078DB000C56DC /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; - 81B8C53715108B89000C56DC /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; }; - 81E2C20814C5684A004CE5C2 /* WebView.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WebView.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; - 81E2C20B14C5684A004CE5C2 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; - 81E2C20E14C5684A004CE5C2 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; - 81E2C21014C5684A004CE5C2 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 81F4B4D814C6888B001B4465 /* WebView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebView.mm; path = Sources/WebView.mm; sourceTree = ""; }; - 81F81AEC14D76D2400845D4C /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 81E2C20514C5684A004CE5C2 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 6A117D6B2AD79D2D009BE8CD /* AuthenticationServices.framework in Frameworks */, - 81B8C53815108B89000C56DC /* Carbon.framework in Frameworks */, - 81B8C535151078DB000C56DC /* WebKit.framework in Frameworks */, - 81E2C20C14C5684A004CE5C2 /* Cocoa.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 8102525914C573EB0022296D /* Sources */ = { - isa = PBXGroup; - children = ( - 81F4B4D814C6888B001B4465 /* WebView.mm */, - ); - name = Sources; - sourceTree = ""; - }; - 81E2C1FD14C5684A004CE5C2 = { - isa = PBXGroup; - children = ( - 8102525914C573EB0022296D /* Sources */, - 81E2C21114C5684A004CE5C2 /* Resources */, - 81E2C20A14C5684A004CE5C2 /* Frameworks */, - 81E2C20914C5684A004CE5C2 /* Products */, - ); - sourceTree = ""; - }; - 81E2C20914C5684A004CE5C2 /* Products */ = { - isa = PBXGroup; - children = ( - 81E2C20814C5684A004CE5C2 /* WebView.bundle */, - ); - name = Products; - sourceTree = ""; - }; - 81E2C20A14C5684A004CE5C2 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 6A117D6A2AD79D2D009BE8CD /* AuthenticationServices.framework */, - 81B8C53715108B89000C56DC /* Carbon.framework */, - 81F81AEC14D76D2400845D4C /* OpenGL.framework */, - 81E2C20E14C5684A004CE5C2 /* AppKit.framework */, - 81E2C21014C5684A004CE5C2 /* Foundation.framework */, - 81E2C20B14C5684A004CE5C2 /* Cocoa.framework */, - 81B8C534151078DB000C56DC /* WebKit.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 81E2C21114C5684A004CE5C2 /* Resources */ = { - isa = PBXGroup; - children = ( - 8102525414C569D80022296D /* Info.plist */, - 18E976051EA4873F00083D49 /* Info-WebViewSeparated.plist */, - 8102525514C569D80022296D /* InfoPlist.strings */, - 8102525614C569D80022296D /* Prefix.pch */, - ); - name = Resources; - path = WebView; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 81E2C20714C5684A004CE5C2 /* WebView */ = { - isa = PBXNativeTarget; - buildConfigurationList = 81E2C21A14C5684A004CE5C2 /* Build configuration list for PBXNativeTarget "WebView" */; - buildPhases = ( - 81E2C20414C5684A004CE5C2 /* Sources */, - 81E2C20514C5684A004CE5C2 /* Frameworks */, - 81E2C20614C5684A004CE5C2 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = WebView; - productName = WebView; - productReference = 81E2C20814C5684A004CE5C2 /* WebView.bundle */; - productType = "com.apple.product-type.bundle"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 81E2C1FF14C5684A004CE5C2 /* Project object */ = { - isa = PBXProject; - attributes = { - BuildIndependentTargetsInParallel = YES; - LastUpgradeCheck = 1200; - }; - buildConfigurationList = 81E2C20214C5684A004CE5C2 /* Build configuration list for PBXProject "WebView" */; - compatibilityVersion = "Xcode 8.0"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 81E2C1FD14C5684A004CE5C2; - productRefGroup = 81E2C20914C5684A004CE5C2 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 81E2C20714C5684A004CE5C2 /* WebView */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 81E2C20614C5684A004CE5C2 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8102525814C569D80022296D /* InfoPlist.strings in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 81E2C20414C5684A004CE5C2 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 81F4B4D914C6888B001B4465 /* WebView.mm in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 81E2C21814C5684A004CE5C2 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ""; - MACOSX_DEPLOYMENT_TARGET = 10.13; - ONLY_ACTIVE_ARCH = YES; - OTHER_LDFLAGS = ""; - SDKROOT = macosx; - USE_HEADERMAP = YES; - }; - name = Debug; - }; - 81E2C21914C5684A004CE5C2 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ""; - MACOSX_DEPLOYMENT_TARGET = 10.13; - OTHER_LDFLAGS = ""; - SDKROOT = macosx; - USE_HEADERMAP = YES; - }; - name = Release; - }; - 81E2C21B14C5684A004CE5C2 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_OBJC_WEAK = YES; - GCC_C_LANGUAGE_STANDARD = "compiler-default"; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = Resources/Prefix.pch; - INFOPLIST_FILE = Resources/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; - LD_RUNPATH_SEARCH_PATHS = ""; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - MACOSX_DEPLOYMENT_TARGET = 12.4; - PRODUCT_BUNDLE_IDENTIFIER = "net.gree.unitywebview.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "$(TARGET_NAME)"; - USE_HEADERMAP = YES; - WRAPPER_EXTENSION = bundle; - }; - name = Debug; - }; - 81E2C21C14C5684A004CE5C2 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_OBJC_WEAK = YES; - GCC_C_LANGUAGE_STANDARD = "compiler-default"; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = Resources/Prefix.pch; - INFOPLIST_FILE = Resources/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; - LD_RUNPATH_SEARCH_PATHS = ""; - LIBRARY_SEARCH_PATHS = "$(inherited)"; - MACOSX_DEPLOYMENT_TARGET = 12.4; - PRODUCT_BUNDLE_IDENTIFIER = "net.gree.unitywebview.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "$(TARGET_NAME)"; - USE_HEADERMAP = YES; - WRAPPER_EXTENSION = bundle; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 81E2C20214C5684A004CE5C2 /* Build configuration list for PBXProject "WebView" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 81E2C21814C5684A004CE5C2 /* Debug */, - 81E2C21914C5684A004CE5C2 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 81E2C21A14C5684A004CE5C2 /* Build configuration list for PBXNativeTarget "WebView" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 81E2C21B14C5684A004CE5C2 /* Debug */, - 81E2C21C14C5684A004CE5C2 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 81E2C1FF14C5684A004CE5C2 /* Project object */; -} diff --git a/Plugins/Mac/WebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Plugins/Mac/WebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a6..00000000 --- a/Plugins/Mac/WebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Plugins/Mac/WebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Plugins/Mac/WebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d98100..00000000 --- a/Plugins/Mac/WebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/Plugins/Mac/install.sh b/Plugins/Mac/install.sh index 59951737..eb5e05ce 100755 --- a/Plugins/Mac/install.sh +++ b/Plugins/Mac/install.sh @@ -1,9 +1,9 @@ #!/bin/bash DSTDIR="../../src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/" rm -rf DerivedData -xcodebuild -target WebView -configuration Release -arch x86_64 -arch arm64 build CONFIGURATION_BUILD_DIR='DerivedData' | xcbeautify +xcodebuild -target ImmutableWebView -configuration Release -arch x86_64 -arch arm64 build CONFIGURATION_BUILD_DIR='DerivedData' | xcbeautify mkdir -p $DSTDIR -cp -r DerivedData/WebView.bundle $DSTDIR +cp -r DerivedData/ImmutableWebView.bundle $DSTDIR rm -rf DerivedData cp *.bundle.meta $DSTDIR diff --git a/sample/Assets/Scripts/AuthenticatedScript.cs b/sample/Assets/Scripts/AuthenticatedScript.cs index ee921307..20c25426 100644 --- a/sample/Assets/Scripts/AuthenticatedScript.cs +++ b/sample/Assets/Scripts/AuthenticatedScript.cs @@ -169,7 +169,7 @@ public async void Logout() // Logout using the appropriate logout method if (SampleAppManager.SupportsPKCE && SampleAppManager.UsePKCE) { -#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX +#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX || UNITY_WEBGL await Passport.LogoutPKCE(); #endif } diff --git a/sample/Assets/Scripts/SelectAuthMethodScript.cs b/sample/Assets/Scripts/SelectAuthMethodScript.cs index e422602b..283d7968 100644 --- a/sample/Assets/Scripts/SelectAuthMethodScript.cs +++ b/sample/Assets/Scripts/SelectAuthMethodScript.cs @@ -16,14 +16,19 @@ public class SelectAuthMethodScript : MonoBehaviour void Start() { + // WebGL does not support Device Code Auth, so we'll use PKCE by default instead. +#if UNITY_WEBGL + UsePKCE(); +#else // Determine if PKCE is supported based on the platform SampleAppManager.SupportsPKCE = IsPKCESupported(); // If PKCE is not supported, initialise Passport to use Device Code Auth if (!SampleAppManager.SupportsPKCE) { - InitialisePassport(); + UseDeviceCodeAuth(); } +#endif } /// @@ -31,7 +36,7 @@ void Start() /// private bool IsPKCESupported() { -#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX +#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX || UNITY_WEBGL return true; #else return false; @@ -44,7 +49,7 @@ private bool IsPKCESupported() public void UseDeviceCodeAuth() { SampleAppManager.UsePKCE = false; - InitialisePassport(); + InitialisePassport(logoutRedirectUri: "https://www.immutable.com"); } /// @@ -53,7 +58,20 @@ public void UseDeviceCodeAuth() public void UsePKCE() { SampleAppManager.UsePKCE = true; +#if UNITY_WEBGL + string url = Application.absoluteURL; + Uri uri = new Uri(url); + string scheme = uri.Scheme; + string hostWithPort = uri.IsDefaultPort ? uri.Host : $"{uri.Host}:{uri.Port}"; + string fullPath = uri.AbsolutePath.EndsWith("/") ? uri.AbsolutePath : uri.AbsolutePath.Substring(0, uri.AbsolutePath.LastIndexOf('/') + 1); + + string redirectUri = $"{scheme}://{hostWithPort}{fullPath}callback.html"; + string logoutRedirectUri = $"{scheme}://{hostWithPort}{fullPath}logout.html"; + + InitialisePassport(redirectUri: redirectUri, logoutRedirectUri: logoutRedirectUri); +#else InitialisePassport(redirectUri: "imxsample://callback", logoutRedirectUri: "imxsample://callback/logout"); +#endif } /// @@ -61,7 +79,7 @@ public void UsePKCE() /// /// (Android, iOS and macOS only) The URL to which auth will redirect the browser after /// authorisation has been granted by the user - /// (Android, iOS and macOS only) The URL to which auth will redirect the browser + /// The URL to which auth will redirect the browser /// after log out is complete private async void InitialisePassport(string redirectUri = null, string logoutRedirectUri = null) { @@ -73,9 +91,12 @@ private async void InitialisePassport(string redirectUri = null, string logoutRe Passport.LogLevel = LogLevel.Info; // Initialise Passport - string clientId = "ZJL7JvetcDFBNDlgRs5oJoxuAUUl6uQj"; string environment = Immutable.Passport.Model.Environment.SANDBOX; - +#if UNITY_WEBGL + string clientId = "UnB98ngnXIZIEJWGJOjVe1BpCx5ix7qc"; +#else + string clientId = "ZJL7JvetcDFBNDlgRs5oJoxuAUUl6uQj"; +#endif Passport passport = await Passport.Init(clientId, environment, redirectUri, logoutRedirectUri); // Navigate to the unauthenticated scene after initialising Passport diff --git a/sample/Assets/Scripts/UnauthenticatedScript.cs b/sample/Assets/Scripts/UnauthenticatedScript.cs index c2ae9793..f86f12de 100644 --- a/sample/Assets/Scripts/UnauthenticatedScript.cs +++ b/sample/Assets/Scripts/UnauthenticatedScript.cs @@ -69,7 +69,7 @@ public async void Login() // Login using the appropriate login method if (SampleAppManager.SupportsPKCE && SampleAppManager.UsePKCE) { -#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX +#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX || UNITY_WEBGL await Passport.LoginPKCE(); #endif } @@ -111,7 +111,7 @@ public async void Connect() // Login and connect to IMX using the appropriate connect method if (SampleAppManager.SupportsPKCE && SampleAppManager.UsePKCE) { -#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX +#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX || UNITY_WEBGL await Passport.ConnectImxPKCE(); #endif } @@ -208,7 +208,7 @@ private async UniTask Logout() // Logout using the appropriate logout method if (SampleAppManager.SupportsPKCE && SampleAppManager.UsePKCE) { -#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX +#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX || UNITY_WEBGL await Passport.LogoutPKCE(); #endif } diff --git a/sample/Packages/manifest.json b/sample/Packages/manifest.json index 36aedebd..7fb0ae9b 100644 --- a/sample/Packages/manifest.json +++ b/sample/Packages/manifest.json @@ -3,6 +3,8 @@ "com.alttester.sdk": "2.1.1", "com.cysharp.unitask": "2.3.3", "com.immutable.passport": "file:../../src/Packages/Passport", + "com.immutable.marketplace": "file:../../src/Packages/Marketplace", + "com.immutable.orderbook": "file:../../src/Packages/Orderbook", "com.unity.ai.navigation": "1.1.4", "com.unity.ide.visualstudio": "2.0.21", "com.unity.ide.vscode": "1.2.5", diff --git a/sample/Packages/packages-lock.json b/sample/Packages/packages-lock.json index d274bd75..908a8eb8 100644 --- a/sample/Packages/packages-lock.json +++ b/sample/Packages/packages-lock.json @@ -14,6 +14,22 @@ "dependencies": {}, "url": "https://package.openupm.com" }, + "com.immutable.marketplace": { + "version": "file:../../src/Packages/Marketplace", + "depth": 0, + "source": "local", + "dependencies": { + "com.cysharp.unitask": "2.3.3" + } + }, + "com.immutable.orderbook": { + "version": "file:../../src/Packages/Orderbook", + "depth": 0, + "source": "local", + "dependencies": { + "com.cysharp.unitask": "2.3.3" + } + }, "com.immutable.passport": { "version": "file:../../src/Packages/Passport", "depth": 0, diff --git a/sample/ProjectSettings/ProjectSettings.asset b/sample/ProjectSettings/ProjectSettings.asset index 5b8b3f3a..b0552849 100644 --- a/sample/ProjectSettings/ProjectSettings.asset +++ b/sample/ProjectSettings/ProjectSettings.asset @@ -759,7 +759,7 @@ PlayerSettings: webGLDebugSymbols: 0 webGLEmscriptenArgs: webGLModulesDirectory: - webGLTemplate: APPLICATION:Default + webGLTemplate: PROJECT:unity-webview webGLAnalyzeBuildSize: 0 webGLUseEmbeddedResources: 0 webGLCompressionFormat: 0 @@ -798,7 +798,7 @@ PlayerSettings: allowUnsafeCode: 0 useDeterministicCompilation: 1 enableRoslynAnalyzers: 1 - selectedPlatform: 2 + selectedPlatform: 4 additionalIl2CppArgs: scriptingRuntimeVersion: 1 gcIncremental: 1 diff --git a/src/Packages/Passport/Runtime/Resources/index.html b/src/Packages/Passport/Runtime/Resources/index.html index 5fade945..fc8b5389 100644 --- a/src/Packages/Passport/Runtime/Resources/index.html +++ b/src/Packages/Passport/Runtime/Resources/index.html @@ -1,4 +1,4 @@ -GameSDK Bridge

Bridge Running

\ No newline at end of file +)[]`,e4=(e,t)=>{let r=[],i=new f.ethers.utils.Interface(d.walletContracts.mainModule.abi);for(let n of t){let t=(0,f.ethers).utils.arrayify(n.data||"0x");if(n.to===e&&(0,f.ethers).utils.hexlify(t.slice(0,4))===e5){let e=t.slice(4),i=(0,f.ethers).utils.defaultAbiCoder.decode([e8],e)[0];r.push(...e4(n.to,i.map(e=>c({},e,{to:e.target}))))}else try{let n=i.decodeFunctionData("execute",t)[0],a=e4(e,n.map(e=>c({},e,{to:e.target})));r.push(...a)}catch(e){r.push(n)}}return r};var e7=Object.freeze({__proto__:null,MetaTransactionsType:eZ,intendTransactionBundle:function(e,t,r,i){return c({},e,{chainId:r,intent:{id:i,wallet:t}})},intendedTransactionID:function(e){return(0,f.ethers).utils.keccak256((0,f.ethers).utils.defaultAbiCoder.encode(["address","uint256","bytes32"],[e.intent.wallet,e.chainId,e.intent.id]))},unpackMetaTransactionsData:function(e){let t=(0,f.ethers).utils.defaultAbiCoder.decode(["uint256",eZ],e);if(2!==t.length||!t[0]||!t[1])throw Error("Invalid meta transaction data");return[t[0],t[1]]},packMetaTransactionsData:eX,digestOfTransactions:e$,subdigestOfTransactions:function(e,t,r,i){return l({address:e,chainId:t,digest:e$(r,i)})},subdigestOfGuestModuleTransactions:function(e,t,r){return l({address:e,chainId:t,digest:(0,f.ethers).utils.keccak256((0,f.ethers).utils.defaultAbiCoder.encode(["string",eZ],["guest:",e2(r)]))})},toSequenceTransactions:eY,toSequenceTransaction:eQ,isSequenceTransaction:e0,hasSequenceTransactions:e1,sequenceTxAbiEncode:e2,fromTxAbiEncode:function(e){return e.map(e=>({delegateCall:e.delegateCall,revertOnError:e.revertOnError,gasLimit:e.gasLimit,to:e.target,value:e.value,data:e.data}))},encodeNonce:function(e,t){let r=(0,f.ethers).BigNumber.from(e),i=(0,f.ethers).BigNumber.from(t),n=(0,f.ethers).constants.Two.pow((0,f.ethers).BigNumber.from(96));if(!i.div(n).eq(f.ethers.constants.Zero))throw Error("Space already encoded");return i.add(r.mul(n))},decodeNonce:function(e){let t=(0,f.ethers).BigNumber.from(e),r=(0,f.ethers).constants.Two.pow((0,f.ethers).BigNumber.from(96));return[t.div(r),t.mod(r)]},fromTransactionish:function(e,t){if(Array.isArray(t)){if(e1(t))return t;{let r=eY(e,t);return r.map(e=>e.transaction)}}return e0(t)?[t]:[eQ(e,t).transaction]},isTransactionBundle:e6,isSignedTransactionBundle:e3,encodeBundleExecData:function(e){let t=new f.ethers.utils.Interface(d.walletContracts.mainModule.abi);return t.encodeFunctionData(t.getFunction("execute"),e3(e)?[e2(e.transactions),e.nonce,e.signature]:[e2(e.transactions),0,[]])},selfExecuteSelector:e5,selfExecuteAbi:e8,unwind:e4});let e9="0x608060405234801561001057600080fd5b5060405161124a38038061124a83398101604081905261002f91610124565b600060405161003d906100dd565b604051809103906000f080158015610059573d6000803e3d6000fd5b5090506000816001600160a01b0316638f0684308686866040518463ffffffff1660e01b815260040161008e939291906101fb565b6020604051808303816000875af11580156100ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100d19190610244565b9050806000526001601ff35b610fdc8061026e83390190565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561011b578181015183820152602001610103565b50506000910152565b60008060006060848603121561013957600080fd5b83516001600160a01b038116811461015057600080fd5b6020850151604086015191945092506001600160401b038082111561017457600080fd5b818601915086601f83011261018857600080fd5b81518181111561019a5761019a6100ea565b604051601f8201601f19908116603f011681019083821181831017156101c2576101c26100ea565b816040528281528960208487010111156101db57600080fd5b6101ec836020830160208801610100565b80955050505050509250925092565b60018060a01b0384168152826020820152606060408201526000825180606084015261022e816080850160208701610100565b601f01601f191691909101608001949350505050565b60006020828403121561025657600080fd5b8151801515811461026657600080fd5b939250505056fe608060405234801561001057600080fd5b50610fbc806100206000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c806376be4cea1161005057806376be4cea146100a65780638f068430146100b957806398ef1ed8146100cc57600080fd5b80631c6453271461006c5780633d787b6314610093575b600080fd5b61007f61007a366004610ad4565b6100df565b604051901515815260200160405180910390f35b61007f6100a1366004610ad4565b61023d565b61007f6100b4366004610b3e565b61031e565b61007f6100c7366004610ad4565b6108e1565b61007f6100da366004610ad4565b61096e565b6040517f76be4cea00000000000000000000000000000000000000000000000000000000815260009030906376be4cea9061012890889088908890889088908190600401610bc3565b6020604051808303816000875af1925050508015610181575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261017e91810190610c45565b60015b610232573d8080156101af576040519150601f19603f3d011682016040523d82523d6000602084013e6101b4565b606091505b508051600181900361022757816000815181106101d3576101d3610c69565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f0100000000000000000000000000000000000000000000000000000000000000149250610235915050565b600092505050610235565b90505b949350505050565b6040517f76be4cea00000000000000000000000000000000000000000000000000000000815260009030906376be4cea906102879088908890889088906001908990600401610bc3565b6020604051808303816000875af19250505080156102e0575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526102dd91810190610c45565b60015b610232573d80801561030e576040519150601f19603f3d011682016040523d82523d6000602084013e610313565b606091505b506000915050610235565b600073ffffffffffffffffffffffffffffffffffffffff87163b6060827f64926492649264926492649264926492649264926492649264926492649264928888610369602082610c98565b610375928b9290610cd8565b61037e91610d02565b1490508015610484576000606089828a610399602082610c98565b926103a693929190610cd8565b8101906103b39190610e18565b955090925090508415806103c45750865b1561047d576000808373ffffffffffffffffffffffffffffffffffffffff16836040516103f19190610eb2565b6000604051808303816000865af19150503d806000811461042e576040519150601f19603f3d011682016040523d82523d6000602084013e610433565b606091505b50915091508161047a57806040517f9d0d6e2d0000000000000000000000000000000000000000000000000000000081526004016104719190610f18565b60405180910390fd5b50505b50506104be565b87878080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509294505050505b80806104ca5750600083115b156106bb576040517f1626ba7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b1690631626ba7e90610523908c908690600401610f2b565b602060405180830381865afa92505050801561057a575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261057791810190610f44565b60015b61060f573d8080156105a8576040519150601f19603f3d011682016040523d82523d6000602084013e6105ad565b606091505b50851580156105bc5750600084115b156105db576105d08b8b8b8b8b600161031e565b9450505050506108d7565b806040517f6f2a95990000000000000000000000000000000000000000000000000000000081526004016104719190610f18565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f1626ba7e000000000000000000000000000000000000000000000000000000001480158161065f575086155b801561066b5750600085115b1561068b5761067f8c8c8c8c8c600161031e565b955050505050506108d7565b841580156106965750825b80156106a0575087155b156106af57806000526001601ffd5b94506108d79350505050565b6041871461074b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603a60248201527f5369676e617475726556616c696461746f72237265636f7665725369676e657260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610471565b600061075a6020828a8c610cd8565b61076391610d02565b90506000610775604060208b8d610cd8565b61077e91610d02565b905060008a8a604081811061079557610795610c69565b919091013560f81c915050601b81148015906107b557508060ff16601c14155b15610842576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f5369676e617475726556616c696461746f723a20696e76616c6964207369676e60448201527f617475726520762076616c7565000000000000000000000000000000000000006064820152608401610471565b6040805160008152602081018083528e905260ff831691810191909152606081018490526080810183905273ffffffffffffffffffffffffffffffffffffffff8e169060019060a0016020604051602081039080840390855afa1580156108ad573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff161496505050505050505b9695505050505050565b6040517f76be4cea00000000000000000000000000000000000000000000000000000000815260009030906376be4cea9061092b9088908890889088906001908990600401610bc3565b6020604051808303816000875af115801561094a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102329190610c45565b6040517f76be4cea00000000000000000000000000000000000000000000000000000000815260009030906376be4cea906109b790889088908890889088908190600401610bc3565b6020604051808303816000875af1925050508015610a10575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252610a0d91810190610c45565b60015b610232573d808015610a3e576040519150601f19603f3d011682016040523d82523d6000602084013e610a43565b606091505b5080516001819003610a6257816000815181106101d3576101d3610c69565b8082fd5b73ffffffffffffffffffffffffffffffffffffffff81168114610a8857600080fd5b50565b60008083601f840112610a9d57600080fd5b50813567ffffffffffffffff811115610ab557600080fd5b602083019150836020828501011115610acd57600080fd5b9250929050565b60008060008060608587031215610aea57600080fd5b8435610af581610a66565b935060208501359250604085013567ffffffffffffffff811115610b1857600080fd5b610b2487828801610a8b565b95989497509550505050565b8015158114610a8857600080fd5b60008060008060008060a08789031215610b5757600080fd5b8635610b6281610a66565b955060208701359450604087013567ffffffffffffffff811115610b8557600080fd5b610b9189828a01610a8b565b9095509350506060870135610ba581610b30565b91506080870135610bb581610b30565b809150509295509295509295565b73ffffffffffffffffffffffffffffffffffffffff8716815285602082015260a060408201528360a0820152838560c0830137600060c085830181019190915292151560608201529015156080820152601f9092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016909101019392505050565b600060208284031215610c5757600080fd5b8151610c6281610b30565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b81810381811115610cd2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b92915050565b60008085851115610ce857600080fd5b83861115610cf557600080fd5b5050820193919092039150565b80356020831015610cd2577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff602084900360031b1b1692915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f830112610d7e57600080fd5b813567ffffffffffffffff80821115610d9957610d99610d3e565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715610ddf57610ddf610d3e565b81604052838152866020858801011115610df857600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600060608486031215610e2d57600080fd5b8335610e3881610a66565b9250602084013567ffffffffffffffff80821115610e5557600080fd5b610e6187838801610d6d565b93506040860135915080821115610e7757600080fd5b50610e8486828701610d6d565b9150509250925092565b60005b83811015610ea9578181015183820152602001610e91565b50506000910152565b60008251610ec4818460208701610e8e565b9190910192915050565b60008151808452610ee6816020860160208601610e8e565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610c626020830184610ece565b8281526040602082015260006102356040830184610ece565b600060208284031215610f5657600080fd5b81517fffffffff0000000000000000000000000000000000000000000000000000000081168114610c6257600080fdfea26469706673582212201a72aed4b15ffb05b6502997a9bb655992e06590bd26b336dfbb153d7ff6f34b64736f6c63430008120033";async function te(e,t,r,i){return"0x01"===await e.call({data:(0,f.ethers).utils.concat([e9,new(0,f.ethers).utils.AbiCoder().encode(["address","bytes32","bytes"],[t,r,i])])})}var tt=Object.freeze({__proto__:null,EIP_6492_OFFCHAIN_DEPLOY_CODE:e9,EIP_6492_SUFFIX:"0x6492649264926492649264926492649264926492649264926492649264926492",validateEIP6492Offchain:te}),tr=Object.freeze({__proto__:null,config:u,signature:p,context:eJ,signer:_,EIP1271:g,transaction:e7,reader:Object.freeze({__proto__:null,OnChainReader:class{constructor(e){this.isDeployedCache=new Set,this.provider=e}module(e){return new f.ethers.Contract(e,[...d.walletContracts.mainModuleUpgradable.abi,...d.walletContracts.mainModule.abi,...d.walletContracts.erc1271.abi],this.provider)}async isDeployed(e){if(this.isDeployedCache.has(e))return!0;let t=await this.provider.getCode(e).then(e=>(0,f.ethers).utils.arrayify(e)),r=0!==t.length;return r&&this.isDeployedCache.add(e),r}async implementation(e){let t=(0,f.ethers).utils.defaultAbiCoder.encode(["address"],[e]),r=await this.provider.getStorageAt(e,t).then(e=>(0,f.ethers).utils.arrayify(e));return 20===r.length?(0,f.ethers).utils.getAddress((0,f.ethers).utils.hexlify(r)):32===r.length?(0,f.ethers).utils.defaultAbiCoder.decode(["address"],r)[0]:void 0}async imageHash(e){try{let t=await this.module(e).imageHash();return t}catch(e){}}async nonce(e,t=0){try{let r=await this.module(e).readNonce(t);return r}catch(t){if(!await this.isDeployed(e))return 0;throw t}}async isValidSignature(e,t,r){return te(this.provider,e,t,r)}}}),EIP6492:tt,isWalletSignRequestMetadata:function(e){return e&&e.address&&e.digest&&void 0!==e.chainId&&e.config}});let ti=[{config:P,signature:T},{config:eq,signature:em}];function tn(e){let t=e-1;if(t<0||t>=ti.length)throw Error(`No coder for version: ${e}`);return ti[t]}var ta=Object.freeze({__proto__:null,ALL_CODERS:ti,coderFor:tn,genericCoderFor:function(e){return tn(e)}});let ts=[j,eV]},{ethers:"8wpcu","@0xsequence/abi":"NeOck","@parcel/transformer-js/src/esmodule-helpers.js":"cI3Jn"}]},["8Vdv4"],"8Vdv4","parcelRequire59a4");

Bridge Running

\ No newline at end of file diff --git a/src/Packages/Passport/Runtime/Scripts/Private/Core/BrowserCommunicationsManager.cs b/src/Packages/Passport/Runtime/Scripts/Private/Core/BrowserCommunicationsManager.cs index a073f9f6..dcd2085a 100644 --- a/src/Packages/Passport/Runtime/Scripts/Private/Core/BrowserCommunicationsManager.cs +++ b/src/Packages/Passport/Runtime/Scripts/Private/Core/BrowserCommunicationsManager.cs @@ -15,7 +15,7 @@ namespace Immutable.Passport.Core public interface IBrowserCommunicationsManager { -#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX +#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX || UNITY_WEBGL event OnUnityPostMessageDelegate OnAuthPostMessage; event OnUnityPostMessageErrorDelegate OnPostMessageError; #endif @@ -58,7 +58,7 @@ public BrowserCommunicationsManager(IWebBrowserClient webBrowserClient) { this.webBrowserClient = webBrowserClient; this.webBrowserClient.OnUnityPostMessage += InvokeOnUnityPostMessage; -#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX +#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX || UNITY_WEBGL this.webBrowserClient.OnAuthPostMessage += InvokeOnAuthPostMessage; this.webBrowserClient.OnPostMessageError += InvokeOnPostMessageError; #endif diff --git a/src/Packages/Passport/Runtime/Scripts/Private/Helpers/SdkVersionInfoHelpers.cs b/src/Packages/Passport/Runtime/Scripts/Private/Helpers/SdkVersionInfoHelpers.cs index 7ec3a5f2..c7ebe5f1 100644 --- a/src/Packages/Passport/Runtime/Scripts/Private/Helpers/SdkVersionInfoHelpers.cs +++ b/src/Packages/Passport/Runtime/Scripts/Private/Helpers/SdkVersionInfoHelpers.cs @@ -4,7 +4,7 @@ public class SdkVersionInfoHelpers { public static string GetSdkVersionInfo() { - return "1.25.2"; + return "1.26.0"; } } } diff --git a/src/Packages/Passport/Runtime/Scripts/Private/Immutable.Passport.Runtime.Private.asmdef b/src/Packages/Passport/Runtime/Scripts/Private/Immutable.Passport.Runtime.Private.asmdef index afa21bb6..bbb0c0aa 100644 --- a/src/Packages/Passport/Runtime/Scripts/Private/Immutable.Passport.Runtime.Private.asmdef +++ b/src/Packages/Passport/Runtime/Scripts/Private/Immutable.Passport.Runtime.Private.asmdef @@ -5,7 +5,7 @@ "VoltstroStudios.UnityWebBrowser", "UniTask", "Immutable.Browser.Core", - "unity-webview", + "Immutable.Browser.Gree", "Immutable.Passport.Core.Logging" ], "includePlatforms": [ @@ -13,7 +13,8 @@ "Editor", "iOS", "macOSStandalone", - "WindowsStandalone64" + "WindowsStandalone64", + "WebGL" ], "excludePlatforms": [], "allowUnsafeCode": false, diff --git a/src/Packages/Passport/Runtime/Scripts/Private/Model/Request/InitRequest.cs b/src/Packages/Passport/Runtime/Scripts/Private/Model/Request/InitRequest.cs index 6fc2cf3e..61ceb5ce 100644 --- a/src/Packages/Passport/Runtime/Scripts/Private/Model/Request/InitRequest.cs +++ b/src/Packages/Passport/Runtime/Scripts/Private/Model/Request/InitRequest.cs @@ -18,6 +18,7 @@ internal class InitRequest { public string clientId; public string environment; + public string logoutRedirectUri; public VersionInfo engineVersion; } } diff --git a/src/Packages/Passport/Runtime/Scripts/Private/PassportImpl.cs b/src/Packages/Passport/Runtime/Scripts/Private/PassportImpl.cs index 4e57a358..2d7c9247 100644 --- a/src/Packages/Passport/Runtime/Scripts/Private/PassportImpl.cs +++ b/src/Packages/Passport/Runtime/Scripts/Private/PassportImpl.cs @@ -55,7 +55,7 @@ public async UniTask Init(string clientId, string environment, string redirectUr this.redirectUri = redirectUri; this.logoutRedirectUri = logoutRedirectUri; -#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX +#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX || UNITY_WEBGL this.communicationsManager.OnAuthPostMessage += OnDeepLinkActivated; this.communicationsManager.OnPostMessageError += OnPostMessageError; #endif @@ -71,7 +71,7 @@ public async UniTask Init(string clientId, string environment, string redirectUr }; string initRequest; - if (redirectUri != null && logoutRedirectUri != null) + if (redirectUri != null) { InitRequestWithRedirectUri requestWithRedirectUri = new InitRequestWithRedirectUri() { @@ -89,6 +89,7 @@ public async UniTask Init(string clientId, string environment, string redirectUr { clientId = clientId, environment = environment, + logoutRedirectUri = logoutRedirectUri, engineVersion = versionInfo }; initRequest = JsonUtility.ToJson(request); @@ -316,7 +317,10 @@ public async void OnDeepLinkActivated(string url) PassportLogger.Info($"{TAG} Received deeplink URL: {url}"); Uri uri = new Uri(url); - string domain = $"{uri.Scheme}://{uri.Host}{uri.AbsolutePath}"; + string hostWithPort = uri.IsDefaultPort ? uri.Host : $"{uri.Host}:{uri.Port}"; + + string domain = $"{uri.Scheme}://{hostWithPort}{uri.AbsolutePath}"; + if (domain.EndsWith("/")) { domain = domain.Remove(domain.Length - 1); diff --git a/src/Packages/Passport/Runtime/Scripts/Public/Immutable.Passport.Runtime.asmdef b/src/Packages/Passport/Runtime/Scripts/Public/Immutable.Passport.Runtime.asmdef index 882b7caa..7e45913c 100644 --- a/src/Packages/Passport/Runtime/Scripts/Public/Immutable.Passport.Runtime.asmdef +++ b/src/Packages/Passport/Runtime/Scripts/Public/Immutable.Passport.Runtime.asmdef @@ -5,7 +5,7 @@ "VoltstroStudios.UnityWebBrowser", "UniTask", "Immutable.Browser.Core", - "unity-webview", + "Immutable.Browser.Gree", "Immutable.Passport.Runtime.Private", "Immutable.Passport.Core.Logging" ], @@ -14,7 +14,8 @@ "Editor", "iOS", "macOSStandalone", - "WindowsStandalone64" + "WindowsStandalone64", + "WebGL" ], "excludePlatforms": [], "allowUnsafeCode": false, diff --git a/src/Packages/Passport/Runtime/Scripts/Public/Passport.cs b/src/Packages/Passport/Runtime/Scripts/Public/Passport.cs index 6cda5e6b..eeb35602 100644 --- a/src/Packages/Passport/Runtime/Scripts/Public/Passport.cs +++ b/src/Packages/Passport/Runtime/Scripts/Public/Passport.cs @@ -5,7 +5,7 @@ using VoltstroStudios.UnityWebBrowser.Core; using VoltstroStudios.UnityWebBrowser.Shared; #endif -#elif (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX +#elif (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX || UNITY_WEBGL using Immutable.Browser.Gree; #endif using Immutable.Passport.Event; @@ -95,7 +95,7 @@ private Passport() /// The client ID /// The environment to connect to /// (Android, iOS, and macOS only) The URL where the browser will redirect after successful authentication. - /// (Android, iOS, and macOS only) The URL where the browser will redirect after logout is complete. + /// The URL where the browser will redirect after logout is complete. /// (Windows only) Timeout duration in milliseconds to wait for the default Windows browser engine to start. /// (Windows only) Custom Windows browser to use instead of the default browser in the SDK. public static UniTask Init( @@ -181,7 +181,7 @@ private async UniTask Initialise( await ((WebBrowserClient)this.webBrowserClient).Init(engineStartupTimeoutMs); #endif } -#elif (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX +#elif (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX || UNITY_WEBGL // Initialise default browser client for Android, iOS, and macOS webBrowserClient = new GreeBrowserClient(); #else @@ -190,9 +190,13 @@ private async UniTask Initialise( // Set up browser communication BrowserCommunicationsManager communicationsManager = new BrowserCommunicationsManager(webBrowserClient); + +#if UNITY_WEBGL + readySignalReceived = true; +#else // Mark ready when browser is initialised and game bridge file is loaded communicationsManager.OnReady += () => readySignalReceived = true; - +#endif // Set up Passport implementation passportImpl = new PassportImpl(communicationsManager); // Subscribe to Passport authentication events @@ -221,6 +225,9 @@ public void SetCallTimeout(int ms) /// If true, the saved access token or refresh token will be used to log the user in. If this fails, it will not fallback to device code auth. /// (Optional) The maximum time, in milliseconds, the function is allowed to take before a TimeoutException is thrown. If not set, the function will wait indefinitely. ///
+ /// + /// Returns true if login is successful, otherwise false. + /// public async UniTask Login(bool useCachedSession = false, Nullable timeoutMs = null) { return await GetPassportImpl().Login(useCachedSession, timeoutMs); @@ -237,7 +244,7 @@ public async UniTask ConnectImx(bool useCachedSession = false, Nullable /// Connects the user into Passport via PKCE auth. /// @@ -279,7 +286,7 @@ public async UniTask Logout(bool hardLogout = true) await GetPassportImpl().Logout(hardLogout); } -#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX +#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX || UNITY_WEBGL /// /// Logs the user out of Passport and removes any stored credentials. /// Recommended to use when logging in using PKCE flow - ConnectImxPKCE() diff --git a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/GreeBrowserClient.cs b/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/GreeBrowserClient.cs index 661c0460..38dbe457 100644 --- a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/GreeBrowserClient.cs +++ b/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/GreeBrowserClient.cs @@ -1,7 +1,8 @@ -#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX +#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX || UNITY_WEBGL using Immutable.Browser.Core; using Immutable.Passport.Core.Logging; +using UnityEngine; namespace Immutable.Browser.Gree { @@ -20,7 +21,12 @@ public GreeBrowserClient() PassportLogger.Warn("Native Android and iOS WebViews cannot run in the Editor, so the macOS WebView is currently used to save your development time." + " Testing your game on an actual device or emulator is recommended to ensure proper functionality."); #endif +#if UNITY_WEBGL && !UNITY_EDITOR + GameObject webViewGameObject = new GameObject("WebViewObject"); + webViewObject = webViewGameObject.AddComponent(); +#else webViewObject = new WebViewObject(); +#endif webViewObject.Init( cb: InvokeOnUnityPostMessage, httpErr: InvokeOnPostMessageError, diff --git a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle.meta b/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle.meta deleted file mode 100644 index 1165b4f0..00000000 --- a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle.meta +++ /dev/null @@ -1,33 +0,0 @@ -fileFormatVersion: 2 -guid: 5390f3f89134c467fb0bf687e714c2d6 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 1 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 1 - settings: - DefaultValueInitialized: true - - first: - Standalone: OSXUniversal - second: - enabled: 1 - settings: - CPU: AnyCPU - userData: - assetBundleName: - assetBundleVariant: diff --git a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle/Contents/Info.plist b/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle/Contents/Info.plist deleted file mode 100644 index 6c26a9f4..00000000 --- a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle/Contents/Info.plist +++ /dev/null @@ -1,48 +0,0 @@ - - - - - BuildMachineOSBuild - 23B81 - CFBundleDevelopmentRegion - English - CFBundleExecutable - WebView - CFBundleIdentifier - net.gree.unitywebview.WebView - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - WebView - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleSupportedPlatforms - - MacOSX - - CFBundleVersion - 1 - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - - DTPlatformName - macosx - DTPlatformVersion - 14.0 - DTSDKBuild - 23A334 - DTSDKName - macosx14.0 - DTXcode - 1501 - DTXcodeBuild - 15A507 - LSMinimumSystemVersion - 12.4 - - diff --git a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle/Contents/MacOS/WebView b/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle/Contents/MacOS/WebView deleted file mode 100755 index ce554fbb..00000000 Binary files a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle/Contents/MacOS/WebView and /dev/null differ diff --git a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle/Contents/Resources/InfoPlist.strings b/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle/Contents/Resources/InfoPlist.strings deleted file mode 100644 index 5e45963c..00000000 Binary files a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle/Contents/Resources/InfoPlist.strings and /dev/null differ diff --git a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle/Contents/_CodeSignature/CodeResources b/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle/Contents/_CodeSignature/CodeResources deleted file mode 100644 index f4d2e431..00000000 --- a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle/Contents/_CodeSignature/CodeResources +++ /dev/null @@ -1,128 +0,0 @@ - - - - - files - - Resources/InfoPlist.strings - - MiLKDDnrUKr4EmuvhS5VQwxHGK8= - - - files2 - - Resources/InfoPlist.strings - - hash2 - - Oc8u4Ht7Mz58F50L9NeYpbcq9qTlhPUeZCcDu/pPyCg= - - - - rules - - ^Resources/ - - ^Resources/.*\.lproj/ - - optional - - weight - 1000 - - ^Resources/.*\.lproj/locversion.plist$ - - omit - - weight - 1100 - - ^Resources/Base\.lproj/ - - weight - 1010 - - ^version.plist$ - - - rules2 - - .*\.dSYM($|/) - - weight - 11 - - ^(.*/)?\.DS_Store$ - - omit - - weight - 2000 - - ^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/ - - nested - - weight - 10 - - ^.* - - ^Info\.plist$ - - omit - - weight - 20 - - ^PkgInfo$ - - omit - - weight - 20 - - ^Resources/ - - weight - 20 - - ^Resources/.*\.lproj/ - - optional - - weight - 1000 - - ^Resources/.*\.lproj/locversion.plist$ - - omit - - weight - 1100 - - ^Resources/Base\.lproj/ - - weight - 1010 - - ^[^/]+$ - - nested - - weight - 10 - - ^embedded\.provisionprofile$ - - weight - 20 - - ^version\.plist$ - - weight - 20 - - - - diff --git a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebViewObject.cs b/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebViewObject.cs index 453f236b..417e4581 100644 --- a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebViewObject.cs +++ b/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebViewObject.cs @@ -64,7 +64,11 @@ public static Singleton Instance } #endif +#if UNITY_WEBGL && !UNITY_EDITOR + public class WebViewObject : MonoBehaviour +#else public class WebViewObject +#endif { private const string TAG = "[WebViewObject]"; Callback onJS; @@ -94,47 +98,49 @@ public void call(String message) { #if UNITY_IPHONE && !UNITY_EDITOR [DllImport("__Internal")] - private static extern IntPtr _CWebViewPlugin_Init(string ua); + private static extern IntPtr _CImmutableWebViewPlugin_Init(string ua); [DllImport("__Internal")] - private static extern int _CWebViewPlugin_Destroy(IntPtr instance); + private static extern int _CImmutableWebViewPlugin_Destroy(IntPtr instance); [DllImport("__Internal")] - private static extern void _CWebViewPlugin_LoadURL( + private static extern void _CImmutableWebViewPlugin_LoadURL( IntPtr instance, string url); [DllImport("__Internal")] - private static extern void _CWebViewPlugin_EvaluateJS( + private static extern void _CImmutableWebViewPlugin_EvaluateJS( IntPtr instance, string url); [DllImport("__Internal")] - private static extern void _CWebViewPlugin_LaunchAuthURL(IntPtr instance, string url); + private static extern void _CImmutableWebViewPlugin_LaunchAuthURL(IntPtr instance, string url); [DllImport("__Internal")] - private static extern void _CWebViewPlugin_SetDelegate(DelegateMessage callback); + private static extern void _CImmutableWebViewPlugin_SetDelegate(DelegateMessage callback); [DllImport("__Internal")] - private static extern void _CWebViewPlugin_ClearCache(IntPtr instance, bool includeDiskFiles); + private static extern void _CImmutableWebViewPlugin_ClearCache(IntPtr instance, bool includeDiskFiles); [DllImport("__Internal")] - private static extern void _CWebViewPlugin_ClearStorage(IntPtr instance); + private static extern void _CImmutableWebViewPlugin_ClearStorage(IntPtr instance); #elif UNITY_STANDALONE_OSX || (UNITY_ANDROID && UNITY_EDITOR_OSX) || (UNITY_IPHONE && UNITY_EDITOR_OSX) - [DllImport("WebView")] - private static extern IntPtr _CWebViewPlugin_Init(string ua); - [DllImport("WebView")] - private static extern int _CWebViewPlugin_Destroy(IntPtr instance); - [DllImport("WebView")] - private static extern void _CWebViewPlugin_LoadURL( + [DllImport("ImmutableWebView")] + private static extern IntPtr _CImmutableWebViewPlugin_Init(string ua); + [DllImport("ImmutableWebView")] + private static extern int _CImmutableWebViewPlugin_Destroy(IntPtr instance); + [DllImport("ImmutableWebView")] + private static extern void _CImmutableWebViewPlugin_LoadURL( IntPtr instance, string url); - [DllImport("WebView")] - private static extern void _CWebViewPlugin_EvaluateJS( + [DllImport("ImmutableWebView")] + private static extern void _CImmutableWebViewPlugin_EvaluateJS( IntPtr instance, string url); - [DllImport("WebView")] - private static extern void _CWebViewPlugin_LaunchAuthURL(IntPtr instance, string url, string redirectUri); - [DllImport("WebView")] - private static extern void _CWebViewPlugin_SetDelegate(DelegateMessage callback); + [DllImport("ImmutableWebView")] + private static extern void _CImmutableWebViewPlugin_LaunchAuthURL(IntPtr instance, string url, string redirectUri); + [DllImport("ImmutableWebView")] + private static extern void _CImmutableWebViewPlugin_SetDelegate(DelegateMessage callback); #elif UNITY_WEBGL [DllImport("__Internal")] - private static extern void _gree_unity_webview_init(); + private static extern void _gree_unity_webview_init(string name); [DllImport("__Internal")] - private static extern void _gree_unity_webview_loadURL(string url); + private static extern void _gree_unity_webview_loadURL(string name, string url); [DllImport("__Internal")] - private static extern void _gree_unity_webview_evaluateJS(string js); + private static extern void _gree_unity_webview_evaluateJS(string name, string js); [DllImport("__Internal")] - private static extern void _gree_unity_webview_destroy(); + private static extern void _gree_unity_webview_destroy(string name); + [DllImport("__Internal")] + private static extern void _gree_unity_webview_launchAuthURL(string name, string url); #endif #if UNITY_IPHONE || UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX @@ -192,7 +198,12 @@ private static void delegateMessageReceived(string key, string message) } } #endif - +#if UNITY_WEBGL && !UNITY_EDITOR + void Awake() + { + DontDestroyOnLoad(this); + } +#endif public void handleMessage(string message) { var i = message.IndexOf(':', 0); @@ -230,7 +241,7 @@ public void Init( onLog = log; #if UNITY_WEBGL #if !UNITY_EDITOR - _gree_unity_webview_init(); + _gree_unity_webview_init(name); #endif #elif UNITY_WEBPLAYER Application.ExternalCall("unityWebView.init"); @@ -238,13 +249,13 @@ public void Init( //TODO: UNSUPPORTED PassportLogger.Error("Webview is not supported on this platform."); #elif UNITY_IPHONE || UNITY_STANDALONE_OSX || (UNITY_ANDROID && UNITY_EDITOR_OSX) - webView = _CWebViewPlugin_Init(ua); + webView = _CImmutableWebViewPlugin_Init(ua); Singleton.Instance.onJS = ((message) => CallFromJS(message)); Singleton.Instance.onError = ((id, message) => CallOnError(id, message)); Singleton.Instance.onHttpError = ((id, message) => CallOnHttpError(id, message)); Singleton.Instance.onAuth = ((message) => CallOnAuth(message)); Singleton.Instance.onLog = ((message) => CallOnLog(message)); - _CWebViewPlugin_SetDelegate(delegateMessageReceived); + _CImmutableWebViewPlugin_SetDelegate(delegateMessageReceived); #elif UNITY_ANDROID webView = new AndroidJavaObject("net.gree.unitywebview.CWebViewPluginNoUi"); webView.Call("Init", ua); @@ -260,7 +271,7 @@ public void LoadURL(string url) return; #if UNITY_WEBGL #if !UNITY_EDITOR - _gree_unity_webview_loadURL(url); + _gree_unity_webview_loadURL(name, url); #endif #elif UNITY_WEBPLAYER Application.ExternalCall("unityWebView.loadURL", url); @@ -269,7 +280,7 @@ public void LoadURL(string url) #elif UNITY_STANDALONE_OSX || UNITY_IPHONE || (UNITY_ANDROID && UNITY_EDITOR_OSX) if (webView == IntPtr.Zero) return; - _CWebViewPlugin_LoadURL(webView, url); + _CImmutableWebViewPlugin_LoadURL(webView, url); #elif UNITY_ANDROID if (webView == null) return; @@ -281,7 +292,7 @@ public void EvaluateJS(string js) { #if UNITY_WEBGL #if !UNITY_EDITOR - _gree_unity_webview_evaluateJS(js); + _gree_unity_webview_evaluateJS(name, js); #endif #elif UNITY_WEBPLAYER Application.ExternalCall("unityWebView.evaluateJS", js); @@ -290,7 +301,7 @@ public void EvaluateJS(string js) #elif UNITY_STANDALONE_OSX || UNITY_IPHONE || (UNITY_ANDROID && UNITY_EDITOR_OSX) if (webView == IntPtr.Zero) return; - _CWebViewPlugin_EvaluateJS(webView, js); + _CImmutableWebViewPlugin_EvaluateJS(webView, js); #elif UNITY_ANDROID if (webView == null) return; @@ -303,11 +314,13 @@ public void LaunchAuthURL(string url, string redirectUri) #if UNITY_STANDALONE_OSX || (UNITY_ANDROID && UNITY_EDITOR_OSX) || (UNITY_IPHONE && UNITY_EDITOR_OSX) if (webView == IntPtr.Zero) return; - _CWebViewPlugin_LaunchAuthURL(webView, url, redirectUri != null ? redirectUri : ""); + _CImmutableWebViewPlugin_LaunchAuthURL(webView, url, redirectUri != null ? redirectUri : ""); #elif UNITY_IPHONE && !UNITY_EDITOR_WIN if (webView == IntPtr.Zero) return; - _CWebViewPlugin_LaunchAuthURL(webView, url); + _CImmutableWebViewPlugin_LaunchAuthURL(webView, url); +#elif UNITY_WEBGL && !UNITY_EDITOR + _gree_unity_webview_launchAuthURL(name, url); #else UnityEngine.Application.OpenURL(url); #endif @@ -365,7 +378,7 @@ public void ClearCache(bool includeDiskFiles) #if UNITY_IPHONE && !UNITY_EDITOR if (webView == IntPtr.Zero) return; - _CWebViewPlugin_ClearCache(webView, includeDiskFiles); + _CImmutableWebViewPlugin_ClearCache(webView, includeDiskFiles); #elif UNITY_ANDROID && !UNITY_EDITOR if (webView == null) return; @@ -380,7 +393,7 @@ public void ClearStorage() #if UNITY_IPHONE && !UNITY_EDITOR if (webView == IntPtr.Zero) return; - _CWebViewPlugin_ClearStorage(webView); + _CImmutableWebViewPlugin_ClearStorage(webView); #elif UNITY_ANDROID && !UNITY_EDITOR if (webView == null) return; diff --git a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebViewObject.cs.meta b/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebViewObject.cs.meta index 32948634..32bdcb48 100644 --- a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebViewObject.cs.meta +++ b/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebViewObject.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d4d2b188f50df4b299eb714ef4360ee9 +guid: 43078641b40584a8e94b32e5367fb0de MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/iOS/WebView.mm b/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/iOS/WebView.mm deleted file mode 100644 index 5e90df3f..00000000 --- a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/iOS/WebView.mm +++ /dev/null @@ -1,473 +0,0 @@ -/* - * Copyright (C) 2011 Keijiro Takahashi - * Copyright (C) 2012 GREE, Inc. - * - * This software is provided 'as-is', without any express or implied - * warranty. In no event will the authors be held liable for any damages - * arising from the use of this software. - * - * Permission is granted to anyone to use this software for any purpose, - * including commercial applications, and to alter it and redistribute it - * freely, subject to the following restrictions: - * - * 1. The origin of this software must not be misrepresented; you must not - * claim that you wrote the original software. If you use this software - * in a product, an acknowledgment in the product documentation would be - * appreciated but is not required. - * 2. Altered source versions must be plainly marked as such, and must not be - * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any source distribution. - */ - -#import -#import -#import - -// NOTE: we need extern without "C" before unity 4.5 -extern "C" UIViewController *UnityGetGLViewController(); -extern "C" void UnitySendMessage(const char *, const char *, const char *); -extern "C" typedef void (*DelegateCallbackFunction)(const char * key, const char * message); - -DelegateCallbackFunction delegateCallback = NULL; - -// cf. https://stackoverflow.com/questions/26383031/wkwebview-causes-my-view-controller-to-leak/33365424#33365424 -@interface WeakScriptMessageDelegate : NSObject - -@property (nonatomic, weak) id scriptDelegate; - -- (instancetype)initWithDelegate:(id)scriptDelegate; - -@end - -@implementation WeakScriptMessageDelegate - -- (instancetype)initWithDelegate:(id)scriptDelegate -{ - self = [super init]; - if (self) { - _scriptDelegate = scriptDelegate; - } - return self; -} - -- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message -{ - [self.scriptDelegate userContentController:userContentController didReceiveScriptMessage:message]; -} - -@end - -@protocol WebViewProtocol -@property (nullable, nonatomic, weak) id navigationDelegate; -@property (nullable, nonatomic, weak) id UIDelegate; -@property (nullable, nonatomic, readonly, copy) NSURL *URL; -- (void)stopLoading; -- (void)load:(NSURLRequest *)request; -- (void)evaluateJavaScript:(NSString *)javaScriptString completionHandler:(void (^ __nullable)(__nullable id, NSError * __nullable error))completionHandler; -@end - -@interface WKWebView(WebViewProtocolConformed) -@end - -@implementation WKWebView(WebViewProtocolConformed) - -- (void)load:(NSURLRequest *)request -{ - WKWebView *webView = (WKWebView *)self; - NSURL *url = [request URL]; - if ([url.absoluteString hasPrefix:@"file:"]) { - // LoadFileURL is not loading the JS content due to thinking it's out of the sandbox - // NSURL *top = [NSURL URLWithString:[[url absoluteString] stringByDeletingLastPathComponent]]; - // [webView loadFileURL:url allowingReadAccessToURL:top]; - NSString *htmlContent = [NSString stringWithContentsOfFile:url.path encoding:NSUTF8StringEncoding error:nil]; - [webView loadHTMLString:htmlContent baseURL:url]; - } else { - [webView loadRequest:request]; - } -} -@end - -@interface CWebViewPlugin : NSObject -{ - WKWebView *webView; -} -@end - -@implementation CWebViewPlugin - -static WKProcessPool *_sharedProcessPool; -static NSMutableArray *_instances = [[NSMutableArray alloc] init]; -static CWebViewPlugin *__delegate = nil; -static ASWebAuthenticationSession *_authSession; - -- (id)initWithUa:(const char *)ua -{ - self = [super init]; - - if (_sharedProcessPool == NULL) { - _sharedProcessPool = [[WKProcessPool alloc] init]; - } - - WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init]; - WKUserContentController *controller = [[WKUserContentController alloc] init]; - [controller addScriptMessageHandler:[[WeakScriptMessageDelegate alloc] initWithDelegate:self] name:@"unityControl"]; - [controller addScriptMessageHandler:[[WeakScriptMessageDelegate alloc] initWithDelegate:self] name:@"saveDataURL"]; - [controller addScriptMessageHandler:[[WeakScriptMessageDelegate alloc] initWithDelegate:self] name:@"logHandler"]; - NSString *str = @"\ - window.Unity = { \ - call: function(msg) { \ - window.webkit.messageHandlers.unityControl.postMessage(msg); \ - }, \ - saveDataURL: function(fileName, dataURL) { \ - window.webkit.messageHandlers.saveDataURL.postMessage(fileName + '\t' + dataURL); \ - } \ - }; \ - function captureLog(msg) { window.webkit.messageHandlers.logHandler.postMessage(msg); } window.console.log = captureLog; \ - "; - - WKUserScript *script - = [[WKUserScript alloc] initWithSource:str injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:YES]; - [controller addUserScript:script]; - configuration.userContentController = controller; - configuration.mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeNone; - configuration.websiteDataStore = [WKWebsiteDataStore defaultDataStore]; - configuration.processPool = _sharedProcessPool; - - WKWebView *wkwebView = [[WKWebView alloc] initWithFrame:CGRectZero configuration:configuration]; -#if UNITYWEBVIEW_DEVELOPMENT - // enable Safari debugging if exists - if ([wkwebView respondsToSelector:@selector(setInspectable:)]) { - [wkwebView performSelector:@selector(setInspectable:) withObject:@true]; - } -#endif - webView = wkwebView; - webView.UIDelegate = self; - webView.navigationDelegate = self; - - if (ua != NULL && strcmp(ua, "") != 0) { - ((WKWebView *)webView).customUserAgent = [[NSString alloc] initWithUTF8String:ua]; - } - - webView.hidden = YES; - - // cf. https://rick38yip.medium.com/wkwebview-weird-spacing-issue-in-ios-13-54a4fc686f72 - // cf. https://stackoverflow.com/questions/44390971/automaticallyadjustsscrollviewinsets-was-deprecated-in-ios-11-0 - ((WKWebView *)webView).scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; - - webView.backgroundColor = [UIColor clearColor]; - webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - - UIView *view = UnityGetGLViewController().view; - [view addSubview:webView]; - - return self; -} - -- (void)dispose -{ - if (webView != nil) { - WKWebView *webView0 = webView; - webView = nil; - if ([webView0 isKindOfClass:[WKWebView class]]) { - webView0.UIDelegate = nil; - webView0.navigationDelegate = nil; - [((WKWebView *)webView0).configuration.userContentController removeScriptMessageHandlerForName:@"saveDataURL"]; - [((WKWebView *)webView0).configuration.userContentController removeScriptMessageHandlerForName:@"unityControl"]; - [((WKWebView *)webView0).configuration.userContentController removeScriptMessageHandlerForName:@"logHandler"]; - } - [webView0 stopLoading]; - [webView0 removeFromSuperview]; - } - delegateCallback = nil; -} - -+ (void)resetSharedProcessPool -{ - // cf. https://stackoverflow.com/questions/33156567/getting-all-cookies-from-wkwebview/49744695#49744695 - _sharedProcessPool = [[WKProcessPool alloc] init]; - [_instances enumerateObjectsUsingBlock:^(CWebViewPlugin *obj, NSUInteger idx, BOOL *stop) { - if ([obj->webView isKindOfClass:[WKWebView class]]) { - WKWebView *webView = (WKWebView *)obj->webView; - webView.configuration.processPool = _sharedProcessPool; - } - }]; -} - -- (void)userContentController:(WKUserContentController *)userContentController - didReceiveScriptMessage:(WKScriptMessage *)message -{ - if ([message.name isEqualToString:@"logHandler"]) { - [self sendUnityCallback:"CallOnLog" message:[[NSString stringWithFormat:@"%@", message.body] UTF8String]]; - } else if ([message.name isEqualToString:@"unityControl"]) { - [self sendUnityCallback:"CallFromJS" message:[[NSString stringWithFormat:@"%@", message.body] UTF8String]]; - } else if ([message.name isEqualToString:@"saveDataURL"]) { - NSRange range = [message.body rangeOfString:@"\t"]; - if (range.location == NSNotFound) { - return; - } - NSString *fileName = [[message.body substringWithRange:NSMakeRange(0, range.location)] lastPathComponent]; - NSString *dataURL = [message.body substringFromIndex:(range.location + 1)]; - range = [dataURL rangeOfString:@"data:"]; - if (range.location != 0) { - return; - } - NSString *tmp = [dataURL substringFromIndex:[@"data:" length]]; - range = [tmp rangeOfString:@";"]; - if (range.location == NSNotFound) { - return; - } - NSString *base64data = [tmp substringFromIndex:(range.location + 1 + [@"base64," length])]; - NSData *data = [[NSData alloc] initWithBase64EncodedString:base64data options:0]; - NSString *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0]; - path = [path stringByAppendingString:@"/Downloads"]; - BOOL isDir; - NSError *err = nil; - if ([[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDir]) { - if (!isDir) { - return; - } - } else { - [[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&err]; - if (err != nil) { - return; - } - } - NSString *prefix = [path stringByAppendingString:@"/"]; - path = [prefix stringByAppendingString:fileName]; - int count = 0; - while ([[NSFileManager defaultManager] fileExistsAtPath:path]) { - count++; - NSString *name = [fileName stringByDeletingPathExtension]; - NSString *ext = [fileName pathExtension]; - if (ext.length == 0) { - path = [NSString stringWithFormat:@"%@%@ (%d)", prefix, name, count]; - } else { - path = [NSString stringWithFormat:@"%@%@ (%d).%@", prefix, name, count, ext]; - } - } - [data writeToFile:path atomically:YES]; - } -} - -- (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView -{ - [self sendUnityCallback:"CallOnError" message:"webViewWebContentProcessDidTerminate"]; -} - -- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error -{ - [self sendUnityCallback:"CallOnError" message:[[error description] UTF8String]]; -} - -- (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error -{ - [self sendUnityCallback:"CallOnError" message:[[error description] UTF8String]]; -} - -- (WKWebView *)webView:(WKWebView *)wkWebView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures -{ - // cf. for target="_blank", cf. http://qiita.com/ShingoFukuyama/items/b3a1441025a36ab7659c - if (!navigationAction.targetFrame.isMainFrame) { - [wkWebView loadRequest:navigationAction.request]; - } - return nil; -} - -- (void)webView:(WKWebView *)wkWebView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler -{ - if (webView == nil) { - decisionHandler(WKNavigationActionPolicyCancel); - return; - } - NSURL *nsurl = [navigationAction.request URL]; - NSString *url = [nsurl absoluteString]; - - if ([url rangeOfString:@"//itunes.apple.com/"].location != NSNotFound) { - [[UIApplication sharedApplication] openURL:nsurl]; - decisionHandler(WKNavigationActionPolicyCancel); - return; - } else if ([url hasPrefix:@"unity:"]) { - [self sendUnityCallback:"CallFromJS" message:[[url substringFromIndex:6] UTF8String]]; - decisionHandler(WKNavigationActionPolicyCancel); - return; - } else if (![url hasPrefix:@"about:blank"] // for loadHTML(), cf. #365 - && ![url hasPrefix:@"file:"] - && ![url hasPrefix:@"http:"] - && ![url hasPrefix:@"https:"]) { - if([[UIApplication sharedApplication] canOpenURL:nsurl]) { - [[UIApplication sharedApplication] openURL:nsurl]; - } - decisionHandler(WKNavigationActionPolicyCancel); - return; - } else if (navigationAction.navigationType == WKNavigationTypeLinkActivated - && (!navigationAction.targetFrame || !navigationAction.targetFrame.isMainFrame)) { - // cf. for target="_blank", cf. http://qiita.com/ShingoFukuyama/items/b3a1441025a36ab7659c - [webView load:navigationAction.request]; - decisionHandler(WKNavigationActionPolicyCancel); - return; - } - [self sendUnityCallback:"CallOnStarted" message:[url UTF8String]]; - decisionHandler(WKNavigationActionPolicyAllow); -} - -- (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler { - - if ([navigationResponse.response isKindOfClass:[NSHTTPURLResponse class]]) { - - NSHTTPURLResponse * response = (NSHTTPURLResponse *)navigationResponse.response; - if (response.statusCode >= 400) { - [self sendUnityCallback:"CallOnHttpError" message:[[NSString stringWithFormat:@"%ld", (long)response.statusCode] UTF8String]]; - } - - } - decisionHandler(WKNavigationResponsePolicyAllow); -} - -- (void)sendUnityCallback:(const char *)key message:(const char *)message { - if (delegateCallback != nil) { - delegateCallback(key, message); - } else { - NSLog(@"delegateCallback is nil, message not sent."); - } -} - -- (void)loadURL:(const char *)url -{ - if (webView == nil) - return; - - WKWebView *_webView = (WKWebView *)webView; - NSString *urlStr = [NSString stringWithUTF8String:url]; - NSURL *nsurl = [[NSURL alloc] initFileURLWithPath:urlStr]; - NSURLRequest *request = [NSURLRequest requestWithURL:nsurl]; - [_webView load:request]; -} - -- (void)evaluateJS:(const char *)js -{ - if (webView == nil) - return; - NSString *jsStr = [NSString stringWithUTF8String:js]; - [webView evaluateJavaScript:jsStr completionHandler:^(NSString *result, NSError *error) {}]; -} - -- (void)launchAuthURL:(const char *)url -{ - NSURL *URL = [[NSURL alloc] initWithString: [NSString stringWithUTF8String:url]]; - NSString *scheme = NSBundle.mainBundle.bundleIdentifier; - - _authSession = [[ASWebAuthenticationSession alloc] initWithURL:URL callbackURLScheme:scheme completionHandler:^(NSURL * _Nullable callbackURL, NSError * _Nullable error) { - _authSession = nil; - - if (error != nil && error.code == 1) { - // Cancelled - [self sendUnityCallback:"CallFromAuthCallbackError" message: ""]; - } else if (error != nil) { - [self sendUnityCallback:"CallFromAuthCallbackError" message:error.localizedDescription.UTF8String]; - } else { - [self sendUnityCallback:"CallFromAuthCallback" message: callbackURL.absoluteString.UTF8String]; - } - }]; - - _authSession.presentationContextProvider = self; - [_authSession start]; -} - -- (ASPresentationAnchor)presentationAnchorForWebAuthenticationSession:(ASWebAuthenticationSession *)session -{ - return UIApplication.sharedApplication.windows.firstObject; -} - -- (void)clearCache:(BOOL)includeDiskFiles -{ - if (webView == nil) - return; - NSMutableSet *types = [NSMutableSet setWithArray:@[WKWebsiteDataTypeMemoryCache]]; - if (includeDiskFiles) { - [types addObject:WKWebsiteDataTypeDiskCache]; - } - NSDate *date = [NSDate dateWithTimeIntervalSince1970:0]; - [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:types modifiedSince:date completionHandler:^{}]; -} - -- (void)clearStorage -{ - if (webView == nil) - return; - NSMutableSet *types = [NSMutableSet setWithArray:@[WKWebsiteDataTypeLocalStorage, WKWebsiteDataTypeSessionStorage, WKWebsiteDataTypeWebSQLDatabases, WKWebsiteDataTypeIndexedDBDatabases]]; - NSDate *date = [NSDate dateWithTimeIntervalSince1970:0]; - [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:types modifiedSince:date completionHandler:^{}]; -} -@end - -extern "C" { - void *_CWebViewPlugin_Init(const char *ua); - void _CWebViewPlugin_Destroy(void *instance); - void _CWebViewPlugin_LoadURL(void *instance, const char *url); - void _CWebViewPlugin_EvaluateJS(void *instance, const char *url); - void _CWebViewPlugin_SetDelegate(DelegateCallbackFunction callback); - void _CWebViewPlugin_LaunchAuthURL(void *instance, const char *url); - void _CWebViewPlugin_ClearCache(void *instance, BOOL includeDiskFiles); - void _CWebViewPlugin_ClearStorage(void *instance); -} - -void _CWebViewPlugin_SetDelegate(DelegateCallbackFunction callback) { - delegateCallback = callback; -} - -void *_CWebViewPlugin_Init(const char *ua) -{ - CWebViewPlugin *webViewPlugin = [[CWebViewPlugin alloc] initWithUa:ua]; - [_instances addObject:webViewPlugin]; - return (__bridge_retained void *)webViewPlugin; -} - -void _CWebViewPlugin_Destroy(void *instance) -{ - if (instance == NULL) - return; - CWebViewPlugin *webViewPlugin = (__bridge_transfer CWebViewPlugin *)instance; - [_instances removeObject:webViewPlugin]; - [webViewPlugin dispose]; - webViewPlugin = nil; -} - -void _CWebViewPlugin_LoadURL(void *instance, const char *url) -{ - if (instance == NULL) - return; - CWebViewPlugin *webViewPlugin = (__bridge CWebViewPlugin *)instance; - [webViewPlugin loadURL:url]; -} - -void _CWebViewPlugin_EvaluateJS(void *instance, const char *js) -{ - if (instance == NULL) - return; - CWebViewPlugin *webViewPlugin = (__bridge CWebViewPlugin *)instance; - [webViewPlugin evaluateJS:js]; -} - -void _CWebViewPlugin_LaunchAuthURL(void *instance, const char *url) -{ - if (instance == NULL) - return; - CWebViewPlugin *webViewPlugin = (__bridge CWebViewPlugin *)instance; - [webViewPlugin launchAuthURL:url]; -} - -void _CWebViewPlugin_ClearCache(void *instance, BOOL includeDiskFiles) -{ - if (instance == NULL) - return; - CWebViewPlugin *webViewPlugin = (__bridge CWebViewPlugin *)instance; - [webViewPlugin clearCache:includeDiskFiles]; -} - -void _CWebViewPlugin_ClearStorage(void *instance) -{ - if (instance == NULL) - return; - CWebViewPlugin *webViewPlugin = (__bridge CWebViewPlugin *)instance; - [webViewPlugin clearStorage]; -} \ No newline at end of file diff --git a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/iOS/WebView.mm.meta b/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/iOS/WebView.mm.meta deleted file mode 100644 index 8b3eef39..00000000 --- a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/iOS/WebView.mm.meta +++ /dev/null @@ -1,37 +0,0 @@ -fileFormatVersion: 2 -guid: 051004c2b688d4d96bf675ba4035c324 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 1 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 0 - settings: - DefaultValueInitialized: true - - first: - iPhone: iOS - second: - enabled: 1 - settings: {} - - first: - tvOS: tvOS - second: - enabled: 1 - settings: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/src/Packages/Passport/Runtime/ThirdParty/Gree/unity-webview.asmdef b/src/Packages/Passport/Runtime/ThirdParty/Gree/unity-webview.asmdef deleted file mode 100644 index cc46948b..00000000 --- a/src/Packages/Passport/Runtime/ThirdParty/Gree/unity-webview.asmdef +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "unity-webview", - "rootNamespace": "", - "references": [ - "GUID:95d173a3e67b39d40803000ed05b79f4", - "GUID:a0996310e1aa34b7fbf14df5d255461d" - ], - "includePlatforms": [ - "Android", - "Editor", - "iOS", - "macOSStandalone" - ], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/src/Packages/Passport/Runtime/ThirdParty/Gree/unity-webview.asmdef.meta b/src/Packages/Passport/Runtime/ThirdParty/Gree/unity-webview.asmdef.meta deleted file mode 100644 index 6504773f..00000000 --- a/src/Packages/Passport/Runtime/ThirdParty/Gree/unity-webview.asmdef.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: cf4523fb89d3e174ba3399896ae70b6c -AssemblyDefinitionImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/src/Packages/Passport/Runtime/ThirdParty/ImmutableBrowserCore/GameBridge.cs b/src/Packages/Passport/Runtime/ThirdParty/ImmutableBrowserCore/GameBridge.cs index 156828b9..77b22bdc 100644 --- a/src/Packages/Passport/Runtime/ThirdParty/ImmutableBrowserCore/GameBridge.cs +++ b/src/Packages/Passport/Runtime/ThirdParty/ImmutableBrowserCore/GameBridge.cs @@ -11,6 +11,7 @@ public static class GameBridge private const string PASSPORT_PACKAGE_RESOURCES_DIRECTORY = "Packages/com.immutable.passport/Runtime/Resources"; private const string ANDROID_DATA_DIRECTORY = "android_asset"; private const string MAC_DATA_DIRECTORY = "/Resources/Data"; + private const string WEBGL_DIRECTORY = "/Passport"; private const string MAC_EDITOR_RESOURCES_DIRECTORY = "Packages/com.immutable.passport/Runtime/Resources"; public static string GetFilePath() @@ -32,6 +33,9 @@ public static string GetFilePath() #elif UNITY_EDITOR_WIN // Windows editor filePath = SCHEME_FILE + Path.GetFullPath($"{PASSPORT_PACKAGE_RESOURCES_DIRECTORY}{PASSPORT_HTML_FILE_NAME}"); +#elif UNITY_WEBGL && !UNITY_EDITOR + // WebGL + filePath = WEBGL_DIRECTORY + PASSPORT_HTML_FILE_NAME; #else filePath = SCHEME_FILE + Path.GetFullPath(Application.dataPath) + PASSPORT_DATA_DIRECTORY_NAME + PASSPORT_HTML_FILE_NAME; #endif diff --git a/src/Packages/Passport/Runtime/ThirdParty/ImmutableBrowserCore/IWebBrowserClient.cs b/src/Packages/Passport/Runtime/ThirdParty/ImmutableBrowserCore/IWebBrowserClient.cs index e6583b5b..537e187a 100644 --- a/src/Packages/Passport/Runtime/ThirdParty/ImmutableBrowserCore/IWebBrowserClient.cs +++ b/src/Packages/Passport/Runtime/ThirdParty/ImmutableBrowserCore/IWebBrowserClient.cs @@ -5,7 +5,7 @@ public interface IWebBrowserClient event OnUnityPostMessageDelegate OnUnityPostMessage; // Required for Gree browser only -#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX +#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX || UNITY_WEBGL event OnUnityPostMessageDelegate OnAuthPostMessage; event OnUnityPostMessageErrorDelegate OnPostMessageError; #endif diff --git a/src/Packages/Passport/Runtime/ThirdParty/ImmutableBrowserCore/IWindowsWebBrowserClient.cs b/src/Packages/Passport/Runtime/ThirdParty/ImmutableBrowserCore/IWindowsWebBrowserClient.cs index 84431cc5..d394e535 100644 --- a/src/Packages/Passport/Runtime/ThirdParty/ImmutableBrowserCore/IWindowsWebBrowserClient.cs +++ b/src/Packages/Passport/Runtime/ThirdParty/ImmutableBrowserCore/IWindowsWebBrowserClient.cs @@ -1,4 +1,4 @@ -#if UNITY_STANDALONE_WIN || (UNITY_ANDROID && UNITY_EDITOR_WIN) || (UNITY_IPHONE && UNITY_EDITOR_WIN) +#if UNITY_STANDALONE_WIN || (UNITY_ANDROID && UNITY_EDITOR_WIN) || (UNITY_IPHONE && UNITY_EDITOR_WIN) || UNITY_WEBGL using System.IO; using UnityEngine; diff --git a/src/Packages/Passport/Runtime/ThirdParty/UnityWebBrowser.Engine.Cef.Win-x64/Engine/swiftshader.meta b/src/Packages/Passport/Runtime/ThirdParty/UnityWebBrowser.Engine.Cef.Win-x64/Engine/swiftshader.meta deleted file mode 100644 index 6442a680..00000000 --- a/src/Packages/Passport/Runtime/ThirdParty/UnityWebBrowser.Engine.Cef.Win-x64/Engine/swiftshader.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: da2a4d603bb268d4299d3bbff15744a3 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/src/Packages/Passport/package.json b/src/Packages/Passport/package.json index 70587a88..cbdac990 100644 --- a/src/Packages/Passport/package.json +++ b/src/Packages/Passport/package.json @@ -1,6 +1,6 @@ { "name": "com.immutable.passport", - "version": "1.25.2", + "version": "1.26.0", "description": "The Immutable SDK for Unity helps you integrate your game with Immutable Passport.", "displayName": "Immutable Passport", "author": {