diff --git a/FlowCrypt/build.gradle b/FlowCrypt/build.gradle index 3ae82b249e..e18f3310bd 100644 --- a/FlowCrypt/build.gradle +++ b/FlowCrypt/build.gradle @@ -371,7 +371,7 @@ dependencies { implementation "androidx.test.espresso:espresso-idling-resource:${rootProject.ext.espressoVersion}" implementation "androidx.lifecycle:lifecycle-extensions:2.2.0" implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:${rootProject.ext.lifecycleVersion}" - implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1" + implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0" implementation "androidx.room:room-runtime:$roomVersion" implementation "androidx.room:room-ktx:$roomVersion" implementation "androidx.paging:paging-runtime-ktx:$pagingVersion" diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/ContactsViewModel.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/ContactsViewModel.kt index f4f77fe9e0..dc6e30c4ff 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/ContactsViewModel.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/ContactsViewModel.kt @@ -136,7 +136,7 @@ class ContactsViewModel(application: Application) : AccountViewModel(application try { for (email in emails) { if (GeneralUtil.isEmailValid(email)) { - val emailLowerCase = email.toLowerCase(Locale.getDefault()) + val emailLowerCase = email.lowercase(Locale.getDefault()) var cachedContactEntity = roomDatabase.contactsDao().getContactByEmailSuspend(emailLowerCase) @@ -263,7 +263,7 @@ class ContactsViewModel(application: Application) : AccountViewModel(application roomDatabase.contactsDao().updateSuspend( contactEntityFromPrimaryPgpContact.copy( id = contactEntity.id, - email = contactEntity.email.toLowerCase(Locale.US), + email = contactEntity.email.lowercase(Locale.US), client = ContactEntity.CLIENT_PGP, ) ) @@ -271,7 +271,7 @@ class ContactsViewModel(application: Application) : AccountViewModel(application } } - fun filterContacts(searchPattern: String?) { + fun filterContacts(searchPattern: String) { searchPatternLiveData.value = searchPattern } diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/SelectContactsActivity.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/SelectContactsActivity.kt index 095b5647fb..5deaa90007 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/SelectContactsActivity.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/SelectContactsActivity.kt @@ -48,7 +48,7 @@ class SelectContactsActivity : BaseBackStackActivity(), private var emptyView: View? = null private val contactsRecyclerViewAdapter: ContactsRecyclerViewAdapter = ContactsRecyclerViewAdapter(false) - private var searchPattern: String? = null + private var searchPattern: String = "" private val contactsViewModel: ContactsViewModel by viewModels() @VisibleForTesting diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/BackupKeysFragment.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/BackupKeysFragment.kt index 4675f80de3..77fde0aef2 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/BackupKeysFragment.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/BackupKeysFragment.kt @@ -116,9 +116,7 @@ class BackupKeysFragment : BaseFragment(), ProgressBehaviour { override fun onAccountInfoRefreshed(accountEntity: AccountEntity?) { super.onAccountInfoRefreshed(accountEntity) - if (accountEntity?.isRuleExist(OrgRules.DomainRule.NO_PRV_BACKUP) == true) { - binding?.btBackup?.gone() - } + updateBackupButtonVisibility(accountEntity) } private fun initViews() { @@ -128,11 +126,13 @@ class BackupKeysFragment : BaseFragment(), ProgressBehaviour { R.id.rBEmailOption -> { binding?.tVHint?.text = getString(R.string.backup_as_email_hint) binding?.btBackup?.text = getString(R.string.backup_as_email) + updateBackupButtonVisibility(account) } R.id.rBDownloadOption -> { binding?.tVHint?.text = getString(R.string.backup_as_download_hint) binding?.btBackup?.text = getString(R.string.backup_as_a_file) + updateBackupButtonVisibility(account) } } } @@ -373,6 +373,12 @@ class BackupKeysFragment : BaseFragment(), ProgressBehaviour { } } + private fun updateBackupButtonVisibility(accountEntity: AccountEntity?) { + if (accountEntity?.isRuleExist(OrgRules.DomainRule.NO_PRV_BACKUP) == true) { + binding?.btBackup?.gone() + } + } + companion object { private const val REQUEST_CODE_GET_URI_FOR_SAVING_PRIVATE_KEY = 10 }