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.currentExitTargetParameter; }
115 Instance.currentExitTargetParameter = value;
119 Instance.currentExitTargetParameter =
"";
122 if (
Instance.currentExitTargetParameter.Contains(
"://"))
135 get {
return Instance.targetTypeParameter; }
136 private set { Instance.targetTypeParameter = value; }
144 [SerializeField, EndpointDisplay]
246 Debug.unityLogger.Log(LogType.Log,
TAG, $
"ApexSystem found on {gameObject.name}");
249 Debug.unityLogger.Log(LogType.Log,
TAG,
"Instance already initialized.");
254#if UNITY_IOS || UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
259 Debug.unityLogger.Log(LogType.Log,
TAG,
"Running on awake!");
263 DontDestroyOnLoad(gameObject);
264#if MANAGE_XR && !UNITY_EDITOR
265 Debug.unityLogger.Log(LogType.Log,
TAG,
"Using ManageXR");
271 async
void InitMXRSDK()
273 Debug.unityLogger.Log(LogType.Log,
TAG,
"Initializing the ManageXR SDK");
274 await MXRManager.InitAsync();
275 MXRManager.System.OnDeviceStatusChange += OnDeviceStatusChanged;
277 Debug.unityLogger.Log(LogType.Log,
TAG, $
"Device serial set to {deviceSerialNumber}");
280 void OnDeviceStatusChanged(DeviceStatus newDeviceStatus)
283 Debug.unityLogger.Log(LogType.Log,
TAG, $
"Device serial number changed to {deviceSerialNumber}");
290 if (!
string.IsNullOrEmpty(Application.absoluteURL))
306 Debug.unityLogger.Log(LogType.Log,
TAG,
"SetupPlatformConfiguration");
311 Debug.unityLogger.Log(LogType.Log,
TAG,
"Found pixoconfig.cnf");
315 if (configContent.Length > 0)
317 Debug.unityLogger.Log(LogType.Log,
TAG,
"Configuration is not empty.");
319 if (configData ==
null)
321 Debug.unityLogger.Log(LogType.Log,
TAG,
"Failed to deserialize the config.");
326 if (configData.
Platform.Contains(
"NA", StringComparison.CurrentCultureIgnoreCase))
328 if (configData.
Platform.Contains(
"Production", StringComparison.CurrentCultureIgnoreCase))
330 Debug.unityLogger.Log(LogType.Log,
TAG,
"NA Production platform target.");
334 if (configData.
Platform.Contains(
"Dev", StringComparison.CurrentCultureIgnoreCase))
336 Debug.unityLogger.Log(LogType.Log,
TAG,
"NA Dev platform target.");
340 if (configData.
Platform.Contains(
"Stage", StringComparison.CurrentCultureIgnoreCase))
342 Debug.unityLogger.Log(LogType.Log,
TAG,
"NA Stage platform target.");
346 else if (configData.
Platform.Contains(
"SA", StringComparison.CurrentCultureIgnoreCase))
348 Debug.unityLogger.Log(LogType.Log,
TAG,
"SA Production platform target.");
371 Debug.unityLogger.Log(LogType.Log,
TAG,
"Apex API Handler is not null!");
398 Debug.unityLogger.Log(LogType.Log,
TAG, $
"Login Token: {(string.IsNullOrEmpty(PassedLoginToken) ? "<Null>
" : PassedLoginToken)}");
405 Debug.unityLogger.Log(LogType.Log,
TAG,
"ApexSystem::_ExitApplication");
406 if (nextExitApplication ==
null)
408 nextExitApplication =
"";
411 string returnTargetType =
"app";
413 if (nextExitApplication.Contains(
"://"))
415 returnTargetType =
"url";
418 Debug.unityLogger.Log(LogType.Log,
TAG,
"" + nextExitApplication +
" " + returnTargetType);
420 string parameters =
"";
422 Debug.unityLogger.Log(LogType.Log,
TAG,
"Building parameters for url.");
437 if (parameters.Length > 0)
443 if (nextExitApplication.Length > 0)
445 if (parameters.Length > 0)
447 parameters +=
"returntarget=" + nextExitApplication;
450 if (returnTargetType.Length > 0)
452 if (parameters.Length > 0)
454 parameters +=
"targettype=" + returnTargetType;
457 Debug.unityLogger.Log(LogType.Log,
TAG,
"Checking the return target parameter.");
461 Debug.unityLogger.Log(LogType.Log,
TAG,
"Had a valid return target parameter.");
464 Debug.unityLogger.Log(LogType.Log,
TAG,
"Return Target is a URL.");
467 if (!
string.IsNullOrEmpty(parameters))
469 if (!returnURL.Contains(
'?'))
474 returnURL += parameters;
476 Debug.unityLogger.Log(LogType.Log,
TAG,
"Custom Target: " + returnURL);
482 Debug.unityLogger.Log(LogType.Log,
TAG, $
"Return Target is a package name. {CurrentExitTarget}");
484 List<string> keys =
new List<string>(),
485 values =
new List<string>();
487 Debug.unityLogger.Log(LogType.Log,
TAG,
"Adding pixo token.");
491 keys.Add(
"pixotoken");
496 keys.Add(
"pixotoken");
500 Debug.unityLogger.Log(LogType.Log,
TAG,
"Adding optional.");
504 keys.Add(
"optional");
508 Debug.unityLogger.Log(LogType.Log,
TAG,
"Adding return target.");
510 if (!
string.IsNullOrEmpty(nextExitApplication))
512 keys.Add(
"returntarget");
513 values.Add(nextExitApplication);
516 Debug.unityLogger.Log(LogType.Log,
TAG,
"Adding return target type.");
518 if (!
string.IsNullOrEmpty(returnTargetType))
520 keys.Add(
"targettype");
521 values.Add(returnTargetType);
534 return target.ToUrlString();
539 int targetValue = (int)target;
542 return webTarget.ToUrlString();
547 int targetValue = (int)target;
550 return apiTarget.ToUrlString();
574 Debug.unityLogger.Log(LogType.Warning,
TAG, $
"{moduleVersion} is an invalid module version.");
576 deviceID = SystemInfo.deviceUniqueIdentifier;
579 XRSettings.loadedDeviceName.Length > 0 ? XRSettings.loadedDeviceName : Application.platform.ToString();
614 Debug.unityLogger.Log(LogType.Log,
TAG,
"Websocket connected successfully.");
619 Debug.unityLogger.Log(LogType.Error,
TAG,
"Websocket failed to connect with error: " + reason);
624 Debug.unityLogger.Log(LogType.Log,
TAG,
"Websocket received: " + data);
627 if (data.Contains(
"auth_code"))
633 if (data.Contains(
"Token", StringComparison.OrdinalIgnoreCase))
641 Debug.unityLogger.Log(LogType.Log,
TAG, ex.Message);
647 Debug.unityLogger.Log(LogType.Log,
TAG,
"Websocket closed with reason: " + reason);
657 if (moduleVersionParts.Length != 3)
681 if (modulePart.Length <= 0)
684 if (modulePart.Length > 2)
692 if (modulePart.Length <= 0)
695 if (modulePart.StartsWith(
"0"))
703 Instance._ExitApplication(nextExitTarget);
708 return Instance._RequestAuthorizationCode();
713 Instance._ChangePlatformServer(newServer);
716 public static void Ping()
723 Debug.unityLogger.Log(LogType.Log,
TAG, $
"Login with token of token {(string.IsNullOrEmpty(PassedLoginToken) ? "<none>
" : PassedLoginToken)}");
729 return Instance._LoginWithToken(token);
737 public static bool Login(
string username,
string password)
739 return Instance._Login(username, password);
744 return Instance._CheckModuleAccess(targetModuleID);
758 return Instance._CompleteSession(currentSessionData, contextExtension, resultExtension);
763 return Instance._SendSimpleSessionEvent(action, targetObject, contextExtension);
768 return Instance._SendSessionEvent(eventStatement);
776 public static bool GetUser(
int userId = -1)
788 return Instance._GetUserModules(userId);
793 return Instance._GetModuleList(platformName);
798 return Instance._GetQuickIDAuthUsers(serialNumber);
801 public static bool QuickIDLogin(
string serialNumber,
string username)
803 return Instance._QuickIDLogin(serialNumber, username);
813 protected void _Ping()
820 Debug.unityLogger.Log(LogType.Log,
TAG, $
"Calling LoginWithToken ({token})");
821 if (token.Length <= 0)
826 Debug.unityLogger.Log(LogType.Log,
TAG, $
"Logging in with token: {token}");
834 Debug.unityLogger.Log(LogType.Log,
TAG,
"_Login called.");
837 Debug.unityLogger.Log(LogType.Log,
TAG,
"API Handler is null.");
840 "There was an error reaching the platform, please contact your administrator."
846 if (login.
Login.Length <= 0)
848 Debug.unityLogger.Log(LogType.Log,
TAG,
"[Login] No user name.");
855 Debug.unityLogger.Log(LogType.Log,
TAG,
"[Login] No password.");
856 login.Password =
"<empty>";
861 Debug.unityLogger.Log(LogType.Log,
TAG,
"Login called.");
866 protected bool _Login(
string username,
string password)
874 failureResponse.Error =
"true";
875 failureResponse.HttpCode =
"400";
876 failureResponse.Message = message;
878 return failureResponse;
883 Debug.unityLogger.Log(LogType.Log,
TAG,
"Parsing passed data.");
884 if (arguments ==
null)
886 Debug.unityLogger.Log(LogType.Log,
TAG,
"No arguments found for the application.");
890 if (arguments.ContainsKey(
"optional"))
893 if (arguments.ContainsKey(
"returntarget"))
896 if (arguments.ContainsKey(
"targettype"))
899 Debug.unityLogger.Log(LogType.Log,
TAG,
"Is the token already set?");
902 Debug.unityLogger.Log(LogType.Log,
TAG,
"Token is not set, but does the arguments contain a token?");
903 if (arguments.ContainsKey(
"pixotoken"))
905 Debug.unityLogger.Log(LogType.Log,
TAG,
"Token was found in the arguments.");
906 string token = arguments[
"pixotoken"];
907 Debug.unityLogger.Log(LogType.Log,
TAG, $
"Found pixotoken {token}.");
908 if (!
string.IsNullOrEmpty(token))
918 Debug.unityLogger.Log(LogType.Log,
TAG,
"_CheckModuleAccess called.");
922 Debug.unityLogger.Log(LogType.Error,
TAG,
"Cannot check user's module access with no active login.");
926 if (targetModuleID <= -1)
931 Debug.unityLogger.Log(LogType.Log,
TAG, $
"Checking module access of module {targetModuleID} from user {currentActiveLogin.ID} and device serial number {(string.IsNullOrEmpty(deviceSerialNumber) == true ? "---
" : deviceSerialNumber)}");
941 Debug.unityLogger.Log(LogType.Error,
TAG,
"Cannot join session with no active login.");
950 if (newScenarioID !=
null)
957 Debug.unityLogger.Log(LogType.Error,
TAG,
958 "Session is already in progress."
959 +
" The previous session didn't complete or a new session was started during an active session."
965 Statement sessionStatement =
new Statement();
966 Agent sessionActor =
new Agent();
969 Verb sessionVerb =
new Verb();
971 sessionVerb.display =
new LanguageMap();
972 sessionVerb.display.Add(
"en",
"Joined Session");
974 Activity sessionActivity =
new Activity();
975 sessionActivity.id =
string.Format(
"https://pixovr.com/xapi/objects/{0}/{1}",
moduleID,
scenarioID);
977 Context sessionContext =
new Context();
984 sessionStatement.actor = sessionActor;
985 sessionStatement.verb = sessionVerb;
986 sessionStatement.target = sessionActivity;
987 sessionStatement.context = sessionContext;
995 sessionData.JsonData = sessionStatement;
1007 if (verbName ==
null)
1010 if (verbName.Length == 0)
1013 Statement sessionStatement =
new Statement();
1014 Agent sessionActor =
new Agent();
1017 Verb sessionVerb =
new Verb();
1018 sessionVerb.id =
new Uri(
"https://pixovr.com/xapi/verbs/" + verbName.Replace(
' ',
'_').ToLower());
1019 sessionVerb.display =
new LanguageMap();
1020 sessionVerb.display.Add(
"en", verbName);
1022 Activity sessionActivity =
new Activity();
1023 sessionActivity.id =
string.Format(
1024 "https://pixovr.com/xapi/objects/{0}/{1}/{2}",
1027 targetObject.Replace(
' ',
'_').ToLower()
1030 Context sessionContext =
new Context();
1033 sessionContext.platform =
platform;
1037 sessionStatement.actor = sessionActor;
1038 sessionStatement.verb = sessionVerb;
1039 sessionStatement.target = sessionActivity;
1040 sessionStatement.context = sessionContext;
1047 sessionEvent.JsonData = sessionStatement;
1063 Debug.unityLogger.Log(LogType.Error,
TAG,
"Cannot send a session event with no active login.");
1069 Debug.unityLogger.Log(LogType.Error,
TAG,
"No session in progress to send event for.");
1073 if (eventStatement ==
null)
1075 Debug.unityLogger.Log(LogType.Error,
TAG,
"No event data to send.");
1079 if (eventStatement.actor !=
null)
1081 Debug.unityLogger.Log(LogType.Warning,
TAG,
"Actor data should not be filled out.");
1084 if (eventStatement.verb ==
null)
1086 Debug.unityLogger.Log(LogType.Error,
TAG,
"Verb missing from eventStatement.");
1090 if (eventStatement.verb.id ==
null)
1092 Debug.unityLogger.Log(LogType.Error,
TAG,
"verb.id missing from eventStatement.");
1096 if (eventStatement.target ==
null)
1098 Debug.unityLogger.Log(LogType.Error,
TAG,
"Object (target) missing from eventStatement.");
1102 eventStatement.actor =
new Agent();
1105 if (eventStatement.context ==
null)
1107 eventStatement.context =
new Context();
1112 eventStatement.context.platform =
platform;
1121 sessionEvent.JsonData = eventStatement;
1141 Debug.unityLogger.Log(LogType.Error,
TAG,
"Cannot complete session with no active login.");
1147 Debug.unityLogger.Log(LogType.Error,
TAG,
"No session in progress to complete.");
1152 Agent sessionActor =
new Agent();
1156 Verb sessionVerb =
new Verb();
1158 sessionVerb.display =
new LanguageMap();
1159 sessionVerb.display.Add(
"en",
"Completed Session");
1162 Activity sessionActivity =
new Activity();
1163 sessionActivity.id =
string.Format(
"https://pixovr.com/xapi/objects/{0}/{1}",
moduleID,
scenarioID);
1166 Context sessionContext =
new Context();
1169 sessionContext.platform =
platform;
1174 Result sessionResult =
new Result();
1175 sessionResult.completion = currentSessionData.
Complete;
1176 sessionResult.success = currentSessionData.
Success;
1178 sessionResult.score =
new Score();
1179 sessionResult.score.min = currentSessionData.
MinimumScore;
1180 sessionResult.score.max = currentSessionData.
MaximumScore;
1181 sessionResult.score.raw = currentSessionData.
Score;
1184 currentSessionData.
Score,
1187 sessionResult.duration = TimeSpan.FromSeconds(currentSessionData.
Duration);
1188 if (resultExtension !=
null)
1190 sessionResult.extensions =
new Extensions(resultExtension.
ToJObject());
1194 Statement sessionStatement =
new Statement();
1195 sessionStatement.actor = sessionActor;
1196 sessionStatement.verb = sessionVerb;
1197 sessionStatement.target = sessionActivity;
1198 sessionStatement.context = sessionContext;
1199 sessionStatement.result = sessionResult;
1206 sessionData.JsonData = sessionStatement;
1207 sessionData.SessionDuration = currentSessionData.
Duration;
1208 sessionData.Score = currentSessionData.
Score;
1209 sessionData.ScoreMin = currentSessionData.
MinimumScore;
1210 sessionData.ScoreMax = currentSessionData.
MaximumScore;
1213 currentSessionData.
Score,
1224 Debug.unityLogger.Log(LogType.Log,
TAG,
"Sending heartbeat...");
1236 protected bool _GetUser(
int userId = -1)
1275 if (String.IsNullOrEmpty(serialNumber))
return false;
1281 protected bool _QuickIDLogin(
string serialNumber,
string username)
1283 if (String.IsNullOrEmpty(serialNumber) ||
string.IsNullOrEmpty(username))
return false;
1291 float determinedScaledScore = scaledScore;
1293 if (scaledScore < Mathf.Epsilon && score >= Mathf.Epsilon)
1295 determinedScaledScore = (score / maxScore) * 100f;
1298 return determinedScaledScore;
1309 if (currentContextExtension !=
null)
1311 contextExtension = currentContextExtension;
1328 return new Extensions(contextExtension.
ToJObject());
1333 Debug.unityLogger.Log(LogType.Log,
TAG,
"On API Response");
1334 bool success = message.IsSuccessStatusCode;
1346 Debug.unityLogger.Log(LogType.Log,
TAG,
"Ping successful.");
1351 Debug.unityLogger.Log(LogType.Log,
TAG,
"Ping failed.");
1358 Debug.unityLogger.Log(LogType.Log,
TAG,
"Calling to handle login.");
1371 Debug.unityLogger.Log(LogType.Log,
TAG,
string.Format(
"Failed to get user.\nError: {0}", failureData.
Message));
1385 Debug.unityLogger.Log(LogType.Log,
TAG,
string.Format(
"Failed to get user.\nError: {0}", failureData.
Message));
1395 Debug.unityLogger.Log(LogType.Log,
TAG,
string.Format(
"Session Id is {0}.", joinSessionResponse.
SessionId));
1403 Debug.unityLogger.Log(LogType.Log,
TAG,
1404 string.Format(
"Failed to join session.\nError: {0}", failureData.
Message)
1423 Debug.unityLogger.Log(LogType.Log,
TAG,
1424 string.Format(
"Failed to complete session.\nError: {0}", failureData.
Message)
1434 Debug.unityLogger.Log(LogType.Log,
TAG,
"Session event sent.");
1440 Debug.unityLogger.Log(LogType.Log,
TAG,
1441 string.Format(
"Failed to send session event.\nError: {0}", failureData.
Message)
1452 if (userAccessResponseContent.Access)
1454 if (userAccessResponseContent.PassingScore.HasValue)
1456 currentActiveLogin.MinimumPassingScore = userAccessResponseContent.
PassingScore.Value;
1471 Message =
"User does not have access to module",
1479 Debug.unityLogger.Log(LogType.Log,
TAG,
1481 "Failed to get users module access data.\nError: {0}",
1499 Debug.unityLogger.Log(LogType.Log,
TAG,
1500 string.Format(
"Failed to get org modules.\nError: {0}", failureData.
Message)
1517 Debug.unityLogger.Log(LogType.Log,
TAG,
string.Format(
"Failed to get Quick ID Authentication users.\nError: {0}", failureData.
Message));
1533 Debug.unityLogger.Log(LogType.Log,
TAG,
string.Format(
"Failed to authenticate with Quick ID Authentication.\nError: {0}", failureData.
Message));
1548 string.Format(
"[ApexSystem] Failed to get user metrics for org.\nError: {0}", failureData.
Message)
1564 string.Format(
"[ApexSystem] Failed to get devices for org.\nError: {0}", failureData.
Message)
1580 string.Format(
"[ApexSystem] Failed to get session history.\nError: {0}", failureData.
Message)
1598 protected void HandleLogin(
bool successful,
object responseData)
1600 Debug.unityLogger.Log(LogType.Log,
TAG,
"Handling Login");
1617 Debug.unityLogger.Log(LogType.Log,
TAG,
string.Format(
"Failed to log in.\nError: {0}", failureData.
Message));
1633 return Instance._GenerateOneTimeLoginForCurrentUser(success, failure);
1636 public static bool GenerateOneTimeLoginForUser(
int userId, Action<HttpResponseMessage, object> success, Action<HttpResponseMessage, FailureResponse> failure)
1638 return Instance._GenerateOneTimeLoginForUser(userId, success, failure);
1643 if (
Instance.currentActiveLogin ==
null)
1645 return Instance._GetUserMetricsForCurrentUsersOrg(page, filterParams);
1650 if (
Instance.currentActiveLogin ==
null)
1652 return Instance._GetDevicesForOrg(page, filterParams);
1657 if (
Instance.currentActiveLogin ==
null)
1659 return Instance._GetSessionHistory(page, sessionFilters, filterParams);
1661 bool _GenerateOneTimeLoginForUser(
int userId, Action<HttpResponseMessage, object> success, Action<HttpResponseMessage, FailureResponse> failure)
1665 Debug.unityLogger.Log(LogType.Error,
TAG,
"No current user logged in.");
1671 Debug.unityLogger.Log(LogType.Error,
TAG,
"User id is invalid.");
1683 Debug.unityLogger.Log(LogType.Error,
TAG,
"No user logged in to generate code.");
1695 Debug.LogError(
"[ApexSystem] No user logged in to retrieve users.");
1707 Debug.LogError(
"[ApexSystem] No user logged in to retrieve org devices.");
1719 Debug.LogError(
"[ApexSystem] No user logged in to retrieve session history.");
async void SendHeartbeat(string authToken, int sessionId)
async void GetUserMetricsForOrg(string authToken, int orgID, int page, FilterParams filterParams)
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 GetSessionHistory(string authToken, int page, SessionFilters sessionFilters, FilterParams filterParams)
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 GenerateAssistedLogin(string authToken, int userId, Action< HttpResponseMessage, object > success, Action< HttpResponseMessage, FailureResponse > failure)
async void GetQuickIDAuthenticationUsers(string serialNumber)
async void GetUserData(string authToken, int userId)
async void GetDevicesForOrg(string authToken, int orgID, int page, FilterParams filterParams)
async void GetModuleAccess(int moduleId, int userId, string serialNumber)
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)
bool _GenerateOneTimeLoginForUser(int userId, Action< HttpResponseMessage, object > success, Action< HttpResponseMessage, FailureResponse > failure)
OnHttpResponseEvent OnPingSuccess
Extensions AppendStandardContextExtension(Extensions currentContextExtensions)
OnGeneratedAssistedLoginSuccessEvent OnGeneratedAssistedLoginSuccess
bool runSetupOnAwake
[SerializeField]
static string CurrentExitTarget
static string PassedLoginToken
Task socketDisconnectTask
static bool LoginCheckModuleAccess
static bool QuickIDLogin(string serialNumber, string username)
static bool GetCurrentUser()
static bool GenerateOneTimeLoginForCurrentUser(Action< HttpResponseMessage, object > success, Action< HttpResponseMessage, FailureResponse > failure)
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
bool _GenerateOneTimeLoginForCurrentUser(Action< HttpResponseMessage, object > success, Action< HttpResponseMessage, FailureResponse > failure)
OnApexFailureEvent OnGeneratedAssistedLoginFailed
OnGetSessionHistorySuccessEvent OnGetSessionHistorySuccess
static string APIEndpoint
string targetTypeParameter
static bool GetDevicesForOrg(int page, FilterParams filterParams)
OnHttpResponseEvent OnPingFailed
static bool SendSessionEvent(Statement eventStatement)
OnGetQuickIDAuthUsersSuccessEvent OnGetQuickIDAuthGetUsersSuccess
string GetWebEndpointFromPlatformTarget(PlatformServer target)
void OnAPIResponse(ResponseType response, HttpResponseMessage message, object responseData)
static void ExitApplication(string nextExitTarget="")
OnHttpResponseEvent OnJoinSessionSuccess
OnApexFailureEvent OnGetUserFailed
OnGetDevicesForOrgSuccessEvent OnGetDevicesForOrgSuccess
bool _GetSessionHistory(int page, SessionFilters sessionFilters, FilterParams filterParams)
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 OnGetSessionHistoryFailed
OnApexFailureEvent OnSendEventFailed
static bool GetUserMetricsForCurrentUsersOrg(int page, FilterParams filterParams)
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)
string currentExitTargetParameter
static bool SendSimpleSessionEvent(string action, string targetObject, Extension contextExtension)
OnGetUserMetricsForOrgSuccessEvent OnGetUserMetricsForOrgSuccess
float DetermineScaledScore(float scaledScore, float score, float maxScore)
APIHandler apexAPIHandler
static bool GetCurrentUserModules()
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]
static bool GetSesssionHistory(int page, SessionFilters sessionFilters, FilterParams filterParams)
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)
static readonly Regex VersionValidator
OnApexFailureEvent OnGetDevicesForOrgFailed
OnApexFailureEvent OnGetOrganizationModulesFailed
float heartbeatTime
[SerializeField]
OnApexFailureEvent OnModuleAccessFailed
static bool GenerateOneTimeLoginForUser(int userId, Action< HttpResponseMessage, object > success, Action< HttpResponseMessage, FailureResponse > failure)
OnApexFailureEvent OnQuickIDAuthLoginFailed
static string OptionalData
string scenarioID
[SerializeField]
static readonly string TAG
OnModuleAccessSuccessEvent OnModuleAccessSuccess
bool _GetDevicesForOrg(int page, FilterParams filterParams)
void _ExitApplication(string nextExitApplication)
bool _GetUser(int userId=-1)
OnGetUserSuccessEvent OnGetUserSuccess
OnHttpResponseEvent OnSendEventSuccess
bool _QuickIDLogin(string serialNumber, string username)
bool _GetUserMetricsForCurrentUsersOrg(int page, FilterParams filterParams)
bool _CheckModuleAccess(int targetModuleID=-1)
static bool CompleteSession(SessionData currentSessionData, Extension contextExtension=null, Extension resultExtension=null)
bool IsModuleVersionOnlyNumerical()
OnApexFailureEvent OnGetUserMetricsForOrgFailed
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)