Remove Phase 1 in preparation for CFv2.

This commit is contained in:
Cody Henthorne
2023-07-14 13:51:30 -04:00
committed by GitHub
parent 7031bbae43
commit e5c3757629
9 changed files with 18 additions and 61 deletions

View File

@@ -368,33 +368,19 @@ public final class Megaphones {
private static @NonNull Megaphone buildSmsExportMegaphone(@NonNull Context context) {
SmsExportPhase phase = SignalStore.misc().getSmsExportPhase();
if (phase == SmsExportPhase.PHASE_1) {
return new Megaphone.Builder(Event.SMS_EXPORT, Megaphone.Style.BASIC)
.setTitle(R.string.SmsExportMegaphone__sms_support_going_away)
.setImage(R.drawable.sms_megaphone)
.setBody(R.string.SmsExportMegaphone__dont_worry_encrypted_signal_messages_will_continue_to_work)
.setActionButton(R.string.SmsExportMegaphone__continue, (megaphone, controller) -> {
controller.onMegaphoneSnooze(Event.SMS_EXPORT);
controller.onMegaphoneNavigationRequested(SmsExportActivity.createIntent(context, true), SmsExportMegaphoneActivity.REQUEST_CODE);
})
.setSecondaryButton(R.string.Megaphones_remind_me_later, (megaphone, controller) -> controller.onMegaphoneSnooze(Event.SMS_EXPORT))
.setOnVisibleListener((megaphone, controller) -> SignalStore.misc().startSmsPhase1())
.build();
} else {
Megaphone.Builder builder = new Megaphone.Builder(Event.SMS_EXPORT, Megaphone.Style.FULLSCREEN)
.setOnVisibleListener((megaphone, controller) -> {
if (phase.isBlockingUi()) {
SmsExportReminderSchedule.setShowPhase3Megaphone(false);
}
controller.onMegaphoneNavigationRequested(new Intent(context, SmsExportMegaphoneActivity.class), SmsExportMegaphoneActivity.REQUEST_CODE);
});
Megaphone.Builder builder = new Megaphone.Builder(Event.SMS_EXPORT, Megaphone.Style.FULLSCREEN)
.setOnVisibleListener((megaphone, controller) -> {
if (phase.isBlockingUi()) {
SmsExportReminderSchedule.setShowPhase3Megaphone(false);
}
controller.onMegaphoneNavigationRequested(new Intent(context, SmsExportMegaphoneActivity.class), SmsExportMegaphoneActivity.REQUEST_CODE);
});
if (phase.isBlockingUi()) {
builder.disableSnooze();
}
return builder.build();
if (phase.isBlockingUi()) {
builder.disableSnooze();
}
return builder.build();
}
public static @NonNull Megaphone buildSetUpYourUsernameMegaphone(@NonNull Context context) {

View File

@@ -12,11 +12,9 @@ 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() {
@@ -55,8 +53,7 @@ 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.bullet1Text.text = getString(R.string.SmsRemoval_info_bullet_1)
binding.headline.setText(R.string.SmsExportMegaphoneActivity__signal_will_no_longer_support_sms)
binding.laterButton.setOnClickListener {

View File

@@ -14,14 +14,12 @@ class SmsExportReminderSchedule(private val context: Context) : MegaphoneSchedul
var showPhase3Megaphone = true
}
private val basicMegaphoneSchedule = RecurringSchedule(3.days.inWholeMilliseconds)
private val fullScreenSchedule = RecurringSchedule(1.days.inWholeMilliseconds)
@WorkerThread
override fun shouldDisplay(seenCount: Int, lastSeen: Long, firstVisible: Long, currentTime: Long): Boolean {
return if (Util.isDefaultSmsProvider(context)) {
when (SignalStore.misc().smsExportPhase) {
SmsExportPhase.PHASE_1 -> basicMegaphoneSchedule.shouldDisplay(seenCount, lastSeen, firstVisible, currentTime)
SmsExportPhase.PHASE_2 -> fullScreenSchedule.shouldDisplay(seenCount, lastSeen, firstVisible, currentTime)
SmsExportPhase.PHASE_3 -> showPhase3Megaphone
}