Skip to content

Commit

Permalink
feat: Add iframe events support to the webview
Browse files Browse the repository at this point in the history
  • Loading branch information
Raigo Kõvask committed Jan 31, 2024
1 parent 18a9345 commit a5d8567
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Runtime/WebViewPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using ReadyPlayerMe.Core;
using ReadyPlayerMe.Core.WebView;
using UnityEngine;
using UnityEngine.Events;

namespace ReadyPlayerMe.WebView
{
Expand All @@ -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;

Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit a5d8567

Please sign in to comment.