Skip to content

Commit

Permalink
feat: Add iframe events support to the webview (#35)
Browse files Browse the repository at this point in the history
<!-- Copy the TICKETID for this task from Jira and add it to the PR name
in brackets -->
<!-- PR name should look like: [TICKETID] My Pull Request -->

<!-- Add link for the ticket here editing the TICKETID-->

## [SDK-517](https://ready-player-me.atlassian.net/browse/SDK-517)

## Description

-   Briefly describe what this change will do

<!-- Fill the section below with Added, Updated and Removed information.
-->
<!-- If there is no item under one of the lists remove it's title. -->

## 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 <[email protected]>
  • Loading branch information
rk132 and Raigo Kõvask authored Feb 1, 2024
1 parent 18a9345 commit 8ae0494
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 8ae0494

Please sign in to comment.