Skip to content

Commit

Permalink
test on new endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
p1gp1g committed Jul 12, 2021
1 parent 15c3bb7 commit dbfa5e1
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
UPHelper.storePushGateway(context, gateway)
UPHelper.storeUpEndpoint(context, endpoint)
pusherManager.registerPusher(context, endpoint, gateway)
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)
Expand Down

0 comments on commit dbfa5e1

Please sign in to comment.