Skip to content

[PM-3165] Fix custom block URI dialog cancellation#2647

Merged
fedemkr merged 1 commit intomasterfrom
vault/pm-3165/fix-finish-task-on-cancel-dialog
Jul 27, 2023
Merged

[PM-3165] Fix custom block URI dialog cancellation#2647
fedemkr merged 1 commit intomasterfrom
vault/pm-3165/fix-finish-task-on-cancel-dialog

Conversation

@fedemkr
Copy link
Member

@fedemkr fedemkr commented Jul 27, 2023

Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

Fix custom block URI dialog cancellation to finish its internal task and not block the button.

Code changes

  • DeviceActionService: Added BasicDialogWithResultCancelListener to handle dialog cancellation and set the return task value to null so that the task gets finished when the user taps in the background to cancel the opened dialog.

Before you submit

  • Please check for formatting errors (dotnet format --verify-no-changes) (required)
  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team

@fedemkr fedemkr requested a review from a team July 27, 2023 20:11
@bitwarden-bot
Copy link

Logo
Checkmarx One – Scan Summary & Details687279ca-1cb4-4768-bc84-ad655bef798b

No New Or Fixed Issues Found


var result = new TaskCompletionSource<ValidatablePromptResponse?>();

alertBuilder.SetOnCancelListener(new BasicDialogWithResultCancelListener(result));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, why not just use the same (sender, args) => result.TrySetResult(null) as the negative listener? Is it preventing the dialog from dismissing properly?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The negative listener is for the "cancel" button of the dialog and the SetOnCancelListener is for when the user taps in the background to dismiss the dialog. Currently, there is no EventHandler property to use the form (sender, args) => result.TrySetResult(null) so that's why I implemented a custom class for the listener.

@fedemkr fedemkr merged commit 9eda015 into master Jul 27, 2023
@fedemkr fedemkr deleted the vault/pm-3165/fix-finish-task-on-cancel-dialog branch July 27, 2023 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants