-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathUnauthenticatedSceneManager.cs
More file actions
34 lines (30 loc) · 1 KB
/
Copy pathUnauthenticatedSceneManager.cs
File metadata and controls
34 lines (30 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using UnityEngine;
using UnityEngine.UI;
using Cysharp.Threading.Tasks;
using Immutable.Passport;
using System;
public class UnauthenticatedSceneManager : MonoBehaviour
{
[SerializeField] private GameObject LoginButtons;
[SerializeField] private GameObject ReloginButtons;
[SerializeField] private InputField DeviceCodeTimeoutMs;
public Action OnImxConnected;
private async void Start()
{
if (Passport.Instance != null)
{
bool hasCredsSaved = await Passport.Instance.HasCredentialsSaved();
ReloginButtons.SetActive(hasCredsSaved);
LoginButtons.SetActive(!hasCredsSaved);
DeviceCodeTimeoutMs.gameObject.SetActive(!hasCredsSaved && !SampleAppManager.UsePKCE);
}
else
{
Debug.LogError("[UnauthenticatedSceneManager] Passport.Instance is null");
}
}
void Awake()
{
OnImxConnected = () => { UnityEngine.SceneManagement.SceneManager.LoadScene("AuthenticatedScene"); };
}
}