Always use SMS phase 0

devel
Greyson Parrelli 2022-10-21 10:04:40 -05:00 zatwierdzone przez Evan Perry Grove
rodzic 309271d836
commit 92f10b8a86
2 zmienionych plików z 10 dodań i 15 usunięć

Wyświetl plik

@ -192,9 +192,9 @@ public final class MiscellaneousValues extends SignalStoreValues {
} }
public void startSmsPhase1() { public void startSmsPhase1() {
if (!getStore().containsKey(SMS_PHASE_1_START_MS)) { // if (!getStore().containsKey(SMS_PHASE_1_START_MS)) {
putLong(SMS_PHASE_1_START_MS, System.currentTimeMillis()); // putLong(SMS_PHASE_1_START_MS, System.currentTimeMillis());
} // }
} }
public long getStoriesFeatureAvailableTimestamp() { public long getStoriesFeatureAvailableTimestamp() {
@ -206,11 +206,6 @@ public final class MiscellaneousValues extends SignalStoreValues {
} }
public @NonNull SmsExportPhase getSmsExportPhase() { public @NonNull SmsExportPhase getSmsExportPhase() {
if (getLong(SMS_PHASE_1_START_MS, 0) == 0) { return SmsExportPhase.PHASE_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); PHASE_3(105.days.inWholeMilliseconds);
fun allowSmsFeatures(): Boolean { fun allowSmsFeatures(): Boolean {
return this == PHASE_0 || (Util.isDefaultSmsProvider(ApplicationDependencies.getApplication()) && SignalStore.misc().smsExportPhase.isSmsSupported()) return Util.isDefaultSmsProvider(ApplicationDependencies.getApplication())
} }
fun isSmsSupported(): Boolean { fun isSmsSupported(): Boolean {
return this != PHASE_3 return true
} }
fun isFullscreen(): Boolean { fun isFullscreen(): Boolean {
return this.ordinal > PHASE_1.ordinal return false
} }
fun isBlockingUi(): Boolean { fun isBlockingUi(): Boolean {
return this == PHASE_3 return false
} }
fun isAtLeastPhase1(): Boolean { fun isAtLeastPhase1(): Boolean {
return this.ordinal >= PHASE_1.ordinal return false
} }
companion object { companion object {
@JvmStatic @JvmStatic
fun getCurrentPhase(duration: Long): SmsExportPhase { fun getCurrentPhase(duration: Long): SmsExportPhase {
return values().findLast { duration >= it.duration }!! return PHASE_0
} }
} }
} }