mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 13:08:46 +00:00
Add phased SMS removal UX.
This commit is contained in:
committed by
Greyson Parrelli
parent
8a238a66e7
commit
b6db7e7af6
@@ -25,5 +25,5 @@ sealed class SmsExportProgress {
|
||||
/**
|
||||
* All done.
|
||||
*/
|
||||
object Done : SmsExportProgress()
|
||||
data class Done(val progress: Int) : SmsExportProgress()
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.app.Notification
|
||||
import android.app.Service
|
||||
import android.content.Intent
|
||||
import android.os.IBinder
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import io.reactivex.rxjava3.processors.BehaviorProcessor
|
||||
import org.signal.core.util.Result
|
||||
import org.signal.core.util.Try
|
||||
@@ -78,7 +79,12 @@ abstract class SmsExportService : Service() {
|
||||
}
|
||||
|
||||
onExportPassCompleted()
|
||||
progressState.onNext(SmsExportProgress.Done)
|
||||
progressState.onNext(SmsExportProgress.Done(progress))
|
||||
|
||||
getExportCompleteNotification()?.let { notification ->
|
||||
NotificationManagerCompat.from(this).notify(notification.id, notification.notification)
|
||||
}
|
||||
|
||||
stopForeground(true)
|
||||
isStarted = false
|
||||
}
|
||||
@@ -97,6 +103,13 @@ abstract class SmsExportService : Service() {
|
||||
*/
|
||||
protected abstract fun getNotification(progress: Int, total: Int): ExportNotification
|
||||
|
||||
/**
|
||||
* Produces the notification and notification id to display when the export is complete.
|
||||
*
|
||||
* Can be null if no notification is needed (e.g., the user is still in the app)
|
||||
*/
|
||||
protected abstract fun getExportCompleteNotification(): ExportNotification?
|
||||
|
||||
/**
|
||||
* Gets the total number of messages to process. This is only used for the notification and
|
||||
* progress events.
|
||||
|
||||
Reference in New Issue
Block a user