mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Ensure that a PushProvider is available on a device before using it.
It help to fallback to UnifiedPush (if available) if the PlayServices are not installed on the device.
This commit is contained in:
committed by
Benoit Marty
parent
e2c9389d36
commit
7498c148f1
+4
@@ -24,6 +24,10 @@ interface PushService {
|
||||
// TODO Move away
|
||||
fun notificationStyleChanged()
|
||||
|
||||
/**
|
||||
* Return the list of push providers, available at compile time, and
|
||||
* available at runtime, sorted by index.
|
||||
*/
|
||||
fun getAvailablePushProviders(): List<PushProvider>
|
||||
|
||||
/**
|
||||
|
||||
+3
-1
@@ -38,7 +38,9 @@ class DefaultPushService @Inject constructor(
|
||||
}
|
||||
|
||||
override fun getAvailablePushProviders(): List<PushProvider> {
|
||||
return pushProviders.sortedBy { it.index }
|
||||
return pushProviders
|
||||
.filter { it.isAvailable() }
|
||||
.sortedBy { it.index }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user