feat: WIP: account login progress
This commit is contained in:
@@ -50,25 +50,33 @@ public abstract class AccountFactory<T extends Account> {
|
||||
}
|
||||
}
|
||||
|
||||
public interface ProgressCallback {
|
||||
void onProgressChanged(String stageName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Informs how this account factory verifies user's credential.
|
||||
*
|
||||
* @see AccountLoginType
|
||||
*/
|
||||
public abstract AccountLoginType getLoginType();
|
||||
|
||||
/**
|
||||
* Create a new(to be verified via network) account, and log in.
|
||||
* @param selector for character selection if multiple characters belong to single account. Pick out which character to act as.
|
||||
* @param username username of the account if needed.
|
||||
* @param password password of the account if needed.
|
||||
* @param additionalData extra data for specific account factory.
|
||||
*
|
||||
* @param selector for character selection if multiple characters belong to single account. Pick out which character to act as.
|
||||
* @param username username of the account if needed.
|
||||
* @param password password of the account if needed.
|
||||
* @param progressCallback notify login progress.
|
||||
* @param additionalData extra data for specific account factory.
|
||||
* @return logged-in account.
|
||||
* @throws AuthenticationException if an error occurs when logging in.
|
||||
*/
|
||||
public abstract T create(CharacterSelector selector, String username, String password, Object additionalData) throws AuthenticationException;
|
||||
public abstract T create(CharacterSelector selector, String username, String password, ProgressCallback progressCallback, Object additionalData) throws AuthenticationException;
|
||||
|
||||
/**
|
||||
* Create a existing(stored in local files) account.
|
||||
*
|
||||
* @param storage serialized account data.
|
||||
* @return account stored in local storage. Credentials may expired, and you should refresh account state later.
|
||||
*/
|
||||
|
||||
@@ -50,7 +50,7 @@ public class AuthlibInjectorAccountFactory extends AccountFactory<AuthlibInjecto
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthlibInjectorAccount create(CharacterSelector selector, String username, String password, Object additionalData) throws AuthenticationException {
|
||||
public AuthlibInjectorAccount create(CharacterSelector selector, String username, String password, ProgressCallback progressCallback, Object additionalData) throws AuthenticationException {
|
||||
Objects.requireNonNull(selector);
|
||||
Objects.requireNonNull(username);
|
||||
Objects.requireNonNull(password);
|
||||
|
||||
@@ -38,7 +38,7 @@ public class MicrosoftAccountFactory extends AccountFactory<MicrosoftAccount> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MicrosoftAccount create(CharacterSelector selector, String username, String password, Object additionalData) throws AuthenticationException {
|
||||
public MicrosoftAccount create(CharacterSelector selector, String username, String password, ProgressCallback progressCallback, Object additionalData) throws AuthenticationException {
|
||||
Objects.requireNonNull(selector);
|
||||
|
||||
return new MicrosoftAccount(service, selector);
|
||||
|
||||
@@ -47,7 +47,7 @@ public final class OfflineAccountFactory extends AccountFactory<OfflineAccount>
|
||||
}
|
||||
|
||||
@Override
|
||||
public OfflineAccount create(CharacterSelector selector, String username, String password, Object additionalData) {
|
||||
public OfflineAccount create(CharacterSelector selector, String username, String password, ProgressCallback progressCallback, Object additionalData) {
|
||||
return new OfflineAccount(username, getUUIDFromUserName(username));
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public class YggdrasilAccountFactory extends AccountFactory<YggdrasilAccount> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public YggdrasilAccount create(CharacterSelector selector, String username, String password, Object additionalData) throws AuthenticationException {
|
||||
public YggdrasilAccount create(CharacterSelector selector, String username, String password, ProgressCallback progressCallback, Object additionalData) throws AuthenticationException {
|
||||
Objects.requireNonNull(selector);
|
||||
Objects.requireNonNull(username);
|
||||
Objects.requireNonNull(password);
|
||||
|
||||
Reference in New Issue
Block a user