private async void NotifyAboutPermissionsChange() { bool isEnabled; try { isEnabled = await Xamarin.ExposureNotifications.ExposureNotification.IsEnabledAsync(); } catch (Exception e) { // To make it not crash on devices with normal Play Services before the app is whitelisted if (e.HandleExposureNotificationException(nameof(PermissionsBroadcastReceiver), nameof(NotifyAboutPermissionsChange))) { isEnabled = false; } else { throw e; } } if (!_permissionsUtils.HasPermissionsWithoutDialogs() && isEnabled) { PermissionsMessagingCenter.NotifyPermissionsChanged(this); } }
private async void PreventMultiplePermissionsDialogsForAction(Func <Task <bool> > action) { bool isRunning = await _viewModel.IsRunning(); if ((!isRunning || !_permissionUtils.HasPermissionsWithoutDialogs()) && _dialogDisplayed == false) { _dialogDisplayed = true; if (action != null) { await action.Invoke(); } _dialogDisplayed = false; // wait until BT state change will be completed await BluetoothStateBroadcastReceiver.GetBluetoothState(UpdateUI); } UpdateUI(); }