PushersService.pushers() has been renamed to PushersService.getPushers()

This commit is contained in:
Benoit Marty 2020-02-13 07:01:48 +01:00
parent e492e4318b
commit 6a69c6356d
4 changed files with 33 additions and 14 deletions

View File

@ -8,18 +8,22 @@ Improvements 🙌:
- Show confirmation dialog before deleting a message (#967)
- Open room member profile from reactions list and read receipts list (#875)
Other changes:
-
Bugfix 🐛:
- Fix crash by removing all notifications after clearing cache (#878)
Translations 🗣:
-
SDK API changes 🔞:
- Javadoc improved for PushersService
- PushersService.pushers() has been renamed to PushersService.getPushers()
Build 🧱:
-
Other changes:
-
Changes in RiotX 0.15.0 (2020-02-10)
===================================================
@ -385,15 +389,18 @@ Features ✨:
Improvements 🙌:
-
Other changes:
-
Bugfix 🐛:
-
Translations 🗣:
-
SDK API changes 🔞:
-
Build 🧱:
-
Other changes:
-

View File

@ -17,6 +17,7 @@ package im.vector.matrix.android.api.session.pushers
import androidx.lifecycle.LiveData
import im.vector.matrix.android.api.MatrixCallback
import im.vector.matrix.android.api.util.Cancelable
import java.util.UUID
interface PushersService {
@ -27,7 +28,8 @@ interface PushersService {
fun refreshPushers()
/**
* Add a new HTTP pusher. Only `http` kind is supported by the SDK for now.
* Add a new HTTP pusher.
* Note that only `http` kind is supported by the SDK for now.
* Ref: https://matrix.org/docs/spec/client_server/latest#post-matrix-client-r0-pushers-set
*
* @param pushkey This is a unique identifier for this pusher. The value you should use for
@ -64,9 +66,18 @@ interface PushersService {
append: Boolean,
withEventIdOnly: Boolean): UUID
fun removeHttpPusher(pushkey: String, appId: String, callback: MatrixCallback<Unit>)
/**
* Remove the http pusher
*/
fun removeHttpPusher(pushkey: String, appId: String, callback: MatrixCallback<Unit>): Cancelable
/**
* Get the current pushers, as a LiveData
*/
fun getPushersLive(): LiveData<List<Pusher>>
fun pushers(): List<Pusher>
/**
* Get the current pushers
*/
fun getPushers(): List<Pusher>
}

View File

@ -21,6 +21,7 @@ import com.zhuinden.monarchy.Monarchy
import im.vector.matrix.android.api.MatrixCallback
import im.vector.matrix.android.api.session.pushers.Pusher
import im.vector.matrix.android.api.session.pushers.PushersService
import im.vector.matrix.android.api.util.Cancelable
import im.vector.matrix.android.internal.database.mapper.asDomain
import im.vector.matrix.android.internal.database.model.PusherEntity
import im.vector.matrix.android.internal.database.query.where
@ -86,9 +87,9 @@ internal class DefaultPusherService @Inject constructor(
return request.id
}
override fun removeHttpPusher(pushkey: String, appId: String, callback: MatrixCallback<Unit>) {
override fun removeHttpPusher(pushkey: String, appId: String, callback: MatrixCallback<Unit>): Cancelable {
val params = RemovePusherTask.Params(pushkey, appId)
removePusherTask
return removePusherTask
.configureWith(params) {
this.callback = callback
}
@ -103,7 +104,7 @@ internal class DefaultPusherService @Inject constructor(
)
}
override fun pushers(): List<Pusher> {
override fun getPushers(): List<Pusher> {
return monarchy.fetchAllCopiedSync { PusherEntity.where(it) }.map { it.asDomain() }
}

View File

@ -47,10 +47,10 @@ class TestTokenRegistration @Inject constructor(private val context: AppCompatAc
status = TestStatus.FAILED
return
}
val pusher = session.pushers().filter {
val pushers = session.getPushers().filter {
it.pushKey == fcmToken && it.state == PusherState.REGISTERED
}
if (pusher.isEmpty()) {
if (pushers.isEmpty()) {
description = stringProvider.getString(R.string.settings_troubleshoot_test_token_registration_failed,
stringProvider.getString(R.string.sas_error_unknown))
quickFix = object : TroubleshootQuickFix(R.string.settings_troubleshoot_test_token_registration_quick_fix) {