Skip to content

Commit

Permalink
update 'dismiss' request wording with defer
Browse files Browse the repository at this point in the history
  • Loading branch information
jakub-rdx committed Jun 25, 2024
1 parent 67b9c8a commit e6a77e1
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class IncomingRequestRepositoryImpl @Inject constructor(
* - there is high priority screen in the queue, so the incoming request is added below it,
* taking priority over requests currently in the queue
* - there is no high priority screen: request is added at the top of queue and if there other request currently handled,
* we send a dismiss event for it so that UI can react and dismiss handling, without removing it from the queue.
* Dismissed request will be handled again when top priority one handling completes
* we send a defer event for it so that UI can react and defer handling, without removing it from the queue.
* Deferred request will be handled again when top priority one handling completes
*/
override suspend fun addMobileConnectRequest(incomingRequest: IncomingRequest) {
mutex.withLock {
Expand All @@ -87,8 +87,8 @@ class IncomingRequestRepositoryImpl @Inject constructor(
val handlingPaused = requestQueue.contains(QueueItem.HighPriorityScreen)
when {
currentRequest != null -> {
Timber.d("🗂 Dismissing request with id ${currentRequest.interactionId}")
appEventBus.sendEvent(AppEvent.DismissRequestHandling(currentRequest.interactionId))
Timber.d("🗂 Deferring request with id ${currentRequest.interactionId}")
appEventBus.sendEvent(AppEvent.DeferRequestHandling(currentRequest.interactionId))
}

else -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class DAppAuthorizedLoginViewModel @Inject constructor(

init {
viewModelScope.launch {
appEventBus.events.filterIsInstance<AppEvent.DismissRequestHandling>().collect {
appEventBus.events.filterIsInstance<AppEvent.DeferRequestHandling>().collect {
if (it.interactionId == args.interactionId) {
sendEvent(Event.CloseLoginFlow)
incomingRequestRepository.requestDeferred(args.interactionId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class DAppUnauthorizedLoginViewModel @Inject constructor(
init {
observeSigningState()
viewModelScope.launch {
appEventBus.events.filterIsInstance<AppEvent.DismissRequestHandling>().collect {
appEventBus.events.filterIsInstance<AppEvent.DeferRequestHandling>().collect {
if (it.interactionId == args.interactionId) {
sendEvent(Event.CloseLoginFlow)
incomingRequestRepository.requestDeferred(args.interactionId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class TransactionReviewViewModel @Inject constructor(
}
}
viewModelScope.launch {
appEventBus.events.filterIsInstance<AppEvent.DismissRequestHandling>().collect {
appEventBus.events.filterIsInstance<AppEvent.DeferRequestHandling>().collect {
if (it.interactionId == args.interactionId) {
sendEvent(Event.Dismiss)
incomingRequestRepository.requestDeferred(args.interactionId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ sealed interface AppEvent {
data object NPSSurveySubmitted : AppEvent

data object SecureFolderWarning : AppEvent
data class DismissRequestHandling(val interactionId: String) : AppEvent
data class DeferRequestHandling(val interactionId: String) : AppEvent
sealed interface AccessFactorSources : AppEvent {

data class SelectedLedgerDevice(val ledgerFactorSource: FactorSource.Ledger) : AccessFactorSources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class IncomingRequestRepositoryTest {
advanceUntilIdle()
assert(currentRequest?.interactionId == interactionId2)
assertTrue(incomingRequestRepository.getAmountOfRequests() == 2)
coVerify(exactly = 1) { eventBus.sendEvent(AppEvent.DismissRequestHandling(interactionId1)) }
coVerify(exactly = 1) { eventBus.sendEvent(AppEvent.DeferRequestHandling(interactionId1)) }
}

@Test
Expand Down

0 comments on commit e6a77e1

Please sign in to comment.