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).
- Listed in Menus, UI and platforms
- Inherits or implements
LoginAndRegisterHelper - Nested types
AccountRegisteringSteps,LastCheckedField
Constructors
| Member | What it is |
|---|---|
AltaAccountRegistererAndLinker() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
25 private and internal fields
| Member | What it is |
|---|---|
private IAuthenticationUtility authenticationUtility | Used to log in with username and password after registering when platform login is not supported. |
private InputField confirmPasswordInput | The confirm password field. |
private InputField emailInput | The email field. |
private GameObject[] fieldChecks | Tick objects, one per field. |
private GameObject[] fieldCrosses | Cross objects, one per field. |
private GameObject[] fieldErrors | Error objects, one per field. |
private MeshFilter[] frames | Frame mesh filters, one per field, swapped to show valid or invalid. |
private string intendedGenericError | The error text to show once validation finishes. |
private Mesh invalidFrame | Frame mesh copy tinted with invalidFrameColor. |
private Color invalidFrameColor | Vertex colour for an invalid field's frame. |
private bool isConvertingToLinearColor | Whether the frame colours are converted to linear space first. |
private TouchScreenKeyboard keyboard | The VR keyboard whose input changes trigger validation. |
private AltaAccountRegistererAndLinker.LastCheckedField lastCheckedEmail | Cache of the last email checked and its result, so the API is not asked again. |
private AltaAccountRegistererAndLinker.LastCheckedField lastCheckedUsername | Cache of the last username checked and its result. |
private static readonly Logger logger | NLog logger for this class. |
private AnimatorSetup onFailedToRegisterAccountFade | Animator fade played when registration fails. |
private UnityEvent onValidConfirm | Event run when CheckConfirm passes. |
private UnityEvent onValidSubmit | Event run after the account is registered and logged in. |
private Mesh originalFrameMesh | Untinted frame mesh, used for empty fields and as the base for the tinted copies. |
private static readonly string ScreenName | Screen name reported to signup analytics ("Account Registration"). |
private float timer | Seconds left before the typing pause triggers validation. |
private IUnityUpdateMethod updateValidationTimer | Handle for the registered timer update method. |
private IUserService userService | User service used to register the account and for platform login. |
private Mesh validFrame | Frame mesh copy tinted with validFrameColor. |
private Color validFrameColor | Vertex colour for a valid field's frame. |
Methods
| Member | What 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
| Member | What 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: