mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 21:33:53 +01:00
With more unit test cases (#3269)
This commit is contained in:
parent
d2fb3b36e7
commit
f27749fa51
7 changed files with 139 additions and 30 deletions
|
|
@ -1,15 +1,16 @@
|
|||
package fr.free.nrw.commons.auth;
|
||||
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import org.wikipedia.dataclient.Service;
|
||||
import org.wikipedia.dataclient.mwapi.MwPostResponse;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
import org.wikipedia.dataclient.Service;
|
||||
import org.wikipedia.dataclient.ServiceFactory;
|
||||
import org.wikipedia.dataclient.WikiSite;
|
||||
import org.wikipedia.dataclient.mwapi.MwPostResponse;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
|
||||
/**
|
||||
* Handler for logout
|
||||
|
|
@ -20,9 +21,8 @@ public class LogoutClient {
|
|||
private final Service service;
|
||||
|
||||
@Inject
|
||||
public LogoutClient(@Named("commons-wikisite")
|
||||
WikiSite commonsWikiSite) {
|
||||
service = ServiceFactory.get(commonsWikiSite);
|
||||
public LogoutClient(@Named("commons-service") Service service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ import android.text.TextUtils;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.facebook.drawee.backends.pipeline.Fresco;
|
||||
import com.facebook.imagepipeline.core.ImagePipeline;
|
||||
import org.wikipedia.login.LoginResult;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
|
@ -91,6 +89,10 @@ public class SessionManager {
|
|||
return currentAccount;
|
||||
}
|
||||
|
||||
public boolean doesAccountExist() {
|
||||
return getCurrentAccount() != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getUserName() {
|
||||
Account account = getCurrentAccount();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue