From 18a9345432dac6a55f285927497e1c2ef79ad3eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raigo=20K=C3=B5vask?= <107070960+rk132@users.noreply.github.com> Date: Wed, 24 Jan 2024 09:43:50 +0200 Subject: [PATCH 1/4] feat: update install description (#33) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## [SDK-744](https://ready-player-me.atlassian.net/browse/SDK-744) ## Description - Update description for installation, that the package is no longer installed automatically ## Changes #### Updated - Updated readme [SDK-744]: https://ready-player-me.atlassian.net/browse/SDK-744?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ Co-authored-by: Raigo Kõvask --- HOW_TO_INSTALL.md | 40 ++++++++++++++++++++++++++++++++++++++++ HOW_TO_INSTALL.md.meta | 7 +++++++ README.md | 5 +++-- 3 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 HOW_TO_INSTALL.md create mode 100644 HOW_TO_INSTALL.md.meta diff --git a/HOW_TO_INSTALL.md b/HOW_TO_INSTALL.md new file mode 100644 index 0000000..56242ae --- /dev/null +++ b/HOW_TO_INSTALL.md @@ -0,0 +1,40 @@ +# Quick Start + +### Requirements +- Unity Version 2020.3 or higher +- [Git](https://git-scm.com) needs to be installed to fetch the Unity package. [Download here](https://git-scm.com/downloads) + +**1.** To add the new Ready Player Me Unity Webview to your project you can use the Unity Package Manager to import the package directly from the Git URL. + +**2.** With your Unity Project open, open up the Package Manager window by going to `Window > Package Manager`. + +![open-package-manager](https://user-images.githubusercontent.com/7085672/206432665-da233187-06ad-40b5-a25e-660c97d6726f.png) + +**3.** In the **Package Manager** window click on the + icon in the top left corner and select Add Package From Git URL. + +![add-package-from-ur;](https://user-images.githubusercontent.com/7085672/206432698-8ecde741-4259-486f-9c77-d63fbc9a6cde.png) + +**4.** Paste in this url + +`https://github.com/readyplayerme/rpm-unity-sdk-webview.git` + +![paste-git-url](https://user-images.githubusercontent.com/7085672/206432731-f9e0d161-7843-4d6e-8851-47b1f3bfb3bc.png) + +**5.** Click add and wait for the import process to finish. + +After the process is complete you project will have imported these packages: + +- **Ready Player Me WebView** + +![image](https://github.com/readyplayerme/rpm-unity-sdk-webview/assets/107070960/0bb85ced-2b32-462e-bdee-b53a84f31a9d) + +## Alternate Installation + +### Using Git URL + +1. Navigate to your project's Packages folder and open the manifest.json file. +2. Add this line below the `"dependencies": {` line + - ```json title="Packages/manifest.json" + "com.readyplayerme.core": "https://github.com/readyplayerme/rpm-unity-sdk-webview.git", + ``` +3. UPM should now install the package. diff --git a/HOW_TO_INSTALL.md.meta b/HOW_TO_INSTALL.md.meta new file mode 100644 index 0000000..31f97c5 --- /dev/null +++ b/HOW_TO_INSTALL.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c54388e703da4794dadeaa4a744ba971 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/README.md b/README.md index 413973d..0518c9f 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,10 @@ Please visit the online documentation and join our public `discord` community. ## How to install -The WebView module is managed and installed automatically with the [Unity Core](https://github.com/readyplayerme/Unity-Core) module. +Ready Player me Webview module requires, that you have core package installed. Please refer to the **[Quick Start guide]( https://github.com/readyplayerme/Unity-Core#readme )** for instructions on how to install the Unity Core module. +The installation steps for the Webview module can be found **[here.](HOW_TO_INSTALL.md)** Users can create Ready Player Me avatars seamlessly in a WebView displayed within a Unity application. @@ -109,4 +110,4 @@ As such the following classes are now located in the Ready Player Me Core module - WebViewEvents If you have any scripts in your Unity project that reference these classes you will need to update the namespace to use ReadyPlayerMe.Core instead of ReadyPlayerMe.WebView, be sure to update the import statements in these scripts. -EG: `using ReadyPlayerMe.WebView;` should be changed to `using ReadyPlayerMe.Core;` \ No newline at end of file +EG: `using ReadyPlayerMe.WebView;` should be changed to `using ReadyPlayerMe.Core;` From 8ae04940af9d958d98301da697575e7382e82d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raigo=20K=C3=B5vask?= <107070960+rk132@users.noreply.github.com> Date: Thu, 1 Feb 2024 11:13:47 +0200 Subject: [PATCH 2/4] feat: Add iframe events support to the webview (#35) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## [SDK-517](https://ready-player-me.atlassian.net/browse/SDK-517) ## Description - Briefly describe what this change will do ## Changes #### Added - Add user logout and user updated events support [SDK-517]: https://ready-player-me.atlassian.net/browse/SDK-517?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ Co-authored-by: Raigo Kõvask --- Runtime/WebViewPanel.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Runtime/WebViewPanel.cs b/Runtime/WebViewPanel.cs index 13f5da6..1665df4 100644 --- a/Runtime/WebViewPanel.cs +++ b/Runtime/WebViewPanel.cs @@ -3,6 +3,7 @@ using ReadyPlayerMe.Core; using ReadyPlayerMe.Core.WebView; using UnityEngine; +using UnityEngine.Events; namespace ReadyPlayerMe.WebView { @@ -23,6 +24,8 @@ public class WebViewPanel : MonoBehaviour [SerializeField] public WebViewEvent OnUserSet = new WebViewEvent(); [SerializeField] public WebViewEvent OnUserAuthorized = new WebViewEvent(); [SerializeField] public AssetUnlockEvent OnAssetUnlock = new AssetUnlockEvent(); + [SerializeField] public UnityEvent OnUserLogout = new UnityEvent(); + [SerializeField] public WebViewEvent OnUserUpdate = new WebViewEvent(); private WebViewBase webViewObject = null; @@ -155,6 +158,12 @@ private void HandleEvents(WebMessage webMessage) case WebViewEvents.USER_AUTHORIZED: OnUserAuthorized?.Invoke(webMessage.GetUserId()); break; + case WebViewEvents.USER_LOGOUT: + OnUserLogout?.Invoke(); + break; + case WebViewEvents.USER_UPDATED: + OnUserUpdate?.Invoke(webMessage.GetUserId()); + break; } } From 7da2c6018d78d16c47bbd5162ac1df3f53ffb4cc Mon Sep 17 00:00:00 2001 From: Harrison Hough Date: Thu, 25 Apr 2024 06:45:30 +0300 Subject: [PATCH 3/4] [SDK-908] Feature/webview fix (#37) - ios build processor now correctly adds WebKit framework dependency --- Editor/IOSBuildProcessor.cs | 65 ++++++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 16 deletions(-) diff --git a/Editor/IOSBuildProcessor.cs b/Editor/IOSBuildProcessor.cs index 1143c18..c847d5d 100644 --- a/Editor/IOSBuildProcessor.cs +++ b/Editor/IOSBuildProcessor.cs @@ -1,30 +1,63 @@ #if UNITY_IOS +using System; using System.IO; +using UnityEditor.Callbacks; using UnityEditor; -using UnityEditor.Build; -using UnityEditor.Build.Reporting; -using UnityEditor.iOS.Xcode; +using UnityEngine; namespace ReadyPlayerMe.WebView.Editor { - public class IOSBuildProcessor : IPostprocessBuildWithReport + public class IOSBuildProcessor { - public int callbackOrder => 0; - public void OnPostprocessBuild(BuildReport report) + [PostProcessBuild(100)] + public static void OnPostprocessBuild(BuildTarget buildTarget, string path) { - if (report.summary.platform != BuildTarget.iOS) return; + if (buildTarget != BuildTarget.iOS) return; - var projectPath = $"{report.summary.outputPath}/Unity-iPhone.xcodeproj/project.pbxproj"; + var projPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj"; + var type = Type.GetType("UnityEditor.iOS.Xcode.PBXProject, UnityEditor.iOS.Extensions.Xcode"); + if (type == null) + { + Debug.LogError("unitywebview: failed to get PBXProject. please install iOS build support."); + return; + } + var src = File.ReadAllText(projPath); + var proj = type.GetConstructor(Type.EmptyTypes).Invoke(null); + { + var method = type.GetMethod("ReadFromString"); + method.Invoke(proj, new object[] { src }); + } + var target = ""; + { + var method = type.GetMethod("GetUnityFrameworkTargetGuid"); + target = (string) method.Invoke(proj, null); + } - var pbxProject = new PBXProject(); - pbxProject.ReadFromFile(projectPath); - - // Main - var targetGuid = pbxProject.GetUnityMainTargetGuid(); - pbxProject.AddFrameworkToProject(targetGuid, "WebKit.framework", false); - - pbxProject.WriteToFile(projectPath); + { + var method = type.GetMethod("AddFrameworkToProject"); + method.Invoke(proj, new object[] { target, "WebKit.framework", false }); + } + var cflags = ""; + if (EditorUserBuildSettings.development) + { + cflags += " -DUNITYWEBVIEW_DEVELOPMENT"; + } +#if UNITYWEBVIEW_IOS_ALLOW_FILE_URLS + cflags += " -DUNITYWEBVIEW_IOS_ALLOW_FILE_URLS"; +#endif + cflags = cflags.Trim(); + if (!string.IsNullOrEmpty(cflags)) + { + var method = type.GetMethod("AddBuildProperty", new Type[] { typeof(string), typeof(string), typeof(string) }); + method.Invoke(proj, new object[] { target, "OTHER_CFLAGS", cflags }); + } + var dst = ""; + { + var method = type.GetMethod("WriteToString"); + dst = (string) method.Invoke(proj, null); + } + File.WriteAllText(projPath, dst); } } } From 248c11ad453db2cad00a19ab5d43b43000920260 Mon Sep 17 00:00:00 2001 From: Harrison Hough Date: Thu, 25 Apr 2024 08:58:14 +0300 Subject: [PATCH 4/4] chore update version --- .github/latest.md | 3 ++- CHANGELOG.md | 5 +++++ package.json | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/latest.md b/.github/latest.md index d6b9498..062d3c1 100644 --- a/.github/latest.md +++ b/.github/latest.md @@ -1,4 +1,5 @@ ## Changelog -- update install description +### Fixed +- update IOS build processor to include WebKit framework in [#37](https://github.com/readyplayerme/rpm-unity-sdk-webview/pull/37) diff --git a/CHANGELOG.md b/CHANGELOG.md index 171af9b..05bff7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [2.2.1] - 2024.25.04 + +### Fixed +- feat: update install description by @rk132 in [#37](https://github.com/readyplayerme/rpm-unity-sdk-webview/pull/37) + ## [2.2.0] - 2024.24.01 ### Updated diff --git a/package.json b/package.json index bb01939..c4b48d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.readyplayerme.webview", - "version": "2.2.0", + "version": "2.2.1", "displayName": "Ready Player Me WebView", "description": "Ready Player Me WebView helps you display an in-engine browser that helps you load RPM website where you can create avatars and receive avatar URL at the end of the process.\nWebView is mobile only and works in Android and IOS builds.", "category": "tool",