Added a feature for editing coordinates (#4418)

* not

* Place Picker added

* Pick location and API call linked

* minor warnings resolved

* Code conventions followed

* issue fixed

* Wikitext edited properly

* minor modification

* Location Picker added

* Bottom sheet removed

* Location picker fully implemented

* credit added

* credit added

* issues fixed

* issues fixed

* minor issue fixed
This commit is contained in:
Ayan Sarkar 2021-06-13 09:06:47 +05:30 committed by GitHub
parent 15e66f5278
commit 20f74a90c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 924 additions and 12 deletions

View file

@ -1,6 +1,7 @@
package fr.free.nrw.commons.actions
import io.reactivex.Observable
import io.reactivex.Single
import org.wikipedia.csrf.CsrfTokenClient
/**
@ -62,4 +63,15 @@ class PageEditClient(
Observable.just(false)
}
}
/**
* Get whole WikiText of required file
* @param title : Name of the file
* @return Observable<MwQueryResult>
*/
fun getCurrentWikiText(title: String): Single<String?> {
return pageEditInterface.getWikiText(title).map {
it.query()?.pages()?.get(0)?.revisions()?.get(0)?.content()
}
}
}

View file

@ -1,12 +1,11 @@
package fr.free.nrw.commons.actions
import io.reactivex.Observable
import io.reactivex.Single
import org.wikipedia.dataclient.Service
import org.wikipedia.dataclient.mwapi.MwQueryResponse
import org.wikipedia.edit.Edit
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.Headers
import retrofit2.http.POST
import retrofit2.http.*
/**
* This interface facilitates wiki commons page editing services to the Networking module
@ -73,4 +72,17 @@ interface PageEditInterface {
@Field("prependtext") prependText: String,
@Field("token") token: String
): Observable<Edit>
/**
* Get wiki text for provided file names
* @param titles : Name of the file
* @return Single<MwQueryResult>
*/
@GET(
Service.MW_API_PREFIX +
"action=query&prop=revisions&rvprop=content|timestamp&rvlimit=1&converttitles="
)
fun getWikiText(
@Query("titles") title: String
): Single<MwQueryResponse?>
}