mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-17 21:47:28 +00:00
Add file server instability modal
This commit is contained in:
parent
e79d23c910
commit
747a27ddda
@ -173,8 +173,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
|||||||
if (hasViewedSeed) {
|
if (hasViewedSeed) {
|
||||||
seedReminderView.visibility = View.GONE
|
seedReminderView.visibility = View.GONE
|
||||||
}
|
}
|
||||||
showKeyPairMigrationSheetIfNeeded()
|
showFileServerInstabilityNotificationIfNeeded()
|
||||||
showKeyPairMigrationSuccessSheetIfNeeded()
|
|
||||||
if (TextSecurePreferences.getConfigurationMessageSynced(this)) {
|
if (TextSecurePreferences.getConfigurationMessageSynced(this)) {
|
||||||
lifecycleScope.launch(Dispatchers.IO) {
|
lifecycleScope.launch(Dispatchers.IO) {
|
||||||
MultiDeviceProtocol.syncConfigurationIfNeeded(this@HomeActivity)
|
MultiDeviceProtocol.syncConfigurationIfNeeded(this@HomeActivity)
|
||||||
@ -182,21 +181,11 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showKeyPairMigrationSheetIfNeeded() {
|
private fun showFileServerInstabilityNotificationIfNeeded() {
|
||||||
if (KeyPairUtilities.hasV2KeyPair(this)) {
|
val hasSeenNotification = TextSecurePreferences.hasSeenFileServerInstabilityNotification(this)
|
||||||
return
|
if (hasSeenNotification) { return }
|
||||||
}
|
FileServerDialog().show(supportFragmentManager, "File Server Dialog")
|
||||||
val keyPairMigrationSheet = KeyPairMigrationBottomSheet()
|
TextSecurePreferences.setHasSeenFileServerInstabilityNotification(this)
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
@ -18,7 +18,6 @@ import org.thoughtcrime.securesms.loki.utilities.MnemonicUtilities
|
|||||||
import org.session.libsignal.crypto.MnemonicCodec
|
import org.session.libsignal.crypto.MnemonicCodec
|
||||||
import org.session.libsignal.utilities.hexEncodedPrivateKey
|
import org.session.libsignal.utilities.hexEncodedPrivateKey
|
||||||
|
|
||||||
|
|
||||||
class SeedDialog : DialogFragment() {
|
class SeedDialog : DialogFragment() {
|
||||||
|
|
||||||
private val seed by lazy {
|
private val seed by lazy {
|
||||||
|
49
app/src/main/res/layout/dialog_file_server.xml
Normal file
49
app/src/main/res/layout/dialog_file_server.xml
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@drawable/default_dialog_background_inset"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingLeft="32dp"
|
||||||
|
android:paddingTop="@dimen/medium_spacing"
|
||||||
|
android:paddingRight="32dp"
|
||||||
|
android:paddingBottom="@dimen/medium_spacing">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Session"
|
||||||
|
android:textColor="@color/text"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:textSize="@dimen/medium_font_size" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/large_spacing"
|
||||||
|
android:text="We're upgrading the way files are stored. File transfer may be unstable for the next 24-48 hours."
|
||||||
|
android:textColor="@color/text"
|
||||||
|
android:textSize="@dimen/small_font_size"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:alpha="0.6" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/large_spacing"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
style="@style/Widget.Session.Button.Dialog.Unimportant"
|
||||||
|
android:id="@+id/okButton"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="@dimen/small_button_height"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/ok" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -763,5 +763,13 @@ object TextSecurePreferences {
|
|||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun shouldUpdateProfile(context: Context, profileUpdateTime: Long) =
|
fun shouldUpdateProfile(context: Context, profileUpdateTime: Long) =
|
||||||
profileUpdateTime > getLongPreference(context, LAST_PROFILE_UPDATE_TIME, 0)
|
profileUpdateTime > getLongPreference(context, LAST_PROFILE_UPDATE_TIME, 0)
|
||||||
|
|
||||||
|
fun hasSeenFileServerInstabilityNotification(context: Context): Boolean {
|
||||||
|
return getBooleanPreference(context, "has_seen_file_server_instability_notification", false)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setHasSeenFileServerInstabilityNotification(context: Context) {
|
||||||
|
setBooleanPreference(context, "has_seen_file_server_instability_notification", true)
|
||||||
|
}
|
||||||
// endregion
|
// endregion
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user