This commit is contained in:
sim 2022-02-28 20:48:02 +01:00 committed by Benoit Marty
parent f00257f461
commit 1069f77bd5
4 changed files with 12 additions and 13 deletions

View File

@ -19,7 +19,7 @@ package im.vector.app.push.fcm
import android.content.Context
import org.unifiedpush.android.embedded_fcm_distributor.EmbeddedDistributorReceiver
class EmbeddedFCMDistributor: EmbeddedDistributorReceiver() {
class EmbeddedFCMDistributor : EmbeddedDistributorReceiver() {
override fun getEndpoint(context: Context, token: String, instance: String): String {
// Here token is the FCM Token, used by the gateway (sygnal)
return token

View File

@ -25,11 +25,11 @@ import im.vector.app.features.settings.troubleshoot.TestCurrentUnifiedPushDistri
import im.vector.app.features.settings.troubleshoot.TestDeviceSettings
import im.vector.app.features.settings.troubleshoot.TestEndpointAsTokenRegistration
import im.vector.app.features.settings.troubleshoot.TestNotification
import im.vector.app.features.settings.troubleshoot.TestPushFromPushGateway
import im.vector.app.features.settings.troubleshoot.TestPushRulesSettings
import im.vector.app.features.settings.troubleshoot.TestSystemSettings
import im.vector.app.features.settings.troubleshoot.TestUnifiedPushEndpoint
import im.vector.app.features.settings.troubleshoot.TestUnifiedPushGateway
import im.vector.app.features.settings.troubleshoot.TestPushFromPushGateway
import im.vector.app.gplay.features.settings.troubleshoot.TestFirebaseToken
import im.vector.app.gplay.features.settings.troubleshoot.TestPlayServices
import im.vector.app.gplay.features.settings.troubleshoot.TestTokenRegistration
@ -66,7 +66,6 @@ class NotificationTroubleshootTestManagerFactory @Inject constructor(
mgr.addTest(testPlayServices)
mgr.addTest(testFirebaseToken)
mgr.addTest(testTokenRegistration)
} else {
mgr.addTest(testUnifiedPushGateway)
mgr.addTest(testUnifiedPushEndpoint)

View File

@ -132,8 +132,8 @@ object UnifiedPushHelper {
context.getString(R.string.unifiedpush_distributor_background_sync)
}
if (distributors.size == 1
&& !force){
if (distributors.size == 1 &&
!force) {
up.saveDistributor(context, distributors.first())
up.registerApp(context)
onDoneRunnable?.run()
@ -239,14 +239,14 @@ object UnifiedPushHelper {
} as String
}
fun isEmbeddedDistributor(context: Context) : Boolean {
return ( up.getDistributor(context) == context.packageName
&& FcmHelper.isPushSupported())
fun isEmbeddedDistributor(context: Context): Boolean {
return (up.getDistributor(context) == context.packageName &&
FcmHelper.isPushSupported())
}
fun isBackgroundSync(context: Context) : Boolean {
return ( up.getDistributor(context) == context.packageName
&& !FcmHelper.isPushSupported())
fun isBackgroundSync(context: Context): Boolean {
return (up.getDistributor(context) == context.packageName &&
!FcmHelper.isPushSupported())
}
fun getPrivacyFriendlyUpEndpoint(context: Context): String? {

View File

@ -159,8 +159,8 @@ class VectorMessagingReceiver : MessagingReceiver() {
val gateway = UnifiedPushHelper.customOrDefaultGateway(context, endpoint)
// If the endpoint has changed
// or the gateway has changed
if (UnifiedPushHelper.getEndpointOrToken(context) != endpoint
|| UnifiedPushHelper.getPushGateway(context) != gateway) {
if (UnifiedPushHelper.getEndpointOrToken(context) != endpoint ||
UnifiedPushHelper.getPushGateway(context) != gateway) {
UnifiedPushHelper.storePushGateway(context, gateway)
UnifiedPushHelper.storeUpEndpoint(context, endpoint)
pushersManager.enqueueRegisterPusher(endpoint, gateway)