Skip to main content

AltaAccountRegistererAndLinker

A internal class in Root.Township, Alta.OculusLogin. Reach it through att-stubs' publicized assemblies or Harmony's AccessTools.

Client: the in-VR account registration screen. Checks username, email and password fields live against the API, registers the account, then logs in (with platform credentials if supported).

Constructors​

MemberWhat it is
AltaAccountRegistererAndLinker()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

25 private and internal fields
MemberWhat it is
private IAuthenticationUtility authenticationUtilityUsed to log in with username and password after registering when platform login is not supported.
private InputField confirmPasswordInputThe confirm password field.
private InputField emailInputThe email field.
private GameObject[] fieldChecksTick objects, one per field.
private GameObject[] fieldCrossesCross objects, one per field.
private GameObject[] fieldErrorsError objects, one per field.
private MeshFilter[] framesFrame mesh filters, one per field, swapped to show valid or invalid.
private string intendedGenericErrorThe error text to show once validation finishes.
private Mesh invalidFrameFrame mesh copy tinted with invalidFrameColor.
private Color invalidFrameColorVertex colour for an invalid field's frame.
private bool isConvertingToLinearColorWhether the frame colours are converted to linear space first.
private TouchScreenKeyboard keyboardThe VR keyboard whose input changes trigger validation.
private AltaAccountRegistererAndLinker.LastCheckedField lastCheckedEmailCache of the last email checked and its result, so the API is not asked again.
private AltaAccountRegistererAndLinker.LastCheckedField lastCheckedUsernameCache of the last username checked and its result.
private static readonly Logger loggerNLog logger for this class.
private AnimatorSetup onFailedToRegisterAccountFadeAnimator fade played when registration fails.
private UnityEvent onValidConfirmEvent run when CheckConfirm passes.
private UnityEvent onValidSubmitEvent run after the account is registered and logged in.
private Mesh originalFrameMeshUntinted frame mesh, used for empty fields and as the base for the tinted copies.
private static readonly string ScreenNameScreen name reported to signup analytics ("Account Registration").
private float timerSeconds left before the typing pause triggers validation.
private IUnityUpdateMethod updateValidationTimerHandle for the registered timer update method.
private IUserService userServiceUser service used to register the account and for platform login.
private Mesh validFrameFrame mesh copy tinted with validFrameColor.
private Color validFrameColorVertex colour for a valid field's frame.

Methods​

MemberWhat it is
async void CheckConfirm()Validates every field and runs onValidConfirm if all pass.
override void OnDisable()Unhooks keyboard input and stops the validation timer.
async void ValidateAll()Validates every field and shows the resulting generic error.
protected void Inject(IUserService userService, IAuthenticationUtility authenticationUtility)VContainer injection of the user service (and in one overload the authentication utility).
protected void Inject(IUserService injectedUserService)VContainer injection of the user service (and in one overload the authentication utility).
protected override async Task InternalSubmit()Validates, registers the account through IUserService, then logs in. On success marks the login as an Oculus account and runs onValidSubmit.
15 private and internal methods
MemberWhat it is
private void Awake()Sets up the per-field last-checked caches and builds tinted copies of the frame mesh for valid and invalid fields.
private bool ConfirmPasswordMatch()Checks the confirm password matches the password and updates that field's marks.
private void DisableField(AltaAccountRegistererAndLinker.AccountRegisteringSteps field)Hides a field's error, cross and tick and puts back the plain frame mesh.
private async Task<bool> InternalEmailValidation()Checks the email format locally, then with the API, caching the result for an unchanged value.
private bool InternalPasswordValidation()Requires a password of at least 7 characters.
private async Task<bool> InternalValidateAll()Runs the username, email, password and confirm checks and returns whether all passed.
private async Task<bool> IsUsernameValid()Asks the API to validate the username, showing any error, and caches the result for an unchanged value.
private void OnDestroy()Destroys the tinted frame meshes.
private void OnEnable()Hooks keyboard input changes to the validation timer and reports the registration screen to analytics.
private void ReturnToAccountCreation()Plays the fade used when registration fails.
private void SetErrorMessage(string message, AltaAccountRegistererAndLinker.LastCheckedField field)Shows a message in the generic error text and stores it on the field's cache.
private void UpdateFieldStatus(AltaAccountRegistererAndLinker.AccountRegisteringSteps field, bool status)Shows the tick or the error and cross for a field and swaps its frame to the valid or invalid mesh.
private void UpdateTimer(string input)Restarts a one second timer each time keyboard input changes.
private void UpdateValidationTimer()Counts the timer down and revalidates all fields when it runs out, so checks run after typing pauses.
private async void ValidateAllWithouClearingGenericError()Validates every field without clearing the current error text. Used by the typing timer.

Used in​

Members of other types that take, return or hold a AltaAccountRegistererAndLinker: