Skip to content

Commit

Permalink
fix(ExpeditedNotifWorker): Implements getForegroundInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianDevel committed Feb 26, 2025
1 parent 9b3bc96 commit 4acd982
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ class NotificationUtils @Inject constructor(
.setProgress(100, 0, true)
}

fun buildSyncMessagesServiceNotification(): NotificationCompat.Builder = with(appContext) {
val channelId = getString(R.string.notification_channel_id_sync_messages_service)
return NotificationCompat.Builder(this, channelId)
.setContentTitle(getString(R.string.notificationSyncMessagesChannelName))
.setSmallIcon(defaultSmallIcon)
.setProgress(100, 0, true)
}

fun buildDraftErrorNotification(
@StringRes errorMessageRes: Int,
action: DraftAction,
Expand Down Expand Up @@ -328,6 +336,7 @@ class NotificationUtils @Inject constructor(
private val defaultSmallIcon = R.drawable.ic_logo_notification

const val DRAFT_ACTIONS_ID = 1
const val SYNC_MESSAGES_ID = 2
const val EXTRA_MESSAGE_UID = "messageUid"

fun Context.deleteMailNotificationChannel(mailbox: List<Mailbox>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ class ProcessMessageNotificationsWorker @AssistedInject constructor(
}
}

override suspend fun getForegroundInfo(): ForegroundInfo {
val builder = notificationUtils.buildSyncMessagesServiceNotification()
return ForegroundInfo(NotificationUtils.SYNC_MESSAGES_ID, builder.build())
}

@Singleton
class Scheduler @Inject constructor(private val workManager: WorkManager) {

Expand Down

0 comments on commit 4acd982

Please sign in to comment.