mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 21:33:53 +01:00
Removed references to the data-client Service interface (#5484)
This commit is contained in:
parent
8222c4a42c
commit
9e970123fd
15 changed files with 38 additions and 61 deletions
|
|
@ -1,6 +1,6 @@
|
|||
package fr.free.nrw.commons.auth.csrf
|
||||
|
||||
import org.wikipedia.dataclient.Service
|
||||
import fr.free.nrw.commons.wikidata.WikidataConstants.MW_API_PREFIX
|
||||
import org.wikipedia.dataclient.mwapi.MwQueryResponse
|
||||
import retrofit2.Call
|
||||
import retrofit2.http.GET
|
||||
|
|
@ -8,6 +8,6 @@ import retrofit2.http.Headers
|
|||
|
||||
interface CsrfTokenInterface {
|
||||
@Headers("Cache-Control: no-cache")
|
||||
@GET(Service.MW_API_PREFIX + "action=query&meta=tokens&type=csrf")
|
||||
@GET(MW_API_PREFIX + "action=query&meta=tokens&type=csrf")
|
||||
fun getCsrfTokenCall(): Call<MwQueryResponse?>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ package fr.free.nrw.commons.auth.login
|
|||
import android.text.TextUtils
|
||||
import fr.free.nrw.commons.auth.login.LoginResult.OAuthResult
|
||||
import fr.free.nrw.commons.auth.login.LoginResult.ResetPasswordResult
|
||||
import fr.free.nrw.commons.wikidata.WikidataConstants.WIKIPEDIA_URL
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import org.wikipedia.dataclient.Service
|
||||
import org.wikipedia.dataclient.ServiceFactory
|
||||
import org.wikipedia.dataclient.WikiSite
|
||||
import org.wikipedia.dataclient.mwapi.MwQueryResponse
|
||||
|
|
@ -57,7 +57,7 @@ class LoginClient {
|
|||
|
||||
loginCall = if (twoFactorCode.isNullOrEmpty() && retypedPassword.isNullOrEmpty()) {
|
||||
ServiceFactory.get(wiki, LoginInterface::class.java)
|
||||
.postLogIn(userName, password, loginToken, userLanguage, Service.WIKIPEDIA_URL)
|
||||
.postLogIn(userName, password, loginToken, userLanguage, WIKIPEDIA_URL)
|
||||
} else {
|
||||
ServiceFactory.get(wiki, LoginInterface::class.java).postLogIn(
|
||||
userName, password, retypedPassword, twoFactorCode, loginToken, userLanguage, true
|
||||
|
|
@ -115,8 +115,7 @@ class LoginClient {
|
|||
val loginToken = tokenResponse.body()?.query()?.loginToken()
|
||||
val tempLoginCall = if (twoFactorCode.isNullOrEmpty()) {
|
||||
ServiceFactory.get(wiki, LoginInterface::class.java).postLogIn(
|
||||
userName, password, loginToken, userLanguage, Service.WIKIPEDIA_URL
|
||||
)
|
||||
userName, password, loginToken, userLanguage, WIKIPEDIA_URL)
|
||||
} else {
|
||||
ServiceFactory.get(wiki, LoginInterface::class.java).postLogIn(
|
||||
userName, password, null, twoFactorCode, loginToken, userLanguage, true
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package fr.free.nrw.commons.auth.login
|
||||
|
||||
import fr.free.nrw.commons.wikidata.WikidataConstants.MW_API_PREFIX
|
||||
import io.reactivex.Observable
|
||||
import org.wikipedia.dataclient.Service
|
||||
import org.wikipedia.dataclient.mwapi.MwQueryResponse
|
||||
import retrofit2.Call
|
||||
import retrofit2.http.Field
|
||||
|
|
@ -13,12 +13,12 @@ import retrofit2.http.Query
|
|||
|
||||
interface LoginInterface {
|
||||
@Headers("Cache-Control: no-cache")
|
||||
@GET(Service.MW_API_PREFIX + "action=query&meta=tokens&type=login")
|
||||
@GET(MW_API_PREFIX + "action=query&meta=tokens&type=login")
|
||||
fun getLoginToken(): Call<MwQueryResponse?>
|
||||
|
||||
@Headers("Cache-Control: no-cache")
|
||||
@FormUrlEncoded
|
||||
@POST(Service.MW_API_PREFIX + "action=clientlogin&rememberMe=")
|
||||
@POST(MW_API_PREFIX + "action=clientlogin&rememberMe=")
|
||||
fun postLogIn(
|
||||
@Field("username") user: String?,
|
||||
@Field("password") pass: String?,
|
||||
|
|
@ -29,7 +29,7 @@ interface LoginInterface {
|
|||
|
||||
@Headers("Cache-Control: no-cache")
|
||||
@FormUrlEncoded
|
||||
@POST(Service.MW_API_PREFIX + "action=clientlogin&rememberMe=")
|
||||
@POST(MW_API_PREFIX + "action=clientlogin&rememberMe=")
|
||||
fun postLogIn(
|
||||
@Field("username") user: String?,
|
||||
@Field("password") pass: String?,
|
||||
|
|
@ -40,6 +40,6 @@ interface LoginInterface {
|
|||
@Field("logincontinue") loginContinue: Boolean
|
||||
): Call<LoginResponse?>
|
||||
|
||||
@GET(Service.MW_API_PREFIX + "action=query&meta=userinfo&list=users&usprop=groups|cancreate")
|
||||
@GET(MW_API_PREFIX + "action=query&meta=userinfo&list=users&usprop=groups|cancreate")
|
||||
fun getUserInfo(@Query("ususers") userName: String): Observable<MwQueryResponse?>
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue