Move unauthenticatedApiController
The constructor of AccountSessionManager may need this object which could lead to a situation where it was being used before it had been created. Making it static and moving it to MastodonAPIRequest, the only place it was being used anyways, seems to fix the issue.
This commit is contained in:
@@ -37,6 +37,8 @@ import okhttp3.Response;
|
||||
public abstract class MastodonAPIRequest<T> extends APIRequest<T>{
|
||||
private static final String TAG="MastodonAPIRequest";
|
||||
|
||||
private static MastodonAPIController unauthenticatedApiController=new MastodonAPIController(null);
|
||||
|
||||
private String domain;
|
||||
private AccountSession account;
|
||||
private String path;
|
||||
@@ -95,14 +97,14 @@ public abstract class MastodonAPIRequest<T> extends APIRequest<T>{
|
||||
|
||||
public MastodonAPIRequest<T> execNoAuth(String domain){
|
||||
this.domain=domain;
|
||||
AccountSessionManager.getInstance().getUnauthenticatedApiController().submitRequest(this);
|
||||
unauthenticatedApiController.submitRequest(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MastodonAPIRequest<T> exec(String domain, Token token){
|
||||
this.domain=domain;
|
||||
this.token=token;
|
||||
AccountSessionManager.getInstance().getUnauthenticatedApiController().submitRequest(this);
|
||||
unauthenticatedApiController.submitRequest(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,6 @@ public class AccountSessionManager{
|
||||
private HashMap<String, List<EmojiCategory>> customEmojis=new HashMap<>();
|
||||
private HashMap<String, Long> instancesLastUpdated=new HashMap<>();
|
||||
private HashMap<String, Instance> instances=new HashMap<>();
|
||||
private MastodonAPIController unauthenticatedApiController=new MastodonAPIController(null);
|
||||
private Instance authenticatingInstance;
|
||||
private Application authenticatingApp;
|
||||
private String lastActiveAccountID;
|
||||
@@ -232,11 +231,6 @@ public class AccountSessionManager{
|
||||
maybeUpdateShortcuts();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public MastodonAPIController getUnauthenticatedApiController(){
|
||||
return unauthenticatedApiController;
|
||||
}
|
||||
|
||||
public void authenticate(Activity activity, Instance instance){
|
||||
authenticatingInstance=instance;
|
||||
new CreateOAuthApp()
|
||||
|
||||
Reference in New Issue
Block a user