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/Plugins/Mac/WebView.xcodeproj/project.pbxproj b/Plugins/Mac/ImmutableWebView.xcodeproj/project.pbxproj similarity index 89% rename from Plugins/Mac/WebView.xcodeproj/project.pbxproj rename to Plugins/Mac/ImmutableWebView.xcodeproj/project.pbxproj index 62c5f4aa..58e1dd71 100644 --- a/Plugins/Mac/WebView.xcodeproj/project.pbxproj +++ b/Plugins/Mac/ImmutableWebView.xcodeproj/project.pbxproj @@ -12,7 +12,7 @@ 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 */; }; + 81F4B4D914C6888B001B4465 /* ImmutableWebView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 81F4B4D814C6888B001B4465 /* ImmutableWebView.mm */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -23,11 +23,11 @@ 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; }; + 81E2C20814C5684A004CE5C2 /* ImmutableWebView.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ImmutableWebView.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 = ""; }; + 81F4B4D814C6888B001B4465 /* ImmutableWebView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ImmutableWebView.mm; path = Sources/ImmutableWebView.mm; sourceTree = ""; }; 81F81AEC14D76D2400845D4C /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ @@ -49,7 +49,7 @@ 8102525914C573EB0022296D /* Sources */ = { isa = PBXGroup; children = ( - 81F4B4D814C6888B001B4465 /* WebView.mm */, + 81F4B4D814C6888B001B4465 /* ImmutableWebView.mm */, ); name = Sources; sourceTree = ""; @@ -67,7 +67,7 @@ 81E2C20914C5684A004CE5C2 /* Products */ = { isa = PBXGroup; children = ( - 81E2C20814C5684A004CE5C2 /* WebView.bundle */, + 81E2C20814C5684A004CE5C2 /* ImmutableWebView.bundle */, ); name = Products; sourceTree = ""; @@ -101,9 +101,9 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 81E2C20714C5684A004CE5C2 /* WebView */ = { + 81E2C20714C5684A004CE5C2 /* ImmutableWebView */ = { isa = PBXNativeTarget; - buildConfigurationList = 81E2C21A14C5684A004CE5C2 /* Build configuration list for PBXNativeTarget "WebView" */; + buildConfigurationList = 81E2C21A14C5684A004CE5C2 /* Build configuration list for PBXNativeTarget "ImmutableWebView" */; buildPhases = ( 81E2C20414C5684A004CE5C2 /* Sources */, 81E2C20514C5684A004CE5C2 /* Frameworks */, @@ -113,9 +113,9 @@ ); dependencies = ( ); - name = WebView; + name = ImmutableWebView; productName = WebView; - productReference = 81E2C20814C5684A004CE5C2 /* WebView.bundle */; + productReference = 81E2C20814C5684A004CE5C2 /* ImmutableWebView.bundle */; productType = "com.apple.product-type.bundle"; }; /* End PBXNativeTarget section */ @@ -127,7 +127,7 @@ BuildIndependentTargetsInParallel = YES; LastUpgradeCheck = 1200; }; - buildConfigurationList = 81E2C20214C5684A004CE5C2 /* Build configuration list for PBXProject "WebView" */; + buildConfigurationList = 81E2C20214C5684A004CE5C2 /* Build configuration list for PBXProject "ImmutableWebView" */; compatibilityVersion = "Xcode 8.0"; developmentRegion = en; hasScannedForEncodings = 0; @@ -140,7 +140,7 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 81E2C20714C5684A004CE5C2 /* WebView */, + 81E2C20714C5684A004CE5C2 /* ImmutableWebView */, ); }; /* End PBXProject section */ @@ -161,7 +161,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 81F4B4D914C6888B001B4465 /* WebView.mm in Sources */, + 81F4B4D914C6888B001B4465 /* ImmutableWebView.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -280,7 +280,8 @@ LD_RUNPATH_SEARCH_PATHS = ""; LIBRARY_SEARCH_PATHS = "$(inherited)"; MACOSX_DEPLOYMENT_TARGET = 12.4; - PRODUCT_BUNDLE_IDENTIFIER = "net.gree.unitywebview.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_BUNDLE_IDENTIFIER = "Immutable.Browser.--PRODUCT-NAME-rfc1034identifier-"; + "PRODUCT_BUNDLE_IDENTIFIER[sdk=macosx*]" = Immutable.Browser.WebView; PRODUCT_NAME = "$(TARGET_NAME)"; USE_HEADERMAP = YES; WRAPPER_EXTENSION = bundle; @@ -301,7 +302,8 @@ LD_RUNPATH_SEARCH_PATHS = ""; LIBRARY_SEARCH_PATHS = "$(inherited)"; MACOSX_DEPLOYMENT_TARGET = 12.4; - PRODUCT_BUNDLE_IDENTIFIER = "net.gree.unitywebview.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_BUNDLE_IDENTIFIER = "Immutable.Browser.--PRODUCT-NAME-rfc1034identifier-"; + "PRODUCT_BUNDLE_IDENTIFIER[sdk=macosx*]" = Immutable.Browser.WebView; PRODUCT_NAME = "$(TARGET_NAME)"; USE_HEADERMAP = YES; WRAPPER_EXTENSION = bundle; @@ -311,7 +313,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 81E2C20214C5684A004CE5C2 /* Build configuration list for PBXProject "WebView" */ = { + 81E2C20214C5684A004CE5C2 /* Build configuration list for PBXProject "ImmutableWebView" */ = { isa = XCConfigurationList; buildConfigurations = ( 81E2C21814C5684A004CE5C2 /* Debug */, @@ -320,7 +322,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 81E2C21A14C5684A004CE5C2 /* Build configuration list for PBXNativeTarget "WebView" */ = { + 81E2C21A14C5684A004CE5C2 /* Build configuration list for PBXNativeTarget "ImmutableWebView" */ = { isa = XCConfigurationList; buildConfigurations = ( 81E2C21B14C5684A004CE5C2 /* Debug */, diff --git a/Plugins/Mac/WebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Plugins/Mac/ImmutableWebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from Plugins/Mac/WebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to Plugins/Mac/ImmutableWebView.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/Plugins/Mac/WebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Plugins/Mac/ImmutableWebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from Plugins/Mac/WebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to Plugins/Mac/ImmutableWebView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Plugins/Mac/Sources/WebView.mm b/Plugins/Mac/Sources/ImmutableWebView.mm similarity index 94% rename from Plugins/Mac/Sources/WebView.mm rename to Plugins/Mac/Sources/ImmutableWebView.mm index 300168a7..c9c39e0c 100644 --- a/Plugins/Mac/Sources/WebView.mm +++ b/Plugins/Mac/Sources/ImmutableWebView.mm @@ -374,26 +374,26 @@ - (nonnull ASPresentationAnchor)presentationAnchorForWebAuthenticationSession:(n @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 *_CImmutableWebViewPlugin_Init(const char *ua); +void _CImmutableWebViewPlugin_Destroy(void *instance); +void _CImmutableWebViewPlugin_LoadURL(void *instance, const char *url); +void _CImmutableWebViewPlugin_EvaluateJS(void *instance, const char *url); +void _CImmutableWebViewPlugin_SetDelegate(DelegateCallbackFunction callback); +void _CImmutableWebViewPlugin_LaunchAuthURL(void *instance, const char *url, const char *redirectUri); } -void _CWebViewPlugin_SetDelegate(DelegateCallbackFunction callback) { +void _CImmutableWebViewPlugin_SetDelegate(DelegateCallbackFunction callback) { delegateCallback = callback; } -void *_CWebViewPlugin_Init(const char *ua) +void *_CImmutableWebViewPlugin_Init(const char *ua) { CWebViewPlugin *webViewPlugin = [[CWebViewPlugin alloc] initWithUa:ua]; [_instances addObject:webViewPlugin]; return (__bridge_retained void *)webViewPlugin; } -void _CWebViewPlugin_Destroy(void *instance) +void _CImmutableWebViewPlugin_Destroy(void *instance) { if (instance == NULL) return; @@ -403,7 +403,7 @@ void _CWebViewPlugin_Destroy(void *instance) webViewPlugin = nil; } -void _CWebViewPlugin_LoadURL(void *instance, const char *url) +void _CImmutableWebViewPlugin_LoadURL(void *instance, const char *url) { if (instance == NULL) return; @@ -411,7 +411,7 @@ void _CWebViewPlugin_LoadURL(void *instance, const char *url) [webViewPlugin loadURL:url]; } -void _CWebViewPlugin_EvaluateJS(void *instance, const char *js) +void _CImmutableWebViewPlugin_EvaluateJS(void *instance, const char *js) { if (instance == NULL) return; @@ -419,7 +419,7 @@ void _CWebViewPlugin_EvaluateJS(void *instance, const char *js) [webViewPlugin evaluateJS:js]; } -void _CWebViewPlugin_LaunchAuthURL(void *instance, const char *url, const char *redirectUri) +void _CImmutableWebViewPlugin_LaunchAuthURL(void *instance, const char *url, const char *redirectUri) { if (instance == NULL) return; 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/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..c686db84 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": [ 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..3571bee6 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" ], diff --git a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle.meta b/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/ImmutableWebView.bundle.meta similarity index 100% rename from src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle.meta rename to src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/ImmutableWebView.bundle.meta 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/ImmutableWebView.bundle/Contents/Info.plist similarity index 78% rename from src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle/Contents/Info.plist rename to src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/ImmutableWebView.bundle/Contents/Info.plist index 6c26a9f4..b53c3f00 100644 --- a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle/Contents/Info.plist +++ b/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/ImmutableWebView.bundle/Contents/Info.plist @@ -3,17 +3,17 @@ BuildMachineOSBuild - 23B81 + 23G93 CFBundleDevelopmentRegion English CFBundleExecutable - WebView + ImmutableWebView CFBundleIdentifier - net.gree.unitywebview.WebView + Immutable.Browser.WebView CFBundleInfoDictionaryVersion 6.0 CFBundleName - WebView + ImmutableWebView CFBundlePackageType BNDL CFBundleShortVersionString @@ -29,19 +29,19 @@ DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - + 24A336 DTPlatformName macosx DTPlatformVersion - 14.0 + 15.0 DTSDKBuild - 23A334 + 24A336 DTSDKName - macosx14.0 + macosx15.0 DTXcode - 1501 + 1600 DTXcodeBuild - 15A507 + 16A242d 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/ImmutableWebView.bundle/Contents/MacOS/ImmutableWebView similarity index 58% rename from src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle/Contents/MacOS/WebView rename to src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/ImmutableWebView.bundle/Contents/MacOS/ImmutableWebView index ce554fbb..69570514 100755 Binary files a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle/Contents/MacOS/WebView and b/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/ImmutableWebView.bundle/Contents/MacOS/ImmutableWebView 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/ImmutableWebView.bundle/Contents/Resources/InfoPlist.strings similarity index 100% rename from src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle/Contents/Resources/InfoPlist.strings rename to src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/ImmutableWebView.bundle/Contents/Resources/InfoPlist.strings 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/ImmutableWebView.bundle/Contents/_CodeSignature/CodeResources similarity index 100% rename from src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle/Contents/_CodeSignature/CodeResources rename to src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/ImmutableWebView.bundle/Contents/_CodeSignature/CodeResources 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..20c115bf 100644 --- a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebViewObject.cs +++ b/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebViewObject.cs @@ -94,38 +94,38 @@ 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(); @@ -238,13 +238,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); @@ -269,7 +269,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; @@ -290,7 +290,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 +303,11 @@ 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); #else UnityEngine.Application.OpenURL(url); #endif @@ -365,7 +365,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 +380,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/ImmutableWebView.mm similarity index 86% rename from src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/iOS/WebView.mm rename to src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/iOS/ImmutableWebView.mm index 5e90df3f..df22cde1 100644 --- a/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/iOS/WebView.mm +++ b/src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/iOS/ImmutableWebView.mm @@ -31,7 +31,7 @@ DelegateCallbackFunction delegateCallback = NULL; // cf. https://stackoverflow.com/questions/26383031/wkwebview-causes-my-view-controller-to-leak/33365424#33365424 -@interface WeakScriptMessageDelegate : NSObject +@interface ImmutableWeakScriptMessageDelegate : NSObject @property (nonatomic, weak) id scriptDelegate; @@ -39,7 +39,7 @@ - (instancetype)initWithDelegate:(id)scriptDelegate; @end -@implementation WeakScriptMessageDelegate +@implementation ImmutableWeakScriptMessageDelegate - (instancetype)initWithDelegate:(id)scriptDelegate { @@ -87,17 +87,17 @@ - (void)load:(NSURLRequest *)request } @end -@interface CWebViewPlugin : NSObject +@interface CImmutableWebViewPlugin : NSObject { WKWebView *webView; } @end -@implementation CWebViewPlugin +@implementation CImmutableWebViewPlugin static WKProcessPool *_sharedProcessPool; static NSMutableArray *_instances = [[NSMutableArray alloc] init]; -static CWebViewPlugin *__delegate = nil; +static CImmutableWebViewPlugin *__delegate = nil; static ASWebAuthenticationSession *_authSession; - (id)initWithUa:(const char *)ua @@ -110,9 +110,9 @@ - (id)initWithUa:(const char *)ua 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"]; + [controller addScriptMessageHandler:[[ImmutableWeakScriptMessageDelegate alloc] initWithDelegate:self] name:@"unityControl"]; + [controller addScriptMessageHandler:[[ImmutableWeakScriptMessageDelegate alloc] initWithDelegate:self] name:@"saveDataURL"]; + [controller addScriptMessageHandler:[[ImmutableWeakScriptMessageDelegate alloc] initWithDelegate:self] name:@"logHandler"]; NSString *str = @"\ window.Unity = { \ call: function(msg) { \ @@ -185,7 +185,7 @@ + (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) { + [_instances enumerateObjectsUsingBlock:^(CImmutableWebViewPlugin *obj, NSUInteger idx, BOOL *stop) { if ([obj->webView isKindOfClass:[WKWebView class]]) { WKWebView *webView = (WKWebView *)obj->webView; webView.configuration.processPool = _sharedProcessPool; @@ -401,73 +401,73 @@ - (void)clearStorage @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 *_CImmutableWebViewPlugin_Init(const char *ua); + void _CImmutableWebViewPlugin_Destroy(void *instance); + void _CImmutableWebViewPlugin_LoadURL(void *instance, const char *url); + void _CImmutableWebViewPlugin_EvaluateJS(void *instance, const char *url); + void _CImmutableWebViewPlugin_SetDelegate(DelegateCallbackFunction callback); + void _CImmutableWebViewPlugin_LaunchAuthURL(void *instance, const char *url); + void _CImmutableWebViewPlugin_ClearCache(void *instance, BOOL includeDiskFiles); + void _CImmutableWebViewPlugin_ClearStorage(void *instance); } -void _CWebViewPlugin_SetDelegate(DelegateCallbackFunction callback) { +void _CImmutableWebViewPlugin_SetDelegate(DelegateCallbackFunction callback) { delegateCallback = callback; } -void *_CWebViewPlugin_Init(const char *ua) +void *_CImmutableWebViewPlugin_Init(const char *ua) { - CWebViewPlugin *webViewPlugin = [[CWebViewPlugin alloc] initWithUa:ua]; + CImmutableWebViewPlugin *webViewPlugin = [[CImmutableWebViewPlugin alloc] initWithUa:ua]; [_instances addObject:webViewPlugin]; return (__bridge_retained void *)webViewPlugin; } -void _CWebViewPlugin_Destroy(void *instance) +void _CImmutableWebViewPlugin_Destroy(void *instance) { if (instance == NULL) return; - CWebViewPlugin *webViewPlugin = (__bridge_transfer CWebViewPlugin *)instance; + CImmutableWebViewPlugin *webViewPlugin = (__bridge_transfer CImmutableWebViewPlugin *)instance; [_instances removeObject:webViewPlugin]; [webViewPlugin dispose]; webViewPlugin = nil; } -void _CWebViewPlugin_LoadURL(void *instance, const char *url) +void _CImmutableWebViewPlugin_LoadURL(void *instance, const char *url) { if (instance == NULL) return; - CWebViewPlugin *webViewPlugin = (__bridge CWebViewPlugin *)instance; + CImmutableWebViewPlugin *webViewPlugin = (__bridge CImmutableWebViewPlugin *)instance; [webViewPlugin loadURL:url]; } -void _CWebViewPlugin_EvaluateJS(void *instance, const char *js) +void _CImmutableWebViewPlugin_EvaluateJS(void *instance, const char *js) { if (instance == NULL) return; - CWebViewPlugin *webViewPlugin = (__bridge CWebViewPlugin *)instance; + CImmutableWebViewPlugin *webViewPlugin = (__bridge CImmutableWebViewPlugin *)instance; [webViewPlugin evaluateJS:js]; } -void _CWebViewPlugin_LaunchAuthURL(void *instance, const char *url) +void _CImmutableWebViewPlugin_LaunchAuthURL(void *instance, const char *url) { if (instance == NULL) return; - CWebViewPlugin *webViewPlugin = (__bridge CWebViewPlugin *)instance; + CImmutableWebViewPlugin *webViewPlugin = (__bridge CImmutableWebViewPlugin *)instance; [webViewPlugin launchAuthURL:url]; } -void _CWebViewPlugin_ClearCache(void *instance, BOOL includeDiskFiles) +void _CImmutableWebViewPlugin_ClearCache(void *instance, BOOL includeDiskFiles) { if (instance == NULL) return; - CWebViewPlugin *webViewPlugin = (__bridge CWebViewPlugin *)instance; + CImmutableWebViewPlugin *webViewPlugin = (__bridge CImmutableWebViewPlugin *)instance; [webViewPlugin clearCache:includeDiskFiles]; } -void _CWebViewPlugin_ClearStorage(void *instance) +void _CImmutableWebViewPlugin_ClearStorage(void *instance) { if (instance == NULL) return; - CWebViewPlugin *webViewPlugin = (__bridge CWebViewPlugin *)instance; + CImmutableWebViewPlugin *webViewPlugin = (__bridge CImmutableWebViewPlugin *)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/ImmutableWebView.mm.meta similarity index 100% rename from src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/iOS/WebView.mm.meta rename to src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/iOS/ImmutableWebView.mm.meta diff --git a/src/Packages/Passport/Runtime/ThirdParty/Gree/unity-webview.asmdef b/src/Packages/Passport/Runtime/ThirdParty/Gree/ImmutableWebView.asmdef similarity index 84% rename from src/Packages/Passport/Runtime/ThirdParty/Gree/unity-webview.asmdef rename to src/Packages/Passport/Runtime/ThirdParty/Gree/ImmutableWebView.asmdef index cc46948b..fa0dcb48 100644 --- a/src/Packages/Passport/Runtime/ThirdParty/Gree/unity-webview.asmdef +++ b/src/Packages/Passport/Runtime/ThirdParty/Gree/ImmutableWebView.asmdef @@ -1,6 +1,6 @@ { - "name": "unity-webview", - "rootNamespace": "", + "name": "Immutable.Browser.Gree", + "rootNamespace": "Immutable.Browser.Gree", "references": [ "GUID:95d173a3e67b39d40803000ed05b79f4", "GUID:a0996310e1aa34b7fbf14df5d255461d" diff --git a/src/Packages/Passport/Runtime/ThirdParty/Gree/unity-webview.asmdef.meta b/src/Packages/Passport/Runtime/ThirdParty/Gree/ImmutableWebView.asmdef.meta similarity index 100% rename from src/Packages/Passport/Runtime/ThirdParty/Gree/unity-webview.asmdef.meta rename to src/Packages/Passport/Runtime/ThirdParty/Gree/ImmutableWebView.asmdef.meta