Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COR-5527-ios-support #221

Open
wants to merge 1 commit into
base: COR-5540
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions unity/Assets/SimpleExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using UnityEngine.Android;
#endif

#if USE_EMBEDDED_LIB_WIN || UNITY_ANDROID
#if USE_EMBEDDED_LIB_WIN || UNITY_ANDROID || UNITY_IOS
using Cdm.Authentication.Browser;
using Cdm.Authentication.OAuth2;
using System.Threading;
Expand Down Expand Up @@ -146,7 +146,7 @@ private static void RequestPermission(string permissionName) {
}
#endif

#if USE_EMBEDDED_LIB_WIN || UNITY_ANDROID
#if USE_EMBEDDED_LIB_WIN || UNITY_ANDROID || UNITY_IOS
private CrossPlatformBrowser _crossPlatformBrowser;
private AuthenticationSession _authenticationSession;
private CancellationTokenSource _cancellationTokenSource;
Expand Down Expand Up @@ -187,6 +187,8 @@ private void InitForAuthentication()
_crossPlatformBrowser = new CrossPlatformBrowser();
_crossPlatformBrowser.platformBrowsers.Add(RuntimePlatform.WindowsEditor, new WindowsSystemBrowser());
_crossPlatformBrowser.platformBrowsers.Add(RuntimePlatform.WindowsPlayer, new WindowsSystemBrowser());
_crossPlatformBrowser.platformBrowsers.Add(RuntimePlatform.IPhonePlayer, new ASWebAuthenticationSessionBrowser());

// android
_crossPlatformBrowser.platformBrowsers.Add(RuntimePlatform.Android, new DeepLinkBrowser());

Expand Down Expand Up @@ -248,7 +250,7 @@ private async Task AuthenticateAsync()

protected void OnDestroy()
{
#if USE_EMBEDDED_LIB_WIN || UNITY_ANDROID
#if USE_EMBEDDED_LIB_WIN || UNITY_ANDROID || UNITY_IOS
_cancellationTokenSource?.Cancel();
_authenticationSession?.Dispose();
#endif
Expand Down Expand Up @@ -276,7 +278,10 @@ void Start()
InitForAuthentication();
StartEmotivUnityItfForAndroid();
# elif UNITY_IOS
UnityEngine.Debug.Log("SimpleExp: Start EmotivUnityItf for ios. TODO");
UnityEngine.Debug.Log("SimpleExp: Start EmotivUnityItf for ios");
InitForAuthentication();
_eItf.Init(AppConfig.ClientId, AppConfig.ClientSecret, AppConfig.AppName, AppConfig.AppVersion, "", "", AppConfig.IsDataBufferUsing);
_eItf.Start();
#else
UnityEngine.Debug.Log("SimpleExp: Start EmotivUnityItf for desktop");
_eItf.Init(AppConfig.ClientId, AppConfig.ClientSecret, AppConfig.AppName, AppConfig.AppVersion, "", "", AppConfig.IsDataBufferUsing);
Expand Down Expand Up @@ -501,7 +506,7 @@ private void CheckButtonsInteractable()
{
Button signInBtn = GameObject.Find("SessionPart").transform.Find("signInBtn").GetComponent<Button>();
Button signOutBtn = GameObject.Find("SessionPart").transform.Find("signOutBtn").GetComponent<Button>();
#if USE_EMBEDDED_LIB_WIN || UNITY_ANDROID
#if USE_EMBEDDED_LIB_WIN || UNITY_ANDROID || UNITY_IOS
ConnectToCortexStates connectionState = _eItf.GetConnectToCortexState();
signInBtn.interactable = (connectionState == ConnectToCortexStates.Login_notYet);
signOutBtn.interactable = (connectionState > ConnectToCortexStates.Login_notYet);
Expand Down