Revert "Always use SMS phase 0"

This reverts commit 1e220a5f81.
devel
Evan Perry Grove 2023-01-31 15:40:41 -06:00
rodzic 1e220a5f81
commit 309271d836
2 zmienionych plików z 15 dodań i 10 usunięć

Wyświetl plik

@ -192,9 +192,9 @@ public final class MiscellaneousValues extends SignalStoreValues {
}
public void startSmsPhase1() {
// if (!getStore().containsKey(SMS_PHASE_1_START_MS)) {
// putLong(SMS_PHASE_1_START_MS, System.currentTimeMillis());
// }
if (!getStore().containsKey(SMS_PHASE_1_START_MS)) {
putLong(SMS_PHASE_1_START_MS, System.currentTimeMillis());
}
}
public long getStoriesFeatureAvailableTimestamp() {
@ -206,6 +206,11 @@ public final class MiscellaneousValues extends SignalStoreValues {
}
public @NonNull SmsExportPhase getSmsExportPhase() {
return SmsExportPhase.PHASE_0;
if (getLong(SMS_PHASE_1_START_MS, 0) == 0) {
return SmsExportPhase.PHASE_0;
}
long now = System.currentTimeMillis();
return SmsExportPhase.getCurrentPhase(now - getLong(SMS_PHASE_1_START_MS, now));
}
}

Wyświetl plik

@ -11,29 +11,29 @@ enum class SmsExportPhase(val duration: Long) {
PHASE_3(105.days.inWholeMilliseconds);
fun allowSmsFeatures(): Boolean {
return Util.isDefaultSmsProvider(ApplicationDependencies.getApplication())
return this == PHASE_0 || (Util.isDefaultSmsProvider(ApplicationDependencies.getApplication()) && SignalStore.misc().smsExportPhase.isSmsSupported())
}
fun isSmsSupported(): Boolean {
return true
return this != PHASE_3
}
fun isFullscreen(): Boolean {
return false
return this.ordinal > PHASE_1.ordinal
}
fun isBlockingUi(): Boolean {
return false
return this == PHASE_3
}
fun isAtLeastPhase1(): Boolean {
return false
return this.ordinal >= PHASE_1.ordinal
}
companion object {
@JvmStatic
fun getCurrentPhase(duration: Long): SmsExportPhase {
return PHASE_0
return values().findLast { duration >= it.duration }!!
}
}
}