From bfa0fc35d8b4288b6e588ac89d2ab73176cac6e4 Mon Sep 17 00:00:00 2001 From: Kamal Bramwell <kamal@elixxir.io> Date: Mon, 20 Jun 2022 16:16:23 -0400 Subject: [PATCH 01/18] NotificationForMeReport.source() now determines notification ID --- .../xxlabs/messenger/notifications/MessagingService.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/xxlabs/messenger/notifications/MessagingService.kt b/app/src/main/java/io/xxlabs/messenger/notifications/MessagingService.kt index e03e7259..adcd3320 100644 --- a/app/src/main/java/io/xxlabs/messenger/notifications/MessagingService.kt +++ b/app/src/main/java/io/xxlabs/messenger/notifications/MessagingService.kt @@ -122,7 +122,7 @@ class MessagingService : FirebaseMessagingService(), HasAndroidInjector { val notificationText = getNotificationText(richNotification) ?: richNotification.notificationText() - val _notificationId = notificationId + val _notificationId = richNotification.id() val pendingIntent = generatePendingIntent( generateIntent(richNotification), @@ -139,6 +139,11 @@ class MessagingService : FirebaseMessagingService(), HasAndroidInjector { wakeScreenUp() } + private fun NotificationForMeReport.id(): Int { + return if (source().isNotEmpty()) source().contentHashCode() + else System.currentTimeMillis().toInt() + } + private suspend fun getNotificationText(richNotification: NotificationForMeReport): String? { return with(richNotification) { when { @@ -331,8 +336,6 @@ class MessagingService : FirebaseMessagingService(), HasAndroidInjector { companion object { private const val NOTIFICATION_DATA = "notificationsTag" var notificationCount = 0 - private val notificationId - get() = System.currentTimeMillis().toInt() } } -- GitLab From b6f755e1ba99d6af9b949e31fd6480214e9d9610 Mon Sep 17 00:00:00 2001 From: Kamal Bramwell <kamal@elixxir.io> Date: Mon, 20 Jun 2022 16:17:55 -0400 Subject: [PATCH 02/18] Removed tracking of already sent notifications --- .../notifications/MessagingService.kt | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/app/src/main/java/io/xxlabs/messenger/notifications/MessagingService.kt b/app/src/main/java/io/xxlabs/messenger/notifications/MessagingService.kt index adcd3320..540d6309 100644 --- a/app/src/main/java/io/xxlabs/messenger/notifications/MessagingService.kt +++ b/app/src/main/java/io/xxlabs/messenger/notifications/MessagingService.kt @@ -70,8 +70,6 @@ class MessagingService : FirebaseMessagingService(), HasAndroidInjector { override fun onMessageReceived(remoteMessage: RemoteMessage) { if (XxMessengerApplication.isActivityVisible()) return - val notificationState = NotificationState() - // Check if message contains a data payload. remoteMessage.data.isNotEmpty().let { Timber.v("[NOTIFICATION] Notification data payload: %s", remoteMessage.data) @@ -86,10 +84,9 @@ class MessagingService : FirebaseMessagingService(), HasAndroidInjector { for (i in 0 until isNotificationForMeReport.len()) { with (isNotificationForMeReport[i]) { - if (this.shouldNotify() && !notificationState.alreadySent(this.type())) { + if (this.shouldNotify()) { scope.launch { pushNotification(this@with) - notificationState.sent(this@with.type()) } } } @@ -337,22 +334,4 @@ class MessagingService : FirebaseMessagingService(), HasAndroidInjector { private const val NOTIFICATION_DATA = "notificationsTag" var notificationCount = 0 } -} - -private class NotificationState { - private val notificationSentMap = hashMapOf( - "groupRq" to false, - "group" to false, - "request" to false, - "confirm" to false, - "e2e" to false, - "endFT" to false, - "reset" to false, - ) - - fun sent(type: String) { - notificationSentMap[type] = true - } - - fun alreadySent(type: String) = notificationSentMap[type] ?: false } \ No newline at end of file -- GitLab From a32cc257464c0cfc79dd9b49b829998e9efc9dca Mon Sep 17 00:00:00 2001 From: Kamal Bramwell <kamal@elixxir.io> Date: Mon, 20 Jun 2022 16:18:25 -0400 Subject: [PATCH 03/18] Version up 2.5/575 --- app/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 5a2da9d3..d3f3fcd8 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -35,7 +35,7 @@ android { defaultConfig { applicationId = "io.xxlabs.messenger" - versionCode = 574 + versionCode = 575 versionName = "2.5" minSdk = 26 targetSdk = 31 -- GitLab From 1192c2e484bf9a39fa0d853a30a1ce511748d09b Mon Sep 17 00:00:00 2001 From: Kamal Bramwell <kamal@elixxir.io> Date: Tue, 21 Jun 2022 13:47:40 -0400 Subject: [PATCH 04/18] Removed unused imports --- .../java/io/xxlabs/messenger/ui/main/chats/ChatsViewModel.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/src/main/java/io/xxlabs/messenger/ui/main/chats/ChatsViewModel.kt b/app/src/main/java/io/xxlabs/messenger/ui/main/chats/ChatsViewModel.kt index bb853771..5bd5a0c2 100644 --- a/app/src/main/java/io/xxlabs/messenger/ui/main/chats/ChatsViewModel.kt +++ b/app/src/main/java/io/xxlabs/messenger/ui/main/chats/ChatsViewModel.kt @@ -2,13 +2,11 @@ package io.xxlabs.messenger.ui.main.chats import android.graphics.Bitmap import androidx.lifecycle.* -import com.dropbox.core.v2.team.GroupSelector.groupId import io.reactivex.disposables.CompositeDisposable import io.reactivex.rxkotlin.subscribeBy import io.xxlabs.messenger.application.SchedulerProvider import io.xxlabs.messenger.data.data.ChatWrapper import io.xxlabs.messenger.data.room.model.* -import io.xxlabs.messenger.notifications.MessagingService.Companion.notificationCount import io.xxlabs.messenger.repository.DaoRepository import io.xxlabs.messenger.repository.base.BaseRepository import io.xxlabs.messenger.support.extensions.fromBase64toByteArray -- GitLab From cc48089a791a3988be20ee358e80c1ccc4ff334b Mon Sep 17 00:00:00 2001 From: Kamal Bramwell <kamal@elixxir.io> Date: Tue, 21 Jun 2022 13:48:03 -0400 Subject: [PATCH 05/18] Fixed notification badge count --- .../java/io/xxlabs/messenger/notifications/RichNotifications.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/xxlabs/messenger/notifications/RichNotifications.kt b/app/src/main/java/io/xxlabs/messenger/notifications/RichNotifications.kt index 63f9d5b0..7434a43f 100644 --- a/app/src/main/java/io/xxlabs/messenger/notifications/RichNotifications.kt +++ b/app/src/main/java/io/xxlabs/messenger/notifications/RichNotifications.kt @@ -34,7 +34,7 @@ class RichNotifications { .setAutoCancel(true) .setVibrate(longArrayOf(1000, 1000)) .setLights(Color.WHITE, 1000, 2500) - .setNumber(MessagingService.notificationCount) + .setNumber(1) .setSound(defaultSoundUri) .setContentIntent(pendingIntent) } -- GitLab From b0f64bdd520623108136b56c97299e03e158c97f Mon Sep 17 00:00:00 2001 From: Kamal Bramwell <kamal@elixxir.io> Date: Tue, 21 Jun 2022 13:48:17 -0400 Subject: [PATCH 06/18] Removed notification count tracking --- .../io/xxlabs/messenger/notifications/MessagingService.kt | 7 ------- .../main/java/io/xxlabs/messenger/ui/main/MainActivity.kt | 1 - 2 files changed, 8 deletions(-) diff --git a/app/src/main/java/io/xxlabs/messenger/notifications/MessagingService.kt b/app/src/main/java/io/xxlabs/messenger/notifications/MessagingService.kt index 540d6309..41bb483b 100644 --- a/app/src/main/java/io/xxlabs/messenger/notifications/MessagingService.kt +++ b/app/src/main/java/io/xxlabs/messenger/notifications/MessagingService.kt @@ -115,7 +115,6 @@ class MessagingService : FirebaseMessagingService(), HasAndroidInjector { * Create and show a simple notification containing the received FCM message. */ private suspend fun pushNotification(richNotification: NotificationForMeReport) { - increaseNotificationCount() val notificationText = getNotificationText(richNotification) ?: richNotification.notificationText() @@ -183,11 +182,6 @@ class MessagingService : FirebaseMessagingService(), HasAndroidInjector { private suspend fun lookupGroupName(groupId: ByteArray): String = repo.getGroupData(groupId).value().name - private fun increaseNotificationCount() { - notificationCount++ - Timber.v("[NOTIFICATION] Notification count: $notificationCount") - } - private fun generateIntent(richNotification: NotificationForMeReport): Intent { val intent = if (MainActivity.isActive()) Intent(this, MainActivity::class.java) else Intent(this, SplashScreenPlaceholderActivity::class.java) @@ -332,6 +326,5 @@ class MessagingService : FirebaseMessagingService(), HasAndroidInjector { companion object { private const val NOTIFICATION_DATA = "notificationsTag" - var notificationCount = 0 } } \ No newline at end of file diff --git a/app/src/main/java/io/xxlabs/messenger/ui/main/MainActivity.kt b/app/src/main/java/io/xxlabs/messenger/ui/main/MainActivity.kt index abf3c906..ba939e2f 100755 --- a/app/src/main/java/io/xxlabs/messenger/ui/main/MainActivity.kt +++ b/app/src/main/java/io/xxlabs/messenger/ui/main/MainActivity.kt @@ -226,7 +226,6 @@ class MainActivity : MediaProviderActivity(), SnackBarActivity, CustomToastActiv } private fun verifyFirebaseToken() { - MessagingService.notificationCount = 0 mainViewModel.verifyFirebaseTokenChanged() } -- GitLab From 9cd6a9a16a87c83c095cb53b2004477627075506 Mon Sep 17 00:00:00 2001 From: Kamal Bramwell <kamal@elixxir.io> Date: Tue, 21 Jun 2022 13:49:24 -0400 Subject: [PATCH 07/18] Version up 2.5/576 --- app/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d3f3fcd8..8275c35b 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -35,7 +35,7 @@ android { defaultConfig { applicationId = "io.xxlabs.messenger" - versionCode = 575 + versionCode = 576 versionName = "2.5" minSdk = 26 targetSdk = 31 -- GitLab From c25b749ead463ac1bd60c8ea0ed869af0c1b42ee Mon Sep 17 00:00:00 2001 From: Kamal Bramwell <kamal@elixxir.io> Date: Thu, 23 Jun 2022 09:40:50 -0400 Subject: [PATCH 08/18] Revert "NotificationForMeReport.source() now determines notification ID" This reverts commit bfa0fc35d8b4288b6e588ac89d2ab73176cac6e4. --- .../xxlabs/messenger/notifications/MessagingService.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/xxlabs/messenger/notifications/MessagingService.kt b/app/src/main/java/io/xxlabs/messenger/notifications/MessagingService.kt index 41bb483b..c098e3e8 100644 --- a/app/src/main/java/io/xxlabs/messenger/notifications/MessagingService.kt +++ b/app/src/main/java/io/xxlabs/messenger/notifications/MessagingService.kt @@ -118,7 +118,7 @@ class MessagingService : FirebaseMessagingService(), HasAndroidInjector { val notificationText = getNotificationText(richNotification) ?: richNotification.notificationText() - val _notificationId = richNotification.id() + val _notificationId = notificationId val pendingIntent = generatePendingIntent( generateIntent(richNotification), @@ -135,11 +135,6 @@ class MessagingService : FirebaseMessagingService(), HasAndroidInjector { wakeScreenUp() } - private fun NotificationForMeReport.id(): Int { - return if (source().isNotEmpty()) source().contentHashCode() - else System.currentTimeMillis().toInt() - } - private suspend fun getNotificationText(richNotification: NotificationForMeReport): String? { return with(richNotification) { when { @@ -326,5 +321,7 @@ class MessagingService : FirebaseMessagingService(), HasAndroidInjector { companion object { private const val NOTIFICATION_DATA = "notificationsTag" + private val notificationId + get() = System.currentTimeMillis().toInt() } } \ No newline at end of file -- GitLab From f13d50ec0d58d8e1a25088ce0acdcc631cce7966 Mon Sep 17 00:00:00 2001 From: Kamal Bramwell <kamal@elixxir.io> Date: Wed, 22 Jun 2022 16:59:11 -0400 Subject: [PATCH 09/18] Fixed issue that caused content to be visible before biometric prompt --- app/src/main/java/io/xxlabs/messenger/ui/main/MainActivity.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/xxlabs/messenger/ui/main/MainActivity.kt b/app/src/main/java/io/xxlabs/messenger/ui/main/MainActivity.kt index ba939e2f..817d6d6d 100755 --- a/app/src/main/java/io/xxlabs/messenger/ui/main/MainActivity.kt +++ b/app/src/main/java/io/xxlabs/messenger/ui/main/MainActivity.kt @@ -88,15 +88,16 @@ class MainActivity : MediaProviderActivity(), SnackBarActivity, CustomToastActiv var isBackBtnAllowed = true var isMenuOpened = false + override fun onStart() { super.onStart() + showBiometrics() observeUI() watchObservables() mainViewModel.checkIsLoggedInReturn() } private fun doOnResume() { - showBiometrics() verifyFirebaseToken() initCallbacks() initGroupManager() -- GitLab From 2cc6a58d1e743853c621e1f956a6853c355942b5 Mon Sep 17 00:00:00 2001 From: Kamal Bramwell <kamal@elixxir.io> Date: Thu, 23 Jun 2022 16:23:23 -0400 Subject: [PATCH 10/18] Made biometric popup dialog description field visible --- .../xxlabs/messenger/biometrics/BiometricContainerProvider.kt | 2 +- .../java/io/xxlabs/messenger/support/dialog/BottomSheetPopup.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/xxlabs/messenger/biometrics/BiometricContainerProvider.kt b/app/src/main/java/io/xxlabs/messenger/biometrics/BiometricContainerProvider.kt index e681cc91..3dd55306 100644 --- a/app/src/main/java/io/xxlabs/messenger/biometrics/BiometricContainerProvider.kt +++ b/app/src/main/java/io/xxlabs/messenger/biometrics/BiometricContainerProvider.kt @@ -92,7 +92,7 @@ class BiometricContainerProvider( if (hideCheckbox) { BottomSheetPopup.getInstance( context, - description = "By enabling Biometrics, you will be required to authenticate every time the app is reopened.", + description = "By enabling biometrics, you will be required to authenticate every time the app is reopened.", topButtonTitle = "Yes, enable", topButtonClick = primaryBtnCallback, topButtonDismiss = true, diff --git a/app/src/main/java/io/xxlabs/messenger/support/dialog/BottomSheetPopup.kt b/app/src/main/java/io/xxlabs/messenger/support/dialog/BottomSheetPopup.kt index 409ccd97..e327fb76 100644 --- a/app/src/main/java/io/xxlabs/messenger/support/dialog/BottomSheetPopup.kt +++ b/app/src/main/java/io/xxlabs/messenger/support/dialog/BottomSheetPopup.kt @@ -93,7 +93,7 @@ class BottomSheetPopup constructor( root?.setInsets(bottomMask = WindowInsetsCompat.Type.systemBars() + WindowInsetsCompat.Type.ime()) setBehavior() -// bindTitleIcon() + bindTitleIcon() setBtnVisibility() bindListeners() } -- GitLab From e121f0384e2dee7d2941c930b13d70a3ada7f163 Mon Sep 17 00:00:00 2001 From: Kamal Bramwell <kamal@elixxir.io> Date: Thu, 23 Jun 2022 10:06:23 -0400 Subject: [PATCH 11/18] Removed return label from contact lookup error handling --- .../xxlabs/messenger/ui/global/ContactsViewModel.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/xxlabs/messenger/ui/global/ContactsViewModel.kt b/app/src/main/java/io/xxlabs/messenger/ui/global/ContactsViewModel.kt index 0f91c954..e98b8561 100644 --- a/app/src/main/java/io/xxlabs/messenger/ui/global/ContactsViewModel.kt +++ b/app/src/main/java/io/xxlabs/messenger/ui/global/ContactsViewModel.kt @@ -431,12 +431,6 @@ class ContactsViewModel @Inject constructor( private fun verifyContactViaLookup(contact: ContactData) { Timber.v("[RECEIVED REQUEST] User does not have facts - UD Lookup") repo.userLookup(contact.userId) { newContact, error -> - if (!error.isNullOrEmpty()) { - Timber.v("[RECEIVED REQUEST] Contact ${contact.userId.toBase64String()} is UNVERIFIED") - onFailedToVerify(contact) - return@userLookup - } - if (newContact != null) { if (newContact.getId().contentEquals(contact.userId)) { // Verifying Timber.v("[RECEIVED REQUEST] Contact ${contact.userId.toBase64String()} is VERIFIED") @@ -445,6 +439,12 @@ class ContactsViewModel @Inject constructor( Timber.v("[RECEIVED REQUEST] Contact ${contact.userId.toBase64String()} is FRAUDULENT") deleteFraudulentContact(contact) } + return@userLookup + } + + if (!error.isNullOrEmpty()) { + Timber.v("[RECEIVED REQUEST] Contact ${contact.userId.toBase64String()} is UNVERIFIED") + onFailedToVerify(contact) } } } -- GitLab From 382f021ae0e4a45870d3f202902560601fcdc7bf Mon Sep 17 00:00:00 2001 From: Kamal Bramwell <kamal@elixxir.io> Date: Thu, 23 Jun 2022 10:13:23 -0400 Subject: [PATCH 12/18] Renamed "newContact" to "searchResult" --- .../io/xxlabs/messenger/ui/global/ContactsViewModel.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/xxlabs/messenger/ui/global/ContactsViewModel.kt b/app/src/main/java/io/xxlabs/messenger/ui/global/ContactsViewModel.kt index e98b8561..f93533dd 100644 --- a/app/src/main/java/io/xxlabs/messenger/ui/global/ContactsViewModel.kt +++ b/app/src/main/java/io/xxlabs/messenger/ui/global/ContactsViewModel.kt @@ -430,11 +430,11 @@ class ContactsViewModel @Inject constructor( private fun verifyContactViaLookup(contact: ContactData) { Timber.v("[RECEIVED REQUEST] User does not have facts - UD Lookup") - repo.userLookup(contact.userId) { newContact, error -> - if (newContact != null) { - if (newContact.getId().contentEquals(contact.userId)) { // Verifying + repo.userLookup(contact.userId) { searchResult, error -> + if (searchResult != null) { + if (searchResult.getId().contentEquals(contact.userId)) { // Verifying Timber.v("[RECEIVED REQUEST] Contact ${contact.userId.toBase64String()} is VERIFIED") - verifyContact(contact, newContact) + verifyContact(contact, searchResult) } else { //Fraudulent Timber.v("[RECEIVED REQUEST] Contact ${contact.userId.toBase64String()} is FRAUDULENT") deleteFraudulentContact(contact) @@ -444,6 +444,8 @@ class ContactsViewModel @Inject constructor( if (!error.isNullOrEmpty()) { Timber.v("[RECEIVED REQUEST] Contact ${contact.userId.toBase64String()} is UNVERIFIED") + // An error occurred while searching UD, the contact is still unverified. + Timber.d("Search UD error: $error") onFailedToVerify(contact) } } -- GitLab From e38cf2384d52285281242ecc5f2bbc429e9ac5bc Mon Sep 17 00:00:00 2001 From: Kamal Bramwell <kamal@elixxir.io> Date: Thu, 23 Jun 2022 10:15:32 -0400 Subject: [PATCH 13/18] Fixed incorrect logic that was failing to verify requests --- .../messenger/ui/global/ContactsViewModel.kt | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/io/xxlabs/messenger/ui/global/ContactsViewModel.kt b/app/src/main/java/io/xxlabs/messenger/ui/global/ContactsViewModel.kt index f93533dd..3c9ac04d 100644 --- a/app/src/main/java/io/xxlabs/messenger/ui/global/ContactsViewModel.kt +++ b/app/src/main/java/io/xxlabs/messenger/ui/global/ContactsViewModel.kt @@ -398,21 +398,17 @@ class ContactsViewModel @Inject constructor( else -> return } - repo.searchUd(factPair.first, factPair.second) { newContact, error -> - if (!error.isNullOrEmpty()) { - continueVerificationStep(contact, newContact) + repo.searchUd(factPair.first, factPair.second) { searchResult, error -> + if (error.isNullOrEmpty()) { + continueVerificationStep(contact, searchResult) } else { // An error occurred while searching UD, the contact is still unverified. - markAsFailed(contact) + Timber.d("Search UD error: $error") + onFailedToVerify(contact) } } } - private fun markAsFailed(contact: ContactData) { - // The verification couldn't be completed. Keep the contact as unverified to try again. - updateContactStatus(contact.userId, VERIFICATION_FAIL) - } - private fun continueVerificationStep(contact: ContactData, searchResult: ContactWrapperBase?) { if (searchResult == null) { // Fraudulent Timber.v("[RECEIVED REQUEST] Contact ${contact.userId.toBase64String()} is FRAUDULENT") -- GitLab From e120a52357b0d298986125d07b49e08ef0d305af Mon Sep 17 00:00:00 2001 From: Kamal Bramwell <kamal@elixxir.io> Date: Thu, 23 Jun 2022 10:17:05 -0400 Subject: [PATCH 14/18] Version up 2.5/577 --- app/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 8275c35b..dfbef708 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -35,7 +35,7 @@ android { defaultConfig { applicationId = "io.xxlabs.messenger" - versionCode = 576 + versionCode = 577 versionName = "2.5" minSdk = 26 targetSdk = 31 -- GitLab From 9afe4f73ff751cc114c6c0aab4ec1a7d3a2e2067 Mon Sep 17 00:00:00 2001 From: Kamal Bramwell <kamal@elixxir.io> Date: Thu, 23 Jun 2022 13:38:02 -0400 Subject: [PATCH 15/18] Simplified contact verification logic for user lookup/search result --- .../requests/bindings/RequestVerifier.kt | 6 ++++-- .../messenger/ui/global/ContactsViewModel.kt | 15 +++------------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/io/xxlabs/messenger/requests/bindings/RequestVerifier.kt b/app/src/main/java/io/xxlabs/messenger/requests/bindings/RequestVerifier.kt index 5640dd51..e6517706 100644 --- a/app/src/main/java/io/xxlabs/messenger/requests/bindings/RequestVerifier.kt +++ b/app/src/main/java/io/xxlabs/messenger/requests/bindings/RequestVerifier.kt @@ -70,8 +70,8 @@ class BindingsRequestVerifier @Inject constructor( } repo.searchUd(factPair.first, factPair.second) { result, error -> - error?.let { - if (it.isBlank()) continuation.resume(Unverified(user)) + if (!error.isNullOrEmpty()) { + continuation.resume(Unverified(user)) return@searchUd } @@ -102,6 +102,8 @@ class BindingsRequestVerifier @Inject constructor( } else { continuation.resume(Fraudulent(user)) } + } ?: run { + continuation.resume(Fraudulent(user)) } } } diff --git a/app/src/main/java/io/xxlabs/messenger/ui/global/ContactsViewModel.kt b/app/src/main/java/io/xxlabs/messenger/ui/global/ContactsViewModel.kt index 3c9ac04d..019500c4 100644 --- a/app/src/main/java/io/xxlabs/messenger/ui/global/ContactsViewModel.kt +++ b/app/src/main/java/io/xxlabs/messenger/ui/global/ContactsViewModel.kt @@ -427,18 +427,9 @@ class ContactsViewModel @Inject constructor( private fun verifyContactViaLookup(contact: ContactData) { Timber.v("[RECEIVED REQUEST] User does not have facts - UD Lookup") repo.userLookup(contact.userId) { searchResult, error -> - if (searchResult != null) { - if (searchResult.getId().contentEquals(contact.userId)) { // Verifying - Timber.v("[RECEIVED REQUEST] Contact ${contact.userId.toBase64String()} is VERIFIED") - verifyContact(contact, searchResult) - } else { //Fraudulent - Timber.v("[RECEIVED REQUEST] Contact ${contact.userId.toBase64String()} is FRAUDULENT") - deleteFraudulentContact(contact) - } - return@userLookup - } - - if (!error.isNullOrEmpty()) { + if (error.isNullOrEmpty()) { + continueVerificationStep(contact, searchResult) + } else { Timber.v("[RECEIVED REQUEST] Contact ${contact.userId.toBase64String()} is UNVERIFIED") // An error occurred while searching UD, the contact is still unverified. Timber.d("Search UD error: $error") -- GitLab From b3deb1fedf1786aa906ccacac248daceb5784be3 Mon Sep 17 00:00:00 2001 From: Kamal Bramwell <kamal@elixxir.io> Date: Thu, 23 Jun 2022 16:01:49 -0400 Subject: [PATCH 16/18] Moved failUnverifiedRequests to onSuccess of stopNetworkFollower --- .../main/java/io/xxlabs/messenger/ui/global/NetworkViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/io/xxlabs/messenger/ui/global/NetworkViewModel.kt b/app/src/main/java/io/xxlabs/messenger/ui/global/NetworkViewModel.kt index 6abb62da..15f78913 100644 --- a/app/src/main/java/io/xxlabs/messenger/ui/global/NetworkViewModel.kt +++ b/app/src/main/java/io/xxlabs/messenger/ui/global/NetworkViewModel.kt @@ -270,7 +270,6 @@ class NetworkViewModel @Inject constructor( } private fun stopNetworkFollower() { - requestsDataSource.failUnverifiedRequests() subscriptions.add( repo.stopNetworkFollower() .subscribeOn(schedulers.single) @@ -280,6 +279,7 @@ class NetworkViewModel @Inject constructor( isNetworkHealthy = false isFirstTimeNetwork = true resetNetworkState() + requestsDataSource.failUnverifiedRequests() Timber.v("[NETWORK VIEWMODEL] Network follower is NOT RUNNING") } .doOnError { err -> -- GitLab From a63da8a54602747ecb8b1efa4fc8fc03b94e25d2 Mon Sep 17 00:00:00 2001 From: Kamal Bramwell <kamal@elixxir.io> Date: Thu, 23 Jun 2022 16:16:02 -0400 Subject: [PATCH 17/18] Fixed bug that changed requests to failed to verify --- .../requests/data/contact/ContactRequestRepository.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/xxlabs/messenger/requests/data/contact/ContactRequestRepository.kt b/app/src/main/java/io/xxlabs/messenger/requests/data/contact/ContactRequestRepository.kt index 241280f1..8d48c356 100644 --- a/app/src/main/java/io/xxlabs/messenger/requests/data/contact/ContactRequestRepository.kt +++ b/app/src/main/java/io/xxlabs/messenger/requests/data/contact/ContactRequestRepository.kt @@ -121,12 +121,13 @@ class ContactRequestsRepository @Inject constructor( override fun failUnverifiedRequests() { scope.launch { - getRequests().collect { requests -> + getRequests().cancellable().collect { requests -> requests.filter { it.requestStatus == VERIFYING }.forEach { update(it, VERIFICATION_FAIL) } + this.coroutineContext.job.cancel() } } } -- GitLab From 19b673221444e28d4c5ea641b9c46b2678a753bf Mon Sep 17 00:00:00 2001 From: Kamal Bramwell <kamal@elixxir.io> Date: Thu, 23 Jun 2022 16:23:27 -0400 Subject: [PATCH 18/18] Version up 2.5/578 --- app/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index dfbef708..71634a48 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -35,7 +35,7 @@ android { defaultConfig { applicationId = "io.xxlabs.messenger" - versionCode = 577 + versionCode = 578 versionName = "2.5" minSdk = 26 targetSdk = 31 -- GitLab