test on new endpoint

This commit is contained in:
S1m 2021-07-12 18:14:46 +02:00
parent 15c3bb7fc3
commit dbfa5e1fd5

View file

@ -156,12 +156,16 @@ val upHandler = object: MessagingReceiverHandler {
override fun onNewEndpoint(context: Context?, endpoint: String, instance: String) {
initVar(context!!)
Timber.i("onNewEndpoint: adding $endpoint")
UPHelper.storeUpEndpoint(context, endpoint)
if (vectorPreferences.areNotificationEnabledForDevice() && activeSessionHolder.hasActiveSession()) {
val gateway = UPHelper.customOrDefaultGateway(context, endpoint)
if (UPHelper.getUpEndpoint(context) != endpoint ||
UPHelper.getPushGateway(context) != gateway) {
UPHelper.storePushGateway(context, gateway)
UPHelper.storeUpEndpoint(context, endpoint)
pusherManager.registerPusher(context, endpoint, gateway)
} else {
Timber.i("onNewEndpoint: skipped")
}
}
val mode = BackgroundSyncMode.FDROID_BACKGROUND_SYNC_MODE_DISABLED
vectorPreferences.setFdroidSyncBackgroundMode(mode)