Chuyển tới nội dung chính

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​

PropertyTypeDescription
CurrentProjectVAccountSnapshotThe 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

NameTypeDescription
listenerAction<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

ExceptionWhen
ArgumentNullExceptionlistener is null.
ObjectDisposedExceptionThe 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

NameTypeDescription
cancellationTokenCancellationTokenCancels 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

NameTypeDescription
cancellationTokenCancellationTokenCancels 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

NameTypeDescription
cancellationTokenCancellationTokenCancels the request.

Returns

Task<ProjectVAccountCommandResult>: On success the status is SignedOut: open the Login scene. Otherwise ProjectVAccountSnapshot.Error says why.