Support setting filter expirations (#2667)

* Show filter expiration in list

* Add support for setting and updating the duration of a filter

* Add tests for duration conversion math

* Refactor network wrapper code

* Mark updated mastodon api functions as suspend

* Avoid creating unnecessary Date objects

* Apply suggestions to filter dialog layout
This commit is contained in:
Levi Bard 2022-08-17 17:50:34 +02:00 committed by GitHub
commit c47d9ef6ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 197 additions and 100 deletions

View file

@ -531,29 +531,29 @@ interface MastodonApi {
@FormUrlEncoded
@POST("api/v1/filters")
fun createFilter(
suspend fun createFilter(
@Field("phrase") phrase: String,
@Field("context[]") context: List<String>,
@Field("irreversible") irreversible: Boolean?,
@Field("whole_word") wholeWord: Boolean?,
@Field("expires_in") expiresIn: Int?
): Call<Filter>
@Field("expires_in") expiresInSeconds: Int?
): NetworkResult<Filter>
@FormUrlEncoded
@PUT("api/v1/filters/{id}")
fun updateFilter(
suspend fun updateFilter(
@Path("id") id: String,
@Field("phrase") phrase: String,
@Field("context[]") context: List<String>,
@Field("irreversible") irreversible: Boolean?,
@Field("whole_word") wholeWord: Boolean?,
@Field("expires_in") expiresIn: Int?
): Call<Filter>
@Field("expires_in") expiresInSeconds: Int?
): NetworkResult<Filter>
@DELETE("api/v1/filters/{id}")
fun deleteFilter(
suspend fun deleteFilter(
@Path("id") id: String
): Call<ResponseBody>
): NetworkResult<ResponseBody>
@FormUrlEncoded
@POST("api/v1/polls/{id}/votes")