Remove rxjava from API calls used by AccountViewModel::changeRelationship() (#3008)
* Remove rxjava from API calls used by AccountListFragment * Remove rxjava from API calls used by AccountViewModel::changeRelationship() The affected API functions are also called from - ReportViewModel.kt - SearchViewModel.kt - AccountListFragment.kt - SFragment.java - TimelineCases.kt so they have also been updated. This change requires bridging from Java code to Kotlin `suspend` functions, by creating wrappers for the `mute` and `block` functions that can be called from Java and create a coroutine scope. I've deliberately made this fairly ugly so that it sticks out and can be removed later. * Use "Throwable" type and name * Delete 46.json Not sure where this came from. * Emit log messages with the correct tag * Add another log tag, and lint * Move viewModelScope.launch in to changeRelationshop()
This commit is contained in:
parent
68f20e03c4
commit
a21f2fadf9
7 changed files with 145 additions and 142 deletions
|
|
@ -359,39 +359,39 @@ interface MastodonApi {
|
|||
|
||||
@FormUrlEncoded
|
||||
@POST("api/v1/accounts/{id}/follow")
|
||||
fun followAccount(
|
||||
suspend fun followAccount(
|
||||
@Path("id") accountId: String,
|
||||
@Field("reblogs") showReblogs: Boolean? = null,
|
||||
@Field("notify") notify: Boolean? = null
|
||||
): Single<Relationship>
|
||||
): Relationship
|
||||
|
||||
@POST("api/v1/accounts/{id}/unfollow")
|
||||
fun unfollowAccount(
|
||||
suspend fun unfollowAccount(
|
||||
@Path("id") accountId: String
|
||||
): Single<Relationship>
|
||||
): Relationship
|
||||
|
||||
@POST("api/v1/accounts/{id}/block")
|
||||
fun blockAccount(
|
||||
suspend fun blockAccount(
|
||||
@Path("id") accountId: String
|
||||
): Single<Relationship>
|
||||
): Relationship
|
||||
|
||||
@POST("api/v1/accounts/{id}/unblock")
|
||||
fun unblockAccount(
|
||||
suspend fun unblockAccount(
|
||||
@Path("id") accountId: String
|
||||
): Single<Relationship>
|
||||
): Relationship
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("api/v1/accounts/{id}/mute")
|
||||
fun muteAccount(
|
||||
suspend fun muteAccount(
|
||||
@Path("id") accountId: String,
|
||||
@Field("notifications") notifications: Boolean? = null,
|
||||
@Field("duration") duration: Int? = null
|
||||
): Single<Relationship>
|
||||
): Relationship
|
||||
|
||||
@POST("api/v1/accounts/{id}/unmute")
|
||||
fun unmuteAccount(
|
||||
suspend fun unmuteAccount(
|
||||
@Path("id") accountId: String
|
||||
): Single<Relationship>
|
||||
): Relationship
|
||||
|
||||
@GET("api/v1/accounts/relationships")
|
||||
fun relationships(
|
||||
|
|
@ -399,14 +399,14 @@ interface MastodonApi {
|
|||
): Single<List<Relationship>>
|
||||
|
||||
@POST("api/v1/pleroma/accounts/{id}/subscribe")
|
||||
fun subscribeAccount(
|
||||
suspend fun subscribeAccount(
|
||||
@Path("id") accountId: String
|
||||
): Single<Relationship>
|
||||
): Relationship
|
||||
|
||||
@POST("api/v1/pleroma/accounts/{id}/unsubscribe")
|
||||
fun unsubscribeAccount(
|
||||
suspend fun unsubscribeAccount(
|
||||
@Path("id") accountId: String
|
||||
): Single<Relationship>
|
||||
): Relationship
|
||||
|
||||
@GET("api/v1/blocks")
|
||||
suspend fun blocks(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue