Remove Phase 2 in preparation for CFv2.
This commit is contained in:
parent
dc69bcf6f2
commit
7617cc0a80
3 changed files with 9 additions and 25 deletions
|
@ -31,7 +31,6 @@ public final class MiscellaneousValues extends SignalStoreValues {
|
|||
private static final String CDS_BLOCKED_UNTIL = "misc.cds_blocked_until";
|
||||
private static final String LAST_FOREGROUND_TIME = "misc.last_foreground_time";
|
||||
private static final String PNI_INITIALIZED_DEVICES = "misc.pni_initialized_devices";
|
||||
private static final String SMS_PHASE_1_START_MS = "misc.sms_export.phase_1_start.3";
|
||||
private static final String LINKED_DEVICES_REMINDER = "misc.linked_devices_reminder";
|
||||
private static final String HAS_LINKED_DEVICES = "misc.linked_devices_present";
|
||||
private static final String USERNAME_QR_CODE_COLOR = "mis.username_qr_color_scheme";
|
||||
|
@ -52,7 +51,7 @@ public final class MiscellaneousValues extends SignalStoreValues {
|
|||
|
||||
@Override
|
||||
@NonNull List<String> getKeysToIncludeInBackup() {
|
||||
return Collections.singletonList(SMS_PHASE_1_START_MS);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -233,9 +232,7 @@ public final class MiscellaneousValues extends SignalStoreValues {
|
|||
}
|
||||
|
||||
public @NonNull SmsExportPhase getSmsExportPhase() {
|
||||
long now = System.currentTimeMillis();
|
||||
long phase1StartMs = getLong(SMS_PHASE_1_START_MS, now);
|
||||
return SmsExportPhase.getCurrentPhase(now - phase1StartMs);
|
||||
return SmsExportPhase.getCurrentPhase();
|
||||
}
|
||||
|
||||
public void setHasLinkedDevices(boolean value) {
|
||||
|
|
|
@ -1,29 +1,24 @@
|
|||
package org.thoughtcrime.securesms.keyvalue
|
||||
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies
|
||||
import org.thoughtcrime.securesms.util.Util
|
||||
import kotlin.time.Duration.Companion.days
|
||||
|
||||
enum class SmsExportPhase(val duration: Long) {
|
||||
PHASE_2(0.days.inWholeMilliseconds),
|
||||
PHASE_3(51.days.inWholeMilliseconds);
|
||||
PHASE_3(0);
|
||||
|
||||
fun allowSmsFeatures(): Boolean {
|
||||
return Util.isDefaultSmsProvider(ApplicationDependencies.getApplication()) && SignalStore.misc().smsExportPhase.isSmsSupported()
|
||||
return false
|
||||
}
|
||||
|
||||
fun isSmsSupported(): Boolean {
|
||||
return this != PHASE_3
|
||||
return false
|
||||
}
|
||||
|
||||
fun isBlockingUi(): Boolean {
|
||||
return this == PHASE_3
|
||||
return true
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun getCurrentPhase(duration: Long): SmsExportPhase {
|
||||
return values().findLast { duration >= it.duration }!!
|
||||
fun getCurrentPhase(): SmsExportPhase {
|
||||
return PHASE_3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,7 @@ package org.thoughtcrime.securesms.megaphone
|
|||
|
||||
import android.content.Context
|
||||
import androidx.annotation.WorkerThread
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.keyvalue.SmsExportPhase
|
||||
import org.thoughtcrime.securesms.util.Util
|
||||
import kotlin.time.Duration.Companion.days
|
||||
|
||||
class SmsExportReminderSchedule(private val context: Context) : MegaphoneSchedule {
|
||||
|
||||
|
@ -14,15 +11,10 @@ class SmsExportReminderSchedule(private val context: Context) : MegaphoneSchedul
|
|||
var showPhase3Megaphone = true
|
||||
}
|
||||
|
||||
private val fullScreenSchedule = RecurringSchedule(1.days.inWholeMilliseconds)
|
||||
|
||||
@WorkerThread
|
||||
override fun shouldDisplay(seenCount: Int, lastSeen: Long, firstVisible: Long, currentTime: Long): Boolean {
|
||||
return if (Util.isDefaultSmsProvider(context)) {
|
||||
when (SignalStore.misc().smsExportPhase) {
|
||||
SmsExportPhase.PHASE_2 -> fullScreenSchedule.shouldDisplay(seenCount, lastSeen, firstVisible, currentTime)
|
||||
SmsExportPhase.PHASE_3 -> showPhase3Megaphone
|
||||
}
|
||||
showPhase3Megaphone
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue