Update copy and behavior of SMS phased removal flow.

This commit is contained in:
Cody Henthorne
2023-01-18 12:51:03 -05:00
parent 8f49323648
commit 6e2e5e21cc
26 changed files with 445 additions and 186 deletions

View File

@@ -232,6 +232,8 @@ public final class MiscellaneousValues extends SignalStoreValues {
}
public @NonNull SmsExportPhase getSmsExportPhase() {
return SmsExportPhase.PHASE_0;
long now = System.currentTimeMillis();
long phase1StartMs = getLong(SMS_PHASE_1_START_MS, now);
return SmsExportPhase.getCurrentPhase(now - phase1StartMs);
}
}

View File

@@ -5,13 +5,12 @@ import org.thoughtcrime.securesms.util.Util
import kotlin.time.Duration.Companion.days
enum class SmsExportPhase(val duration: Long) {
PHASE_0(-1),
PHASE_1(0.days.inWholeMilliseconds),
PHASE_2(45.days.inWholeMilliseconds),
PHASE_3(105.days.inWholeMilliseconds);
fun allowSmsFeatures(): Boolean {
return this == PHASE_0 || (Util.isDefaultSmsProvider(ApplicationDependencies.getApplication()) && SignalStore.misc().smsExportPhase.isSmsSupported())
return Util.isDefaultSmsProvider(ApplicationDependencies.getApplication()) && SignalStore.misc().smsExportPhase.isSmsSupported()
}
fun isSmsSupported(): Boolean {
@@ -26,10 +25,6 @@ enum class SmsExportPhase(val duration: Long) {
return this == PHASE_3
}
fun isAtLeastPhase1(): Boolean {
return this.ordinal >= PHASE_1.ordinal
}
companion object {
@JvmStatic
fun getCurrentPhase(duration: Long): SmsExportPhase {