Softeq / XToolkit.WhiteLabel

Modular MVVM framework for fast creating powerful cross-platform applications with Xamarin & .NET for Mobile
https://softeq.github.io/XToolkit.WhiteLabel/
MIT License
24 stars 5 forks source link

Push Notification permissions inconsistency #502

Open TimofeyBurak opened 1 year ago

TimofeyBurak commented 1 year ago

Description

Push-notifications permissions are requested with hardcoded options, even though the options should probably be defined by PushNotificationService functionality: https://github.com/Softeq/XToolkit.WhiteLabel/blob/master/Softeq.XToolkit.Permissions.iOS/PermissionsService.cs#L70-L78

Also, it seems like our implementation of checking push-notification permissions might have an issue: we take into account specific settings, not only authorization status https://github.com/Softeq/XToolkit.WhiteLabel/blob/master/Softeq.XToolkit.Permissions.iOS/PermissionsService.cs#L54-L68 One thing is that settings are hardcoded, which is not good - again, seems like PushNotificationService should decide which settings are actually required. The second is that the logic itself might be a bit incorrect - if user grants permission for alert+sound, for instance, and then disables sounds in settings, then our implementation would say that notification permissions are denied, although it is not true and notifications would still be received and shown to user.

Steps to Reproduce

  1. Request push notification permission using IPermissionsManager.CheckWithRequestAsync<NotificationsPermission>()
  2. Use PushNotificationService to handle push notifications

Expected Behavior

PushNotificationService has all required options authorized

Actual Behavior

Only Alert and Sound options are authorized always

Possible Fix

I would suggest to remove push-notification permissions from the Permissions project and implement it in the PushNotifications project (as a part of IPushNotificationService, or as a separate service?), and also rework check permissions logic.

Basic Information

TimofeyBurak commented 1 year ago

Related to #500