Lint
This commit is contained in:
parent
f00257f461
commit
1069f77bd5
@ -19,7 +19,7 @@ package im.vector.app.push.fcm
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import org.unifiedpush.android.embedded_fcm_distributor.EmbeddedDistributorReceiver
|
import org.unifiedpush.android.embedded_fcm_distributor.EmbeddedDistributorReceiver
|
||||||
|
|
||||||
class EmbeddedFCMDistributor: EmbeddedDistributorReceiver() {
|
class EmbeddedFCMDistributor : EmbeddedDistributorReceiver() {
|
||||||
override fun getEndpoint(context: Context, token: String, instance: String): String {
|
override fun getEndpoint(context: Context, token: String, instance: String): String {
|
||||||
// Here token is the FCM Token, used by the gateway (sygnal)
|
// Here token is the FCM Token, used by the gateway (sygnal)
|
||||||
return token
|
return token
|
||||||
|
@ -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.TestDeviceSettings
|
||||||
import im.vector.app.features.settings.troubleshoot.TestEndpointAsTokenRegistration
|
import im.vector.app.features.settings.troubleshoot.TestEndpointAsTokenRegistration
|
||||||
import im.vector.app.features.settings.troubleshoot.TestNotification
|
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.TestPushRulesSettings
|
||||||
import im.vector.app.features.settings.troubleshoot.TestSystemSettings
|
import im.vector.app.features.settings.troubleshoot.TestSystemSettings
|
||||||
import im.vector.app.features.settings.troubleshoot.TestUnifiedPushEndpoint
|
import im.vector.app.features.settings.troubleshoot.TestUnifiedPushEndpoint
|
||||||
import im.vector.app.features.settings.troubleshoot.TestUnifiedPushGateway
|
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.TestFirebaseToken
|
||||||
import im.vector.app.gplay.features.settings.troubleshoot.TestPlayServices
|
import im.vector.app.gplay.features.settings.troubleshoot.TestPlayServices
|
||||||
import im.vector.app.gplay.features.settings.troubleshoot.TestTokenRegistration
|
import im.vector.app.gplay.features.settings.troubleshoot.TestTokenRegistration
|
||||||
@ -66,7 +66,6 @@ class NotificationTroubleshootTestManagerFactory @Inject constructor(
|
|||||||
mgr.addTest(testPlayServices)
|
mgr.addTest(testPlayServices)
|
||||||
mgr.addTest(testFirebaseToken)
|
mgr.addTest(testFirebaseToken)
|
||||||
mgr.addTest(testTokenRegistration)
|
mgr.addTest(testTokenRegistration)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
mgr.addTest(testUnifiedPushGateway)
|
mgr.addTest(testUnifiedPushGateway)
|
||||||
mgr.addTest(testUnifiedPushEndpoint)
|
mgr.addTest(testUnifiedPushEndpoint)
|
||||||
|
@ -132,8 +132,8 @@ object UnifiedPushHelper {
|
|||||||
context.getString(R.string.unifiedpush_distributor_background_sync)
|
context.getString(R.string.unifiedpush_distributor_background_sync)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (distributors.size == 1
|
if (distributors.size == 1 &&
|
||||||
&& !force){
|
!force) {
|
||||||
up.saveDistributor(context, distributors.first())
|
up.saveDistributor(context, distributors.first())
|
||||||
up.registerApp(context)
|
up.registerApp(context)
|
||||||
onDoneRunnable?.run()
|
onDoneRunnable?.run()
|
||||||
@ -239,14 +239,14 @@ object UnifiedPushHelper {
|
|||||||
} as String
|
} as String
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isEmbeddedDistributor(context: Context) : Boolean {
|
fun isEmbeddedDistributor(context: Context): Boolean {
|
||||||
return ( up.getDistributor(context) == context.packageName
|
return (up.getDistributor(context) == context.packageName &&
|
||||||
&& FcmHelper.isPushSupported())
|
FcmHelper.isPushSupported())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isBackgroundSync(context: Context) : Boolean {
|
fun isBackgroundSync(context: Context): Boolean {
|
||||||
return ( up.getDistributor(context) == context.packageName
|
return (up.getDistributor(context) == context.packageName &&
|
||||||
&& !FcmHelper.isPushSupported())
|
!FcmHelper.isPushSupported())
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getPrivacyFriendlyUpEndpoint(context: Context): String? {
|
fun getPrivacyFriendlyUpEndpoint(context: Context): String? {
|
||||||
|
@ -159,8 +159,8 @@ class VectorMessagingReceiver : MessagingReceiver() {
|
|||||||
val gateway = UnifiedPushHelper.customOrDefaultGateway(context, endpoint)
|
val gateway = UnifiedPushHelper.customOrDefaultGateway(context, endpoint)
|
||||||
// If the endpoint has changed
|
// If the endpoint has changed
|
||||||
// or the gateway has changed
|
// or the gateway has changed
|
||||||
if (UnifiedPushHelper.getEndpointOrToken(context) != endpoint
|
if (UnifiedPushHelper.getEndpointOrToken(context) != endpoint ||
|
||||||
|| UnifiedPushHelper.getPushGateway(context) != gateway) {
|
UnifiedPushHelper.getPushGateway(context) != gateway) {
|
||||||
UnifiedPushHelper.storePushGateway(context, gateway)
|
UnifiedPushHelper.storePushGateway(context, gateway)
|
||||||
UnifiedPushHelper.storeUpEndpoint(context, endpoint)
|
UnifiedPushHelper.storeUpEndpoint(context, endpoint)
|
||||||
pushersManager.enqueueRegisterPusher(endpoint, gateway)
|
pushersManager.enqueueRegisterPusher(endpoint, gateway)
|
||||||
|
Loading…
Reference in New Issue
Block a user