diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/activities/HomeActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/loki/activities/HomeActivity.kt index b399d6e192..97011940e8 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/activities/HomeActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/loki/activities/HomeActivity.kt @@ -172,8 +172,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(), if (hasViewedSeed) { seedReminderView.visibility = View.GONE } - showKeyPairMigrationSheetIfNeeded() - showKeyPairMigrationSuccessSheetIfNeeded() + showFileServerInstabilityNotificationIfNeeded() if (TextSecurePreferences.getConfigurationMessageSynced(this)) { lifecycleScope.launch(Dispatchers.IO) { MultiDeviceProtocol.syncConfigurationIfNeeded(this@HomeActivity) @@ -181,21 +180,11 @@ class HomeActivity : PassphraseRequiredActionBarActivity(), } } - private fun showKeyPairMigrationSheetIfNeeded() { - if (KeyPairUtilities.hasV2KeyPair(this)) { - return - } - val keyPairMigrationSheet = KeyPairMigrationBottomSheet() - keyPairMigrationSheet.show(supportFragmentManager, keyPairMigrationSheet.tag) - } - - private fun showKeyPairMigrationSuccessSheetIfNeeded() { - if (!KeyPairUtilities.hasV2KeyPair(this) || !TextSecurePreferences.getIsMigratingKeyPair(this)) { - return - } - val keyPairMigrationSuccessSheet = KeyPairMigrationSuccessBottomSheet() - keyPairMigrationSuccessSheet.show(supportFragmentManager, keyPairMigrationSuccessSheet.tag) - TextSecurePreferences.setIsMigratingKeyPair(this, false) + private fun showFileServerInstabilityNotificationIfNeeded() { + val hasSeenNotification = TextSecurePreferences.hasSeenFileServerInstabilityNotification(this) + if (hasSeenNotification) { return } + FileServerDialog().show(supportFragmentManager, "File Server Dialog") + TextSecurePreferences.setHasSeenFileServerInstabilityNotification(this) } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/dialogs/FileServerDialog.kt b/app/src/main/java/org/thoughtcrime/securesms/loki/dialogs/FileServerDialog.kt new file mode 100644 index 0000000000..c3a0d7d7b1 --- /dev/null +++ b/app/src/main/java/org/thoughtcrime/securesms/loki/dialogs/FileServerDialog.kt @@ -0,0 +1,33 @@ +package org.thoughtcrime.securesms.loki.dialogs + +import android.app.Dialog +import android.content.ClipData +import android.content.ClipboardManager +import android.content.Context +import android.graphics.Color +import android.graphics.drawable.ColorDrawable +import android.os.Bundle +import android.view.LayoutInflater +import android.widget.Toast +import androidx.appcompat.app.AlertDialog +import androidx.fragment.app.DialogFragment +import kotlinx.android.synthetic.main.dialog_file_server.view.* +import kotlinx.android.synthetic.main.dialog_seed.view.* +import network.loki.messenger.R +import org.session.libsession.utilities.IdentityKeyUtil +import org.thoughtcrime.securesms.loki.utilities.MnemonicUtilities +import org.session.libsignal.crypto.MnemonicCodec +import org.session.libsignal.utilities.hexEncodedPrivateKey + +class FileServerDialog : DialogFragment() { + + override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { + val builder = AlertDialog.Builder(requireContext()) + val contentView = LayoutInflater.from(requireContext()).inflate(R.layout.dialog_file_server, null) + contentView.okButton.setOnClickListener { dismiss() } + builder.setView(contentView) + val result = builder.create() + result.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT)) + return result + } +} \ No newline at end of file diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/dialogs/SeedDialog.kt b/app/src/main/java/org/thoughtcrime/securesms/loki/dialogs/SeedDialog.kt index da19275464..2bd9595b22 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/dialogs/SeedDialog.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/loki/dialogs/SeedDialog.kt @@ -18,7 +18,6 @@ import org.thoughtcrime.securesms.loki.utilities.MnemonicUtilities import org.session.libsignal.crypto.MnemonicCodec import org.session.libsignal.utilities.hexEncodedPrivateKey - class SeedDialog : DialogFragment() { private val seed by lazy { diff --git a/app/src/main/res/layout/dialog_file_server.xml b/app/src/main/res/layout/dialog_file_server.xml new file mode 100644 index 0000000000..8b4a4c12eb --- /dev/null +++ b/app/src/main/res/layout/dialog_file_server.xml @@ -0,0 +1,49 @@ + + + + + + + + + +