From 2ecff44b978755972368c0ebe06805b4c7693818 Mon Sep 17 00:00:00 2001 From: "giannis.tsepas" Date: Mon, 1 Jul 2024 18:50:20 +0300 Subject: [PATCH] temp revert priority --- .../data/dapp/IncomingRequestRepository.kt | 26 +++++++++---------- .../presentation/main/MainViewModel.kt | 2 +- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/com/babylon/wallet/android/data/dapp/IncomingRequestRepository.kt b/app/src/main/java/com/babylon/wallet/android/data/dapp/IncomingRequestRepository.kt index 5f7f34f582..734393c53c 100644 --- a/app/src/main/java/com/babylon/wallet/android/data/dapp/IncomingRequestRepository.kt +++ b/app/src/main/java/com/babylon/wallet/android/data/dapp/IncomingRequestRepository.kt @@ -149,23 +149,21 @@ class IncomingRequestRepositoryImpl @Inject constructor( } // Put high priority item below any internal request and mobile connect requests - val topQueueItem = requestQueue.peekFirst() - if (topQueueItem is QueueItem.RequestItem && - (topQueueItem.incomingRequest.isInternal || topQueueItem.incomingRequest.isMobileConnectRequest) - ) { - requestQueue.add(1, QueueItem.HighPriorityScreen) - } else { - requestQueue.addFirst(QueueItem.HighPriorityScreen) - } -// val index = requestQueue.indexOfFirst { -// val item = it as? QueueItem.RequestItem -// item != null && !item.incomingRequest.isInternal && !item.incomingRequest.isMobileConnectRequest -// } -// if (index != -1) { -// requestQueue.add(index, QueueItem.HighPriorityScreen) +// val topQueueItem = requestQueue.peekFirst() +// if (topQueueItem is QueueItem.RequestItem && topQueueItem.incomingRequest.isInternal) { +// requestQueue.add(1, QueueItem.HighPriorityScreen) // } else { // requestQueue.addFirst(QueueItem.HighPriorityScreen) // } + val index = requestQueue.indexOfFirst { + val item = it as? QueueItem.RequestItem + item != null && !item.incomingRequest.isInternal + } + if (index != -1) { + requestQueue.add(index, QueueItem.HighPriorityScreen) + } else { + requestQueue.addFirst(QueueItem.HighPriorityScreen) + } Timber.d("🗂 Temporarily pausing incoming message queue") } } diff --git a/app/src/main/java/com/babylon/wallet/android/presentation/main/MainViewModel.kt b/app/src/main/java/com/babylon/wallet/android/presentation/main/MainViewModel.kt index 4b685d9006..6db1127b8c 100644 --- a/app/src/main/java/com/babylon/wallet/android/presentation/main/MainViewModel.kt +++ b/app/src/main/java/com/babylon/wallet/android/presentation/main/MainViewModel.kt @@ -289,7 +289,7 @@ class MainViewModel @Inject constructor( // if (request.isMobileConnectRequest) { // incomingRequestRepository.addPriorityRequest(request) // } else { - incomingRequestRepository.add(request) + incomingRequestRepository.add(request) // } } }.onFailure { error ->