Baseflow / Baseflow/XF-Material-Library

await MaterialDialog.Instance.AlertAsync not waiting

Open
#392 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
633
Forks
150
PR merge metrics
No merged PRs in 30d

Description

## 🐛 Bug Report

A call to `await MaterialDialog.Instance.AlertAsync` does not wait unitl the dialog's dismiss before continuing.

Doing some tests, calling `var msgResult = await MaterialDialog.Instance.ConfirmAsync` actually waits so I looked at the code to see what the differences are.
I think the problem is due to the way the dialog is shown on the `AlertAsync`: in `AlertAsync` the task returned is the one from `await dialog.ShowAsync`
https://github.com/Baseflow/XF-Material-Library/blob/589fcf485576d2717e6090789aeb17ed75e2a140/XF.Material/UI/Dialogs/MaterialAlertDialog.xaml.cs#L43

On `ConfirmAsync` the returned task is the one from `InputTaskCompletionSource` which is fired only after a button press
https://github.com/Baseflow/XF-Material-Library/blob/589fcf485576d2717e6090789aeb17ed75e2a140/XF.Material/UI/Dialogs/MaterialAlertDialog.xaml.cs#L61

For now a workaround is just to call `ConfirmAsync` instead of `AlertAsync` and setting `dismissiveText` to `null`, with this we have basically the same funcionality of `AlertAsync`.

### Configuration

**Version:** 1.7.5

**Platform:**
- [ ] :iphone: iOS
- [x] :robot: Android
- [ ] :checkered_flag: WPF
- [ ] :earth_americas: UWP
- [ ] :apple: MacOS
- [ ] :tv: tvOS
- [ ] :monkey: Xamarin.Forms

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.