From 73a2f98ddd256be87b3881402a1ba7093c451744 Mon Sep 17 00:00:00 2001 From: "giannis.tsepas" Date: Mon, 1 Jul 2024 18:16:48 +0300 Subject: [PATCH 1/4] temp revert priority --- .../data/dapp/IncomingRequestRepository.kt | 20 +++++++++++++------ .../presentation/main/MainViewModel.kt | 8 ++++---- 2 files changed, 18 insertions(+), 10 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 dcab9aae01..5f7f34f582 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,15 +149,23 @@ class IncomingRequestRepositoryImpl @Inject constructor( } // Put high priority item below any internal request and mobile connect requests - 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 || 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) +// } 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 1ef3083078..4b685d9006 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 @@ -286,11 +286,11 @@ class MainViewModel @Inject constructor( verifyingDappRequestJob = viewModelScope.launch { verifyDappUseCase(request).onSuccess { verified -> if (verified) { - if (request.isMobileConnectRequest) { - incomingRequestRepository.addPriorityRequest(request) - } else { +// if (request.isMobileConnectRequest) { +// incomingRequestRepository.addPriorityRequest(request) +// } else { incomingRequestRepository.add(request) - } +// } } }.onFailure { error -> if (error is RadixWalletException.DappRequestException) { From 2ecff44b978755972368c0ebe06805b4c7693818 Mon Sep 17 00:00:00 2001 From: "giannis.tsepas" Date: Mon, 1 Jul 2024 18:50:20 +0300 Subject: [PATCH 2/4] 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 -> From 9e614592b20eedf2f0a98fc0500d4ed663dee154 Mon Sep 17 00:00:00 2001 From: "giannis.tsepas" Date: Mon, 1 Jul 2024 18:52:26 +0300 Subject: [PATCH 3/4] removed unnecessary code --- .../wallet/android/data/dapp/IncomingRequestRepository.kt | 6 ------ 1 file changed, 6 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 734393c53c..aea59d765a 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,12 +149,6 @@ 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) { -// 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 From c48af5a589a1d48995ca62a38d56772f4af9e607 Mon Sep 17 00:00:00 2001 From: "giannis.tsepas" Date: Mon, 1 Jul 2024 19:06:56 +0300 Subject: [PATCH 4/4] added logs --- .../wallet/android/data/dapp/IncomingRequestRepository.kt | 2 +- .../babylon/wallet/android/presentation/main/MainViewModel.kt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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 aea59d765a..cacce9be53 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 @@ -179,6 +179,7 @@ class IncomingRequestRepositoryImpl @Inject constructor( if (queueItem == null) { Timber.w("Request with id $requestId is null") } + Timber.d("\uD83D\uDDC2 get request $requestId") return (queueItem as? QueueItem.RequestItem)?.incomingRequest } @@ -194,7 +195,6 @@ class IncomingRequestRepositoryImpl @Inject constructor( // In order to emit an incoming request, the topmost item should be // a. An incoming request // b. It should not be the same as the one being handled already - Timber.d("Next request id ${(nextRequest as? QueueItem.RequestItem)?.incomingRequest?.interactionId}") if (nextRequest is QueueItem.RequestItem && _currentRequestToHandle.value != nextRequest.incomingRequest) { _currentRequestToHandle.emit(nextRequest.incomingRequest) } 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 6db1127b8c..4fd263edae 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 @@ -286,6 +286,7 @@ class MainViewModel @Inject constructor( verifyingDappRequestJob = viewModelScope.launch { verifyDappUseCase(request).onSuccess { verified -> if (verified) { + // TODO temporarily disabled for the 1.7.0 release. This will be included in the next release. // if (request.isMobileConnectRequest) { // incomingRequestRepository.addPriorityRequest(request) // } else {