mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 15:44:54 +00:00
Sort provider by index
This commit is contained in:
committed by
Benoit Marty
parent
7333995630
commit
21a07fda07
+1
-2
@@ -35,8 +35,7 @@ class DefaultPushService @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getAvailablePushProviders(): List<PushProvider> {
|
override fun getAvailablePushProviders(): List<PushProvider> {
|
||||||
// TODO Sort by priority?
|
return pushProviders.sortedBy { it.index }
|
||||||
return pushProviders.toList()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun registerWith(matrixClient: MatrixClient, pushProvider: PushProvider, distributorName: String) {
|
override suspend fun registerWith(matrixClient: MatrixClient, pushProvider: PushProvider, distributorName: String) {
|
||||||
|
|||||||
+4
@@ -22,6 +22,10 @@ import io.element.android.libraries.matrix.api.MatrixClient
|
|||||||
* This is the main API for this module
|
* This is the main API for this module
|
||||||
*/
|
*/
|
||||||
interface PushProvider {
|
interface PushProvider {
|
||||||
|
/**
|
||||||
|
* Allow to sort provider, from lower index to higher index
|
||||||
|
*/
|
||||||
|
val index: Int
|
||||||
fun getDistributorNames(): List<String>
|
fun getDistributorNames(): List<String>
|
||||||
suspend fun registerWith(matrixClient: MatrixClient, distributorName: String)
|
suspend fun registerWith(matrixClient: MatrixClient, distributorName: String)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -29,6 +29,7 @@ class FirebasePushProvider @Inject constructor(
|
|||||||
private val googleFcmHelper: GoogleFcmHelper,
|
private val googleFcmHelper: GoogleFcmHelper,
|
||||||
private val pusherSubscriber: PusherSubscriber,
|
private val pusherSubscriber: PusherSubscriber,
|
||||||
) : PushProvider {
|
) : PushProvider {
|
||||||
|
override val index = 0
|
||||||
|
|
||||||
override fun getDistributorNames(): List<String> {
|
override fun getDistributorNames(): List<String> {
|
||||||
// Must return an non-empty list for now
|
// Must return an non-empty list for now
|
||||||
|
|||||||
+3
-1
@@ -20,7 +20,9 @@ import io.element.android.libraries.matrix.api.MatrixClient
|
|||||||
import io.element.android.libraries.push.providers.api.PushProvider
|
import io.element.android.libraries.push.providers.api.PushProvider
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class UnifiedPushProvider @Inject constructor(): PushProvider {
|
class UnifiedPushProvider @Inject constructor() : PushProvider {
|
||||||
|
override val index = 1
|
||||||
|
|
||||||
override fun getDistributorNames(): List<String> {
|
override fun getDistributorNames(): List<String> {
|
||||||
TODO("Not yet implemented")
|
TODO("Not yet implemented")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user