2using System.Collections.Generic;
4using System.Text.RegularExpressions;
5using System.Threading.Tasks;
22 [DefaultExecutionOrder(-50)]
25 private static readonly
string TAG =
"ApexSystem";
42 set { Instance.moduleID = value; }
48 set { Instance.moduleName = value; }
53 get {
return Instance.moduleVersion; }
54 set { Instance.moduleVersion = value; }
60 set { Instance.scenarioID = value; }
65 get {
return Instance.currentActiveLogin; }
71 get {
return Instance.runSetupOnAwake; }
72 set { Instance.runSetupOnAwake = value; }
77 get {
return Instance.loginCheckModuleAccess; }
83 get {
return Instance.deviceSerialNumber; }
91 Debug.unityLogger.Log(LogType.Log,
TAG, $
"Getting passed login token as {Instance.loginToken} in instance {Instance.gameObject.name}");
97 Debug.unityLogger.Log(LogType.Error,
TAG, $
"Setting passed login token to {value}");
98 Instance.loginToken = value;
104 get {
return Instance.optionalParameter; }
105 set { Instance.optionalParameter = value; }
110 get {
return Instance.returnTargetParameter; }
115 Instance.returnTargetParameter = value;
119 Instance.returnTargetParameter =
"";
122 if (
Instance.returnTargetParameter.Contains(
"://"))
135 get {
return Instance.targetTypeParameter; }
136 private set { Instance.targetTypeParameter = value; }
139 [SerializeField, EndpointDisplay]
232 Debug.unityLogger.Log(LogType.Log,
TAG, $
"ApexSystem found on {gameObject.name}");
235 Debug.unityLogger.Log(LogType.Log,
TAG,
"Instance already initialized.");
240#if UNITY_IOS || UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
245 Debug.unityLogger.Log(LogType.Log,
TAG,
"[ApexSystem] Running on awake!");
249 DontDestroyOnLoad(gameObject);
250#if MANAGE_XR && !UNITY_EDITOR
251 Debug.unityLogger.Log(LogType.Log,
TAG,
"Using ManageXR");
257 async
void InitMXRSDK()
259 Debug.unityLogger.Log(LogType.Log,
TAG,
"Initializing the ManageXR SDK");
260 await MXRManager.InitAsync();
261 MXRManager.System.OnDeviceStatusChange += OnDeviceStatusChanged;
263 Debug.unityLogger.Log(LogType.Log,
TAG, $
"Device serial set to {deviceSerialNumber}");
266 void OnDeviceStatusChanged(DeviceStatus newDeviceStatus)
269 Debug.unityLogger.Log(LogType.Log,
TAG, $
"Device serial number changed to {deviceSerialNumber}");
276 if (!
string.IsNullOrEmpty(Application.absoluteURL))
292 Debug.unityLogger.Log(LogType.Log,
TAG,
"SetupPlatformConfiguration");
297 Debug.unityLogger.Log(LogType.Log,
TAG,
"Found pixoconfig.cnf");
301 if (configContent.Length > 0)
303 Debug.unityLogger.Log(LogType.Log,
TAG,
"Configuration is not empty.");
305 if (configData ==
null)
307 Debug.unityLogger.Log(LogType.Log,
TAG,
"Failed to deserialize the config.");
312 if (configData.
Platform.Contains(
"NA", StringComparison.CurrentCultureIgnoreCase))
314 if (configData.
Platform.Contains(
"Production", StringComparison.CurrentCultureIgnoreCase))
316 Debug.unityLogger.Log(LogType.Log,
TAG,
"NA Production platform target.");
320 if (configData.
Platform.Contains(
"Dev", StringComparison.CurrentCultureIgnoreCase))
322 Debug.unityLogger.Log(LogType.Log,
TAG,
"NA Dev platform target.");
326 if (configData.
Platform.Contains(
"Stage", StringComparison.CurrentCultureIgnoreCase))
328 Debug.unityLogger.Log(LogType.Log,
TAG,
"NA Stage platform target.");
332 else if (configData.
Platform.Contains(
"SA", StringComparison.CurrentCultureIgnoreCase))
334 Debug.unityLogger.Log(LogType.Log,
TAG,
"SA Production platform target.");
357 Debug.unityLogger.Log(LogType.Log,
TAG,
"[ApexSystem] Apex API Handler is not null!");
385 Debug.unityLogger.Log(LogType.Log,
TAG, $
"[ApexSystem] Login Token: {(string.IsNullOrEmpty(PassedLoginToken) ? "<Null>
" : PassedLoginToken)}");
393 Debug.unityLogger.Log(LogType.Log,
TAG,
"ApexSystem::_ExitApplication");
394 if (returnTarget ==
null)
399 string returnTargetType =
"app";
401 if (returnTarget.Contains(
"://"))
403 returnTargetType =
"url";
406 Debug.unityLogger.Log(LogType.Log,
TAG,
"[ApexSystem] " + returnTarget +
" " + returnTargetType);
408 string parameters =
"";
410 Debug.unityLogger.Log(LogType.Log,
TAG,
"[ApexSystem] Building parameters for url.");
425 if (parameters.Length > 0)
431 if (returnTarget.Length > 0)
433 if (parameters.Length > 0)
435 parameters +=
"returntarget=" + returnTarget;
438 if (returnTargetType.Length > 0)
440 if (parameters.Length > 0)
442 parameters +=
"targettype=" + returnTargetType;
445 Debug.unityLogger.Log(LogType.Log,
TAG,
"[ApexSystem] Checking the return target parameter.");
449 Debug.unityLogger.Log(LogType.Log,
TAG,
"[ApexSystem] Had a valid return target parameter.");
452 Debug.unityLogger.Log(LogType.Log,
TAG,
"[ApexSystem] Return Target is a URL.");
455 if (!
string.IsNullOrEmpty(parameters))
457 if (!returnURL.Contains(
'?'))
462 returnURL += parameters;
464 Debug.unityLogger.Log(LogType.Log,
TAG,
"Custom Target: " + returnURL);
470 Debug.unityLogger.Log(LogType.Log,
TAG, $
"[ApexSystem] Return Target is a package name. {returnTargetParameter}");
472 List<string> keys =
new List<string>(),
473 values =
new List<string>();
475 Debug.unityLogger.Log(LogType.Log,
TAG,
"[ApexSystem] Adding pixo token.");
479 keys.Add(
"pixotoken");
484 keys.Add(
"pixotoken");
488 Debug.unityLogger.Log(LogType.Log,
TAG,
"[ApexSystem] Adding optional.");
492 keys.Add(
"optional");
496 Debug.unityLogger.Log(LogType.Log,
TAG,
"[ApexSystem] Adding return target.");
498 if (!
string.IsNullOrEmpty(returnTarget))
500 keys.Add(
"returntarget");
501 values.Add(returnTarget);
504 Debug.unityLogger.Log(LogType.Log,
TAG,
"[ApexSystem] Adding return target type.");
506 if (!
string.IsNullOrEmpty(returnTargetType))
508 keys.Add(
"targettype");
509 values.Add(returnTargetType);
522 return target.ToUrlString();
527 int targetValue = (int)target;
530 return webTarget.ToUrlString();
535 int targetValue = (int)target;
538 return apiTarget.ToUrlString();
562 Debug.LogWarning($
"{moduleVersion} is an invalid module version.");
564 deviceID = SystemInfo.deviceUniqueIdentifier;
567 XRSettings.loadedDeviceName.Length > 0 ? XRSettings.loadedDeviceName : Application.platform.ToString();
602 Debug.unityLogger.Log(LogType.Log,
TAG,
"Websocket connected successfully.");
607 Debug.LogError(
"Websocket failed to connect with error: " + reason);
612 Debug.unityLogger.Log(LogType.Log,
TAG,
"Websocket received: " + data);
615 if (data.Contains(
"auth_code"))
621 if (data.Contains(
"Token", StringComparison.OrdinalIgnoreCase))
629 Debug.unityLogger.Log(LogType.Log,
TAG, ex.Message);
635 Debug.unityLogger.Log(LogType.Log,
TAG,
"Websocket closed with reason: " + reason);
645 if (moduleVersionParts.Length != 3)
669 if (modulePart.Length <= 0)
672 if (modulePart.Length > 2)
680 if (modulePart.Length <= 0)
683 if (modulePart.StartsWith(
"0"))
689 [Obsolete(
"ReturnToHub has been deprecated, please use ExitApplication.",
true)]
697 Instance._ExitApplication(returnTarget);
702 return Instance._RequestAuthorizationCode();
707 Instance._ChangePlatformServer(newServer);
717 Debug.unityLogger.Log(LogType.Log,
TAG, $
"Login with token of token {(string.IsNullOrEmpty(PassedLoginToken) ? "<none>
" : PassedLoginToken)}");
723 return Instance._LoginWithToken(token);
731 public static bool Login(
string username,
string password)
733 return Instance._Login(username, password);
738 return Instance._CheckModuleAccess(targetModuleID);
752 return Instance._CompleteSession(currentSessionData, contextExtension, resultExtension);
757 return Instance._SendSimpleSessionEvent(action, targetObject, contextExtension);
762 return Instance._SendSessionEvent(eventStatement);
770 public static bool GetUser(
int userId = -1)
782 return Instance._GetUserModules(userId);
787 return Instance._GetModuleList(platformName);
792 return Instance._GetQuickIDAuthUsers(serialNumber);
795 public static bool QuickIDLogin(
string serialNumber,
string username)
797 return Instance._QuickIDLogin(serialNumber, username);
807 protected void _Ping()
814 Debug.unityLogger.Log(LogType.Log,
TAG, $
"[ApexSystem] Calling LoginWithToken ({token})");
815 if (token.Length <= 0)
820 Debug.unityLogger.Log(LogType.Log,
TAG, $
"[ApexSystem] Logging in with token: {token}");
828 Debug.unityLogger.Log(LogType.Log,
TAG,
"[ApexSystem] _Login called.");
831 Debug.unityLogger.Log(LogType.Log,
TAG,
"[ApexSystem] API Handler is null.");
834 "There was an error reaching the platform, please contact your administrator."
840 if (login.
Login.Length <= 0)
842 Debug.unityLogger.Log(LogType.Log,
TAG,
"[Login] No user name.");
849 Debug.unityLogger.Log(LogType.Log,
TAG,
"[Login] No password.");
850 login.Password =
"<empty>";
855 Debug.unityLogger.Log(LogType.Log,
TAG,
"[ApexSystem] Login called.");
860 protected bool _Login(
string username,
string password)
868 failureResponse.Error =
"true";
869 failureResponse.HttpCode =
"400";
870 failureResponse.Message = message;
872 return failureResponse;
877 Debug.unityLogger.Log(LogType.Log,
TAG,
"Parsing passed data.");
878 if (arguments ==
null)
880 Debug.unityLogger.Log(LogType.Log,
TAG,
"No arguments found for the application.");
884 if (arguments.ContainsKey(
"optional"))
887 if (arguments.ContainsKey(
"returntarget"))
890 if (arguments.ContainsKey(
"targettype"))
893 Debug.unityLogger.Log(LogType.Log,
TAG,
"Is the token already set?");
896 Debug.unityLogger.Log(LogType.Log,
TAG,
"Token is not set, but does the arguments contain a token?");
897 if (arguments.ContainsKey(
"pixotoken"))
899 Debug.unityLogger.Log(LogType.Log,
TAG,
"Token was found in the arguments.");
900 string token = arguments[
"pixotoken"];
901 Debug.unityLogger.Log(LogType.Log,
TAG, $
"Found pixotoken {token}.");
902 if(!
string.IsNullOrEmpty(token))
914 Debug.unityLogger.Log(LogType.Log,
TAG,
"[ApexSystem] _CheckModuleAccess called.");
918 Debug.LogError(
"[ApexSystem] Cannot check user's module access with no active login.");
922 if (targetModuleID <= -1)
927 Debug.unityLogger.Log(LogType.Log,
TAG, $
"[ApexSystem] Checking module access of module {targetModuleID} from user {currentActiveLogin.ID} and device serial number {(string.IsNullOrEmpty(deviceSerialNumber) == true ? "---
" : deviceSerialNumber)}");
937 Debug.LogError(
"[ApexSystem] Cannot join session with no active login.");
946 if (newScenarioID !=
null)
954 "[ApexSystem] Session is already in progress."
955 +
" The previous session didn't complete or a new session was started during an active session."
961 Statement sessionStatement =
new Statement();
962 Agent sessionActor =
new Agent();
965 Verb sessionVerb =
new Verb();
967 sessionVerb.display =
new LanguageMap();
968 sessionVerb.display.Add(
"en",
"Joined Session");
970 Activity sessionActivity =
new Activity();
971 sessionActivity.id =
string.Format(
"https://pixovr.com/xapi/objects/{0}/{1}",
moduleID,
scenarioID);
973 Context sessionContext =
new Context();
980 sessionStatement.actor = sessionActor;
981 sessionStatement.verb = sessionVerb;
982 sessionStatement.target = sessionActivity;
983 sessionStatement.context = sessionContext;
991 sessionData.JsonData = sessionStatement;
1003 if (verbName ==
null)
1006 if (verbName.Length == 0)
1009 Statement sessionStatement =
new Statement();
1010 Agent sessionActor =
new Agent();
1013 Verb sessionVerb =
new Verb();
1014 sessionVerb.id =
new Uri(
"https://pixovr.com/xapi/verbs/" + verbName.Replace(
' ',
'_').ToLower());
1015 sessionVerb.display =
new LanguageMap();
1016 sessionVerb.display.Add(
"en", verbName);
1018 Activity sessionActivity =
new Activity();
1019 sessionActivity.id =
string.Format(
1020 "https://pixovr.com/xapi/objects/{0}/{1}/{2}",
1023 targetObject.Replace(
' ',
'_').ToLower()
1026 Context sessionContext =
new Context();
1029 sessionContext.platform =
platform;
1033 sessionStatement.actor = sessionActor;
1034 sessionStatement.verb = sessionVerb;
1035 sessionStatement.target = sessionActivity;
1036 sessionStatement.context = sessionContext;
1043 sessionEvent.JsonData = sessionStatement;
1059 Debug.LogError(
"[ApexSystem] Cannot send a session event with no active login.");
1065 Debug.LogError(
"[ApexSystem] No session in progress to send event for.");
1069 if (eventStatement ==
null)
1071 Debug.LogError(
"[ApexSystem] No event data to send.");
1075 if (eventStatement.actor !=
null)
1077 Debug.LogWarning(
"[ApexSystem] Actor data should not be filled out.");
1080 if (eventStatement.verb ==
null)
1082 Debug.LogError(
"[ApexSystem] Verb missing from eventStatement.");
1086 if (eventStatement.verb.id ==
null)
1088 Debug.LogError(
"[ApexSystem] verb.id missing from eventStatement.");
1092 if (eventStatement.target ==
null)
1094 Debug.LogError(
"[ApexSystem] Object (target) missing from eventStatement.");
1098 eventStatement.actor =
new Agent();
1101 if (eventStatement.context ==
null)
1103 eventStatement.context =
new Context();
1108 eventStatement.context.platform =
platform;
1117 sessionEvent.JsonData = eventStatement;
1137 Debug.LogError(
"[ApexSystem] Cannot complete session with no active login.");
1143 Debug.LogError(
"[ApexSystem] No session in progress to complete.");
1148 Agent sessionActor =
new Agent();
1152 Verb sessionVerb =
new Verb();
1154 sessionVerb.display =
new LanguageMap();
1155 sessionVerb.display.Add(
"en",
"Completed Session");
1158 Activity sessionActivity =
new Activity();
1159 sessionActivity.id =
string.Format(
"https://pixovr.com/xapi/objects/{0}/{1}",
moduleID,
scenarioID);
1162 Context sessionContext =
new Context();
1165 sessionContext.platform =
platform;
1170 Result sessionResult =
new Result();
1171 sessionResult.completion = currentSessionData.
Complete;
1172 sessionResult.success = currentSessionData.
Success;
1174 sessionResult.score =
new Score();
1175 sessionResult.score.min = currentSessionData.
MinimumScore;
1176 sessionResult.score.max = currentSessionData.
MaximumScore;
1177 sessionResult.score.raw = currentSessionData.
Score;
1180 currentSessionData.
Score,
1183 sessionResult.duration = TimeSpan.FromSeconds(currentSessionData.
Duration);
1184 if (resultExtension !=
null)
1186 sessionResult.extensions =
new Extensions(resultExtension.
ToJObject());
1190 Statement sessionStatement =
new Statement();
1191 sessionStatement.actor = sessionActor;
1192 sessionStatement.verb = sessionVerb;
1193 sessionStatement.target = sessionActivity;
1194 sessionStatement.context = sessionContext;
1195 sessionStatement.result = sessionResult;
1202 sessionData.JsonData = sessionStatement;
1203 sessionData.SessionDuration = currentSessionData.
Duration;
1204 sessionData.Score = currentSessionData.
Score;
1205 sessionData.ScoreMin = currentSessionData.
MinimumScore;
1206 sessionData.ScoreMax = currentSessionData.
MaximumScore;
1209 currentSessionData.
Score,
1220 Debug.unityLogger.Log(LogType.Log,
TAG,
"Sending heartbeat...");
1232 protected bool _GetUser(
int userId = -1)
1271 if (String.IsNullOrEmpty(serialNumber))
return false;
1277 protected bool _QuickIDLogin(
string serialNumber,
string username)
1279 if (String.IsNullOrEmpty(serialNumber) ||
string.IsNullOrEmpty(username))
return false;
1287 float determinedScaledScore = scaledScore;
1289 if (scaledScore < Mathf.Epsilon && score >= Mathf.Epsilon)
1291 determinedScaledScore = (score / maxScore) * 100f;
1294 return determinedScaledScore;
1305 if (currentContextExtension !=
null)
1307 contextExtension = currentContextExtension;
1324 return new Extensions(contextExtension.
ToJObject());
1329 Debug.unityLogger.Log(LogType.Log,
TAG,
"[ApexSystem] On API Response");
1330 bool success = message.IsSuccessStatusCode;
1342 Debug.unityLogger.Log(LogType.Log,
TAG,
"[ApexSystem] Ping successful.");
1347 Debug.unityLogger.Log(LogType.Log,
TAG,
"[ApexSystem] Ping failed.");
1354 Debug.unityLogger.Log(LogType.Log,
TAG,
"[ApexSystem] Calling to handle login.");
1367 Debug.unityLogger.Log(LogType.Log,
TAG,
string.Format(
"[ApexSystem] Failed to get user.\nError: {0}", failureData.
Message));
1381 Debug.unityLogger.Log(LogType.Log,
TAG,
string.Format(
"[ApexSystem] Failed to get user.\nError: {0}", failureData.
Message));
1391 Debug.unityLogger.Log(LogType.Log,
TAG,
string.Format(
"[ApexSystem] Session Id is {0}.", joinSessionResponse.
SessionId));
1399 Debug.unityLogger.Log(LogType.Log,
TAG,
1400 string.Format(
"[ApexSystem] Failed to join session.\nError: {0}", failureData.
Message)
1419 Debug.unityLogger.Log(LogType.Log,
TAG,
1420 string.Format(
"[ApexSystem] Failed to complete session.\nError: {0}", failureData.
Message)
1430 Debug.unityLogger.Log(LogType.Log,
TAG,
"[ApexSystem] Session event sent.");
1436 Debug.unityLogger.Log(LogType.Log,
TAG,
1437 string.Format(
"[ApexSystem] Failed to send session event.\nError: {0}", failureData.
Message)
1448 if (userAccessResponseContent.Access)
1450 if (userAccessResponseContent.PassingScore.HasValue)
1452 currentActiveLogin.MinimumPassingScore = userAccessResponseContent.
PassingScore.Value;
1467 Message =
"User does not have access to module",
1475 Debug.unityLogger.Log(LogType.Log,
TAG,
1477 "[ApexSystem] Failed to get users module access data.\nError: {0}",
1495 Debug.unityLogger.Log(LogType.Log,
TAG,
1496 string.Format(
"[ApexSystem] Failed to get org modules.\nError: {0}", failureData.
Message)
1513 Debug.unityLogger.Log(LogType.Log,
TAG,
string.Format(
"[ApexSystem] Failed to get module.\nError: {0}", failureData.
Message));
1527 Debug.unityLogger.Log(LogType.Log,
TAG,
string.Format(
"[ApexSystem] Failed to get Quick ID Authentication users.\nError: {0}", failureData.
Message));
1543 Debug.unityLogger.Log(LogType.Log,
TAG,
string.Format(
"[ApexSystem] Failed to authenticate with Quick ID Authentication.\nError: {0}", failureData.
Message));
1561 protected void HandleLogin(
bool successful,
object responseData)
1563 Debug.unityLogger.Log(LogType.Log,
TAG,
"[ApexSystem] Handling Login");
1580 Debug.unityLogger.Log(LogType.Log,
TAG,
string.Format(
"[ApexSystem] Failed to log in.\nError: {0}", failureData.
Message));
1590 serverIP.Contains(
"apexsa.", StringComparison.CurrentCultureIgnoreCase)
1591 ||
serverIP.Contains(
"saudi.", StringComparison.CurrentCultureIgnoreCase)
1594 Debug.unityLogger.Log(LogType.Log,
TAG, $
"pixovr://com.PixoVR.SA_TrainingAcademy?pixotoken={token}");
1595 Application.OpenURL($
"pixovr://com.PixoVR.SA_TrainingAcademy?pixotoken={token}");
1599 Debug.unityLogger.Log(LogType.Log,
TAG, $
"pixovr://com.PixoVR.PixoHub?pixotoken={token}");
1600 Application.OpenURL($
"pixovr://com.PixoVR.PixoHub?pixotoken={token}");
1615 if (
Instance.currentActiveLogin ==
null)
1618 return Instance._GenerateOneTimeLoginForUser();
1625 Debug.LogError(
"[ApexSystem] No current user logged in.");
1636 Debug.LogError(
"[ApexSystem] No user logged in to generate code.");
async void SendHeartbeat(string authToken, int sessionId)
async void GetUserModules(string authToken, int userId)
async void QuickIDLogin(QuickIDLoginData login)
async void JoinSession(string authToken, JoinSessionData joinData)
async void LoginWithToken(string token)
async void CompleteSession(string authToken, CompleteSessionData completionData)
async void Login(LoginData login)
async void SendSessionEvent(string authToken, SessionEventData sessionEvent)
void SetPlatformEndpoint(string endpointUrl)
async void GetQuickIDAuthenticationUsers(string serialNumber)
async void GetUserData(string authToken, int userId)
void SetWebEndpoint(string endpointUrl)
async void GetModuleAccess(int moduleId, int userId, string serialNumber)
async void GenerateAssistedLogin(string authToken)
async void GetModuleList(string authToken, string platform)
const string PIXOVR_SESSION_COMPLETE
const string PIXOVR_SESSION_EVENT
const string PIXOVR_SESSION_JOINED
static readonly string MODULE_ID
bool InitializeInstance(T targetInstance)
OnHttpResponseEvent OnPingSuccess
Extensions AppendStandardContextExtension(Extensions currentContextExtensions)
OnGeneratedAssistedLoginSuccessEvent OnGeneratedAssistedLoginSuccess
bool runSetupOnAwake
[SerializeField]
static string PassedLoginToken
Task socketDisconnectTask
static bool LoginCheckModuleAccess
static bool QuickIDLogin(string serialNumber, string username)
static bool GetCurrentUser()
static bool RunSetupOnAwake
FailureResponse GenerateFailureResponse(string message)
OnApexFailureEvent OnJoinSessionFailed
string GetPlatformEndpointFromPlatformTarget(PlatformServer target)
void _ChangePlatformServer(PlatformServer newServer)
int moduleID
[SerializeField]
static bool Login(string username, string password)
string deviceSerialNumber
OnApexFailureEvent OnGeneratedAssistedLoginFailed
string targetTypeParameter
OnHttpResponseEvent OnPingFailed
static bool SendSessionEvent(Statement eventStatement)
OnGetQuickIDAuthUsersSuccessEvent OnGetQuickIDAuthGetUsersSuccess
string GetWebEndpointFromPlatformTarget(PlatformServer target)
void OnAPIResponse(ResponseType response, HttpResponseMessage message, object responseData)
OnHttpResponseEvent OnJoinSessionSuccess
static void ReturnToHub()
OnApexFailureEvent OnGetUserFailed
OnAuthCodeReceived OnAuthorizationCodeReceived
OnGetOrgModulesSuccessEvent OnGetOrganizationModulesSuccess
bool _JoinSession(string newScenarioID=null, Extension contextExtension=null)
bool _Login(LoginData login)
static bool RequestAuthorizationCode()
bool _CompleteSession(SessionData currentSessionData, Extension contextExtension, Extension resultExtension)
void SetupPlatformConfiguration()
PlatformResponse OnPlatformResponse
static bool GetUser(int userId=-1)
OnHttpResponseEvent OnCompleteSessionSuccess
static bool GetQuickIDAuthUsers(string serialNumber)
string moduleVersion
[SerializeField]
string GetEndpointFromTarget(PlatformServer target)
bool _SendSimpleSessionEvent(string verbName, string targetObject, Extension contextExtension)
OnApexFailureEvent OnCompleteSessionFailed
OnLoginSuccessEvent OnLoginSuccess
void OnWebSocketConnectFailed(string reason)
static bool CheckModuleAccess(int targetModuleID=-1)
OnApexFailureEvent OnSendEventFailed
OnQuickIDAuthLoginSuccessEvent OnQuickIDAuthLoginSuccess
void OnWebSocketReceive(string data)
bool _RequestAuthorizationCode()
void PopulateWebSocketURL()
void HandleLogin(bool successful, object responseData)
void DisconnectWebsocket()
static bool GetUserModules(int userId=-1)
static LoginResponseContent CurrentActiveLogin
bool _GetQuickIDAuthUsers(string serialNumber)
static bool SendSimpleSessionEvent(string action, string targetObject, Extension contextExtension)
static string ReturnTarget
float DetermineScaledScore(float scaledScore, float score, float maxScore)
APIHandler apexAPIHandler
static bool GetCurrentUserModules()
void _ExitApplication(string returnTarget)
static bool GetModulesList(string platformName)
Task< bool > socketConnectTask
OnApexFailureEvent OnGetQuickIDAuthGetUsersFailed
static void ChangePlatformServer(PlatformServer newServer)
static string ModuleVersion
static bool LoginWithToken()
bool _Login(string username, string password)
static bool JoinSession(string scenarioID=null, Extension contextExtension=null)
bool loginCheckModuleAccess
[SerializeField]
bool _GenerateOneTimeLoginForCurrentUser()
OnApexFailureEvent OnGetUserModulesFailed
bool _SendSessionEvent(Statement eventStatement)
OnApexFailureEvent OnLoginFailed
static bool Login(LoginData login)
bool IsModuleVersionValid()
void _ParsePassedData(Dictionary< string, string > arguments)
static string DeviceSerialNumber
LoginResponseContent currentActiveLogin
bool _LoginWithToken(string token)
string returnTargetParameter
static void ExitApplication(string returnTarget="")
static readonly Regex VersionValidator
OnApexFailureEvent OnGetOrganizationModulesFailed
float heartbeatTime
[SerializeField]
OnApexFailureEvent OnModuleAccessFailed
OnApexFailureEvent OnQuickIDAuthLoginFailed
static string OptionalData
string scenarioID
[SerializeField]
static readonly string TAG
OnModuleAccessSuccessEvent OnModuleAccessSuccess
bool _GetUser(int userId=-1)
OnGetUserSuccessEvent OnGetUserSuccess
OnHttpResponseEvent OnSendEventSuccess
bool _QuickIDLogin(string serialNumber, string username)
static bool GenerateOneTimeLoginForCurrentUser()
bool _CheckModuleAccess(int targetModuleID=-1)
bool _GenerateOneTimeLoginForUser()
static bool CompleteSession(SessionData currentSessionData, Extension contextExtension=null, Extension resultExtension=null)
bool IsModuleVersionOnlyNumerical()
string serverIP
[SerializeField]
void OnWebSocketClosed(System.Net.WebSockets.WebSocketCloseStatus reason)
bool _GetModuleList(string platformName)
static bool LoginWithToken(string token)
PlatformServer PlatformTargetServer
OnGetUserModulesSuccessEvent OnGetUserModulesSuccess
Extensions AppendStandardContextExtension(Extension currentContextExtension)
void OnWebSocketConnected()
string moduleName
[SerializeField]
bool IsModuleNonMajorVersionPartValid(string modulePart)
bool _GetUserModules(int userId=-1)
bool IsModuleMajorVersionPartValid(string modulePart)
void OnDeepLinkActivated(string url)
static readonly Uri JOINED_SESSION
static readonly Uri COMPLETED_SESSION
bool RequestAuthorizationCode()
async Task< bool > Connect(Uri endpoint, int attemptTries=3)
OnWebSocketReceive OnReceive
OnWebSocketConnectFailed OnConnectFailed
OnWebSocketClosed OnClosed
OnWebSocketConnectSuccessful OnConnectSuccess
static bool DoesFileExistInSharedLocation(string fileName)
static string ReadFileFromSharedStorage(string fileName)
static string GetMacAddress()
void Add(Uri key, string value)
void AddSimple(string key, string value)
override JObject ToJObject(TCAPIVersion version)
delegate void PlatformResponse(ResponseType type, bool wasSuccessful, object responseData)