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 CDS_BLOCKED_UNTIL = "misc.cds_blocked_until";
|
||||||
private static final String LAST_FOREGROUND_TIME = "misc.last_foreground_time";
|
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 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 LINKED_DEVICES_REMINDER = "misc.linked_devices_reminder";
|
||||||
private static final String HAS_LINKED_DEVICES = "misc.linked_devices_present";
|
private static final String HAS_LINKED_DEVICES = "misc.linked_devices_present";
|
||||||
private static final String USERNAME_QR_CODE_COLOR = "mis.username_qr_color_scheme";
|
private static final String USERNAME_QR_CODE_COLOR = "mis.username_qr_color_scheme";
|
||||||
|
@ -52,7 +51,7 @@ public final class MiscellaneousValues extends SignalStoreValues {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull List<String> getKeysToIncludeInBackup() {
|
@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() {
|
public @NonNull SmsExportPhase getSmsExportPhase() {
|
||||||
long now = System.currentTimeMillis();
|
return SmsExportPhase.getCurrentPhase();
|
||||||
long phase1StartMs = getLong(SMS_PHASE_1_START_MS, now);
|
|
||||||
return SmsExportPhase.getCurrentPhase(now - phase1StartMs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHasLinkedDevices(boolean value) {
|
public void setHasLinkedDevices(boolean value) {
|
||||||
|
|
|
@ -1,29 +1,24 @@
|
||||||
package org.thoughtcrime.securesms.keyvalue
|
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) {
|
enum class SmsExportPhase(val duration: Long) {
|
||||||
PHASE_2(0.days.inWholeMilliseconds),
|
PHASE_3(0);
|
||||||
PHASE_3(51.days.inWholeMilliseconds);
|
|
||||||
|
|
||||||
fun allowSmsFeatures(): Boolean {
|
fun allowSmsFeatures(): Boolean {
|
||||||
return Util.isDefaultSmsProvider(ApplicationDependencies.getApplication()) && SignalStore.misc().smsExportPhase.isSmsSupported()
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isSmsSupported(): Boolean {
|
fun isSmsSupported(): Boolean {
|
||||||
return this != PHASE_3
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isBlockingUi(): Boolean {
|
fun isBlockingUi(): Boolean {
|
||||||
return this == PHASE_3
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getCurrentPhase(duration: Long): SmsExportPhase {
|
fun getCurrentPhase(): SmsExportPhase {
|
||||||
return values().findLast { duration >= it.duration }!!
|
return PHASE_3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,7 @@ package org.thoughtcrime.securesms.megaphone
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.annotation.WorkerThread
|
import androidx.annotation.WorkerThread
|
||||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
|
||||||
import org.thoughtcrime.securesms.keyvalue.SmsExportPhase
|
|
||||||
import org.thoughtcrime.securesms.util.Util
|
import org.thoughtcrime.securesms.util.Util
|
||||||
import kotlin.time.Duration.Companion.days
|
|
||||||
|
|
||||||
class SmsExportReminderSchedule(private val context: Context) : MegaphoneSchedule {
|
class SmsExportReminderSchedule(private val context: Context) : MegaphoneSchedule {
|
||||||
|
|
||||||
|
@ -14,15 +11,10 @@ class SmsExportReminderSchedule(private val context: Context) : MegaphoneSchedul
|
||||||
var showPhase3Megaphone = true
|
var showPhase3Megaphone = true
|
||||||
}
|
}
|
||||||
|
|
||||||
private val fullScreenSchedule = RecurringSchedule(1.days.inWholeMilliseconds)
|
|
||||||
|
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
override fun shouldDisplay(seenCount: Int, lastSeen: Long, firstVisible: Long, currentTime: Long): Boolean {
|
override fun shouldDisplay(seenCount: Int, lastSeen: Long, firstVisible: Long, currentTime: Long): Boolean {
|
||||||
return if (Util.isDefaultSmsProvider(context)) {
|
return if (Util.isDefaultSmsProvider(context)) {
|
||||||
when (SignalStore.misc().smsExportPhase) {
|
showPhase3Megaphone
|
||||||
SmsExportPhase.PHASE_2 -> fullScreenSchedule.shouldDisplay(seenCount, lastSeen, firstVisible, currentTime)
|
|
||||||
SmsExportPhase.PHASE_3 -> showPhase3Megaphone
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue