Fix reporting private messages

This commit is contained in:
Phillip Thelen 2019-09-09 17:11:13 +02:00
parent bdf07b29f6
commit 82af9d4635
5 changed files with 13 additions and 18 deletions

View file

@ -269,6 +269,9 @@ interface ApiService {
@GET("members/find/{username}")
fun findUsernames(@Path("username") username: String, @Query("context") context: String?, @Query("id") id: String?): Flowable<HabitResponse<List<FindUsernameResult>>>
@POST("members/flag-private-message/{mid}")
fun flagInboxMessage(@Path("mid") mid: String, @Body data: Map<String, String>): Flowable<HabitResponse<Void>>
@GET("shops/{identifier}")
fun retrieveShopInventory(@Path("identifier") identifier: String): Flowable<HabitResponse<Shop>>

View file

@ -148,6 +148,7 @@ interface ApiClient {
fun likeMessage(groupId: String, mid: String): Flowable<ChatMessage>
fun flagMessage(groupId: String, mid: String, data: MutableMap<String, String>): Flowable<Void>
fun flagInboxMessage(mid: String, data: MutableMap<String, String>): Flowable<Void>
fun seenMessages(groupId: String): Flowable<Void>

View file

@ -522,6 +522,10 @@ class ApiClientImpl//private OnHabitsAPIResult mResultListener;
return apiService.flagMessage(groupId, mid, data).compose(configureApiCallObserver())
}
override fun flagInboxMessage(mid: String, data: MutableMap<String, String>): Flowable<Void> {
return apiService.flagInboxMessage(mid, data).compose(configureApiCallObserver())
}
override fun seenMessages(groupId: String): Flowable<Void> {
return apiService.seenMessages(groupId).compose(configureApiCallObserver())
}

View file

@ -75,7 +75,11 @@ class SocialRepositoryImpl(localRepository: SocialLocalRepository, apiClient: Ap
else -> {
val data = mutableMapOf<String, String>()
data["comment"] = additionalInfo
apiClient.flagMessage(chatMessage.groupId ?: "", chatMessage.id, data)
if (chatMessage.isInboxMessage) {
apiClient.flagInboxMessage(chatMessage.id, data)
} else {
apiClient.flagMessage(chatMessage.groupId ?: "", chatMessage.id, data)
}
}
}
}

View file

@ -14,13 +14,10 @@ import com.habitrpg.android.habitica.components.UserComponent
import com.habitrpg.android.habitica.data.UserRepository
import com.habitrpg.android.habitica.events.ConsumablePurchasedEvent
import com.habitrpg.android.habitica.helpers.PurchaseTypes
import com.habitrpg.android.habitica.helpers.RxErrorHandler
import com.habitrpg.android.habitica.models.user.ABTest
import com.habitrpg.android.habitica.proxy.CrashlyticsProxy
import com.habitrpg.android.habitica.ui.fragments.GemsPurchaseFragment
import com.habitrpg.android.habitica.ui.fragments.SubscriptionFragment
import com.habitrpg.android.habitica.ui.helpers.bindView
import io.reactivex.functions.Consumer
import org.greenrobot.eventbus.Subscribe
import org.solovyev.android.checkout.*
import java.util.*
@ -70,20 +67,6 @@ class GemPurchaseActivity : BaseActivity() {
viewPager.currentItem = 0
setViewPagerAdapter()
compositeSubscription.add(userRepository.getUser().subscribe(Consumer { user ->
for (test in user.abTests ?: emptyList<ABTest>()) {
if (test.name == "subscriptionPageOrder") {
if (test.group == "subscriptionFirst") {
showSubscriptionPageFirst = true
viewPager.adapter?.notifyDataSetChanged()
return@Consumer
}
}
}
showSubscriptionPageFirst = false
viewPager.adapter?.notifyDataSetChanged()
}, RxErrorHandler.handleEmptyError()))
}
override fun onStart() {