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] 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; } }