Adjust SMS phases and show Phase 3 start date.

This commit is contained in:
Cody Henthorne
2023-02-03 19:25:40 -05:00
committed by Alex Hart
parent 9b08ebcc1d
commit 1f31f4a50a
7 changed files with 27 additions and 6 deletions

View File

@@ -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)

View File

@@ -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();
}
}

View File

@@ -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()

View File

@@ -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()

View File

@@ -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);
}

View File

@@ -52,13 +52,13 @@
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:text="@string/SmsRemoval_info_bullet_1"
android:textAlignment="viewStart"
android:textAppearance="@style/Signal.Text.BodyLarge"
android:textColor="@color/signal_colorOnSurfaceVariant"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/bullet_1"
app:layout_constraintTop_toBottomOf="@id/headline" />
app:layout_constraintTop_toBottomOf="@id/headline"
tools:text="@string/SmsRemoval_info_bullet_1_s" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/bullet_1_barrier"

View File

@@ -5560,8 +5560,8 @@
<!-- Title for screen describing that sms support is going to be removed soon -->
<string name="SmsRemoval_title_going_away">SMS support is going away</string>
<!-- Bullet point message shown on describing screen as first bullet why sms is being removed -->
<string name="SmsRemoval_info_bullet_1">SMS messaging in the Signal app will soon no longer be supported.</string>
<!-- Bullet point message shown on describing screen as first bullet why sms is being removed, placeholder with be date of removal (e.g., March 21st) -->
<string name="SmsRemoval_info_bullet_1_s">SMS messaging in the Signal app will soon no longer be supported on %1$s.</string>
<!-- Bullet point message shown on describing screen as second bullet why sms is being removed -->
<string name="SmsRemoval_info_bullet_2">SMS messages are different than Signal messages. <b>This does not affect encrypted Signal messaging which will continue to work.</b></string>
<!-- Bullet point message shown on describing screen as third bullet why sms is being removed -->