Account switcher
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package org.joinmastodon.android.api.requests.oauth;
|
||||
|
||||
import org.joinmastodon.android.api.MastodonAPIRequest;
|
||||
|
||||
public class RevokeOauthToken extends MastodonAPIRequest<Object>{
|
||||
public RevokeOauthToken(String clientID, String clientSecret, String token){
|
||||
super(HttpMethod.POST, "/oauth/revoke", Object.class);
|
||||
setRequestBody(new Body(clientID, clientSecret, token));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getPathPrefix(){
|
||||
return "";
|
||||
}
|
||||
|
||||
private static class Body{
|
||||
public String clientId, clientSecret, token;
|
||||
|
||||
public Body(String clientId, String clientSecret, String token){
|
||||
this.clientId=clientId;
|
||||
this.clientSecret=clientSecret;
|
||||
this.token=token;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -131,6 +131,13 @@ public class AccountSessionManager{
|
||||
return lastActiveAccountID;
|
||||
}
|
||||
|
||||
public void setLastActiveAccountID(String id){
|
||||
if(!sessions.containsKey(id))
|
||||
throw new IllegalStateException("Account session "+id+" not found");
|
||||
lastActiveAccountID=id;
|
||||
prefs.edit().putString("lastActiveAccount", id).apply();
|
||||
}
|
||||
|
||||
public void removeAccount(String id){
|
||||
AccountSession session=getAccount(id);
|
||||
sessions.remove(id);
|
||||
|
||||
Reference in New Issue
Block a user