Skip to content

Commit

Permalink
dont post change notification after sync
Browse files Browse the repository at this point in the history
  • Loading branch information
newhinton committed Apr 28, 2024
1 parent 7b64735 commit 8df3014
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ class EphemeralWorker (private var mContext: Context, workerParams: WorkerParame
}
showFailNotification(notificationId, content)
endNotificationAlreadyPosted = true
finishWork()
}

private fun showCancelledNotification(notificationId: Int) {
Expand Down Expand Up @@ -407,9 +408,11 @@ class EphemeralWorker (private var mContext: Context, workerParams: WorkerParame
private val connectivityChangeBroadcastReceiver: BroadcastReceiver =
object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
if(endNotificationAlreadyPosted){
return
}
sConnectivityChanged = true
failureReason = FAILURE_REASON.CONNECTIVITY_CHANGED
finishWork()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ class SyncWorker (private var mContext: Context, workerParams: WorkerParameters)
}
showFailNotification(notificationId, content)
endNotificationAlreadyPosted = true
finishWork()
}

private fun showCancelledNotification(notificationId: Int) {
Expand Down Expand Up @@ -419,9 +420,11 @@ class SyncWorker (private var mContext: Context, workerParams: WorkerParameters)
private val connectivityChangeBroadcastReceiver: BroadcastReceiver =
object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
if(endNotificationAlreadyPosted){
return
}
sConnectivityChanged = true
failureReason = FAILURE_REASON.CONNECTIVITY_CHANGED
finishWork()
}
}

Expand Down

0 comments on commit 8df3014

Please sign in to comment.