Update copy and behavior of SMS phased removal flow.

This commit is contained in:
Cody Henthorne
2023-01-18 12:51:03 -05:00
parent 8f49323648
commit 6e2e5e21cc
26 changed files with 445 additions and 186 deletions

View File

@@ -362,14 +362,15 @@ public final class Megaphones {
private static @NonNull Megaphone buildSmsExportMegaphone(@NonNull Context context) {
SmsExportPhase phase = SignalStore.misc().getSmsExportPhase();
if (phase == SmsExportPhase.PHASE_0) {
throw new AssertionError("Should not be showing megaphone for Phase 0");
} else if (phase == SmsExportPhase.PHASE_1) {
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__sms_support_will_be_removed_soon_to_focus_on_encrypted_messaging)
.setActionButton(R.string.SmsExportMegaphone__export_sms, (megaphone, controller) -> controller.onMegaphoneNavigationRequested(SmsExportActivity.createIntent(context), SmsExportMegaphoneActivity.REQUEST_CODE))
.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();

View File

@@ -7,13 +7,14 @@ import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import org.thoughtcrime.securesms.PassphraseRequiredActivity
import org.thoughtcrime.securesms.R
import org.thoughtcrime.securesms.databinding.SmsExportMegaphoneActivityBinding
import org.thoughtcrime.securesms.databinding.SmsRemovalInformationFragmentBinding
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.DynamicNoActionBarTheme
import org.thoughtcrime.securesms.util.DynamicTheme
import org.thoughtcrime.securesms.util.visible
class SmsExportMegaphoneActivity : PassphraseRequiredActivity() {
@@ -22,7 +23,7 @@ class SmsExportMegaphoneActivity : PassphraseRequiredActivity() {
}
private val theme: DynamicTheme = DynamicNoActionBarTheme()
private lateinit var binding: SmsExportMegaphoneActivityBinding
private lateinit var binding: SmsRemovalInformationFragmentBinding
private lateinit var smsExportLauncher: ActivityResultLauncher<Intent>
override fun onPreCreate() {
@@ -30,7 +31,7 @@ class SmsExportMegaphoneActivity : PassphraseRequiredActivity() {
}
override fun onCreate(savedInstanceState: Bundle?, ready: Boolean) {
binding = SmsExportMegaphoneActivityBinding.inflate(layoutInflater)
binding = SmsRemovalInformationFragmentBinding.inflate(layoutInflater)
setContentView(binding.root)
smsExportLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
@@ -43,26 +44,22 @@ class SmsExportMegaphoneActivity : PassphraseRequiredActivity() {
binding.toolbar.setNavigationOnClickListener { onBackPressed() }
binding.learnMoreButton.setOnClickListener {
CommunicationActions.openBrowserLink(this, getString(R.string.sms_export_url))
}
if (SignalStore.misc().smsExportPhase.isBlockingUi()) {
binding.headline.setText(R.string.SmsExportMegaphoneActivity__signal_no_longer_supports_sms)
binding.description.setText(R.string.SmsExportMegaphoneActivity__signal_has_removed_support_for_sending_sms_messages)
binding.description.setLearnMoreVisible(false)
binding.laterButton.setText(R.string.SmsExportMegaphoneActivity__learn_more)
binding.laterButton.setOnClickListener {
CommunicationActions.openBrowserLink(this, getString(R.string.sms_export_url))
}
binding.laterButton.visible = false
binding.bullet1Text.setText(R.string.SmsRemoval_info_bullet_1_phase_3)
} else {
binding.headline.setText(R.string.SmsExportMegaphoneActivity__signal_will_no_longer_support_sms)
binding.description.setText(R.string.SmsExportMegaphoneActivity__signal_will_soon_remove_support_for_sending_sms_messages)
binding.description.setLearnMoreVisible(true)
binding.description.setLink(getString(R.string.sms_export_url))
binding.laterButton.setText(R.string.SmsExportMegaphoneActivity__remind_me_later)
binding.laterButton.setOnClickListener {
onBackPressed()
}
}
binding.exportButton.setOnClickListener {
binding.exportSmsButton.setOnClickListener {
smsExportLauncher.launch(SmsExportActivity.createIntent(this))
}
}

View File

@@ -4,6 +4,7 @@ import android.content.Context
import androidx.annotation.WorkerThread
import org.thoughtcrime.securesms.keyvalue.SignalStore
import org.thoughtcrime.securesms.keyvalue.SmsExportPhase
import org.thoughtcrime.securesms.util.Util
import kotlin.time.Duration.Companion.days
class SmsExportReminderSchedule(private val context: Context) : MegaphoneSchedule {
@@ -18,9 +19,8 @@ class SmsExportReminderSchedule(private val context: Context) : MegaphoneSchedul
@WorkerThread
override fun shouldDisplay(seenCount: Int, lastSeen: Long, firstVisible: Long, currentTime: Long): Boolean {
return if (shouldShowMegaphone()) {
return if (Util.isDefaultSmsProvider(context)) {
when (SignalStore.misc().smsExportPhase) {
SmsExportPhase.PHASE_0 -> false
SmsExportPhase.PHASE_1 -> basicMegaphoneSchedule.shouldDisplay(seenCount, lastSeen, firstVisible, currentTime)
SmsExportPhase.PHASE_2 -> fullScreenSchedule.shouldDisplay(seenCount, lastSeen, firstVisible, currentTime)
SmsExportPhase.PHASE_3 -> showPhase3Megaphone
@@ -29,9 +29,4 @@ class SmsExportReminderSchedule(private val context: Context) : MegaphoneSchedul
false
}
}
@WorkerThread
private fun shouldShowMegaphone(): Boolean {
return false
}
}