Add phased SMS removal UX.

This commit is contained in:
Cody Henthorne
2022-10-13 11:33:13 -04:00
committed by Greyson Parrelli
parent 8a238a66e7
commit b6db7e7af6
68 changed files with 1214 additions and 187 deletions

View File

@@ -25,5 +25,5 @@ sealed class SmsExportProgress {
/**
* All done.
*/
object Done : SmsExportProgress()
data class Done(val progress: Int) : SmsExportProgress()
}

View File

@@ -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.