mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-03-02 15:36:32 +00:00
Adjust SMS phases and show Phase 3 start date.
This commit is contained in:
committed by
Alex Hart
parent
9b08ebcc1d
commit
1f31f4a50a
@@ -9,8 +9,11 @@ import androidx.navigation.fragment.findNavController
|
||||
import org.thoughtcrime.securesms.LoggingFragment
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.databinding.SmsRemovalInformationFragmentBinding
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.util.CommunicationActions
|
||||
import org.thoughtcrime.securesms.util.DateUtils
|
||||
import org.thoughtcrime.securesms.util.navigation.safeNavigate
|
||||
import java.util.Locale
|
||||
|
||||
/**
|
||||
* Fragment shown when entering the sms export flow from the basic megaphone.
|
||||
@@ -39,6 +42,9 @@ class SmsRemovalInformationFragment : LoggingFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
val phase3Start = DateUtils.formatDateWithMonthAndDay(Locale.getDefault(), SignalStore.misc().smsPhase3Start)
|
||||
binding.bullet1Text.text = getString(R.string.SmsRemoval_info_bullet_1_s, phase3Start)
|
||||
|
||||
binding.toolbar.setNavigationOnClickListener(goBackClickListener)
|
||||
binding.laterButton.setOnClickListener(goBackClickListener)
|
||||
|
||||
|
||||
@@ -236,4 +236,10 @@ public final class MiscellaneousValues extends SignalStoreValues {
|
||||
long phase1StartMs = getLong(SMS_PHASE_1_START_MS, now);
|
||||
return SmsExportPhase.getCurrentPhase(now - phase1StartMs);
|
||||
}
|
||||
|
||||
public long getSmsPhase3Start() {
|
||||
long now = System.currentTimeMillis();
|
||||
long phase1StartMs = getLong(SMS_PHASE_1_START_MS, now);
|
||||
return phase1StartMs + SmsExportPhase.PHASE_3.getDuration();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ import kotlin.time.Duration.Companion.days
|
||||
|
||||
enum class SmsExportPhase(val duration: Long) {
|
||||
PHASE_1(0.days.inWholeMilliseconds),
|
||||
PHASE_2(45.days.inWholeMilliseconds),
|
||||
PHASE_3(105.days.inWholeMilliseconds);
|
||||
PHASE_2(21.days.inWholeMilliseconds),
|
||||
PHASE_3(51.days.inWholeMilliseconds);
|
||||
|
||||
fun allowSmsFeatures(): Boolean {
|
||||
return Util.isDefaultSmsProvider(ApplicationDependencies.getApplication()) && SignalStore.misc().smsExportPhase.isSmsSupported()
|
||||
|
||||
@@ -12,9 +12,11 @@ import org.thoughtcrime.securesms.dependencies.ApplicationDependencies
|
||||
import org.thoughtcrime.securesms.exporter.flow.SmsExportActivity
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.util.CommunicationActions
|
||||
import org.thoughtcrime.securesms.util.DateUtils
|
||||
import org.thoughtcrime.securesms.util.DynamicNoActionBarTheme
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme
|
||||
import org.thoughtcrime.securesms.util.visible
|
||||
import java.util.Locale
|
||||
|
||||
class SmsExportMegaphoneActivity : PassphraseRequiredActivity() {
|
||||
|
||||
@@ -53,6 +55,9 @@ class SmsExportMegaphoneActivity : PassphraseRequiredActivity() {
|
||||
binding.laterButton.visible = false
|
||||
binding.bullet1Text.setText(R.string.SmsRemoval_info_bullet_1_phase_3)
|
||||
} else {
|
||||
val phase3Start = DateUtils.formatDateWithMonthAndDay(Locale.getDefault(), SignalStore.misc().smsPhase3Start)
|
||||
binding.bullet1Text.text = getString(R.string.SmsRemoval_info_bullet_1_s, phase3Start)
|
||||
|
||||
binding.headline.setText(R.string.SmsExportMegaphoneActivity__signal_will_no_longer_support_sms)
|
||||
binding.laterButton.setOnClickListener {
|
||||
onBackPressed()
|
||||
|
||||
@@ -259,6 +259,10 @@ public class DateUtils extends android.text.format.DateUtils {
|
||||
return getFormattedDateTime(timestamp, "EEE, MMM d, yyyy", locale);
|
||||
}
|
||||
|
||||
public static String formatDateWithMonthAndDay(@NonNull Locale locale, long timestamp) {
|
||||
return getFormattedDateTime(timestamp, "MMMM dd", locale);
|
||||
}
|
||||
|
||||
public static String formatDateWithoutDayOfWeek(@NonNull Locale locale, long timestamp) {
|
||||
return getFormattedDateTime(timestamp, "MMM d yyyy", locale);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user