IProjectVAccountPresenter interface
The Account contract: logout and two-step account deletion (request, then confirm). Observe the state, call a command, redraw on change. Commands return a result for server and network failures instead of throwing. A command started while another runs waits for it to finish.
Namespace: SilverTiger.ProjectV.Unity.Presentation.Account
public interface IProjectVAccountPresenter
Properties​
| Property | Type | Description |
|---|---|---|
Current | ProjectVAccountSnapshot | The Account state right now; never null. Starts as Ready. |
Methods​
SubscribeAsync(Action<ProjectVAccountSnapshot> listener)​
Calls listener with the current state right away, then again on every change. Open the Login scene when a change has ProjectVAccountSnapshot.RequiresLoginNavigation set.
Task<IDisposable> SubscribeAsync(Action<ProjectVAccountSnapshot> listener);
Parameters
| Name | Type | Description |
|---|---|---|
listener | Action<ProjectVAccountSnapshot> | Redraws the Account UI; must not be null. An exception it throws on a later change is ignored. |
Returns
Task<IDisposable>: The subscription; dispose it when the page closes.
Exceptions
| Exception | When |
|---|---|
ArgumentNullException | listener is null. |
ObjectDisposedException | The presenter was already shut down. |
RequestDeletionAsync(CancellationToken cancellationToken)​
Step one of account deletion: asks the server to start it. Nothing is deleted yet; show the final warning and call ConfirmDeletionAsync when the player confirms.
Task<ProjectVAccountCommandResult> RequestDeletionAsync(CancellationToken cancellationToken);
Parameters
| Name | Type | Description |
|---|---|---|
cancellationToken | CancellationToken | Cancels the request. |
Returns
Task<ProjectVAccountCommandResult>: On success the status is AwaitingDeletionConfirmation and ProjectVAccountSnapshot.PendingDeletion says when the request expires. Otherwise ProjectVAccountSnapshot.Error says why.
ConfirmDeletionAsync(CancellationToken cancellationToken)​
Step two of account deletion: deletes the account for good, then signs the player out on this device. Works only while ProjectVAccountSnapshot.CanConfirmDeletion is true.
Task<ProjectVAccountCommandResult> ConfirmDeletionAsync(CancellationToken cancellationToken);
Parameters
| Name | Type | Description |
|---|---|---|
cancellationToken | CancellationToken | Cancels the request. |
Returns
Task<ProjectVAccountCommandResult>: When ProjectVAccountSnapshot.RemoteDeletionSucceeded is true the account is deleted and the status is SignedOut: open the Login scene. Otherwise ProjectVAccountSnapshot.Error says why, for example no deletion was requested or the request expired; the player must request deletion again.
LogoutAsync(CancellationToken cancellationToken)​
Signs the player out on this device. The account and its progress are kept.
Task<ProjectVAccountCommandResult> LogoutAsync(CancellationToken cancellationToken);
Parameters
| Name | Type | Description |
|---|---|---|
cancellationToken | CancellationToken | Cancels the request. |
Returns
Task<ProjectVAccountCommandResult>: On success the status is SignedOut: open the Login scene. Otherwise ProjectVAccountSnapshot.Error says why.