Skip to content

Commit

Permalink
Add PostNotifications to Permissions (#19472)
Browse files Browse the repository at this point in the history
* add PostNotifications to Permissions

* brackets fix

* PublicAPI update[s]

* Update PublicAPI.Shipped.txt

* Add Essentials Sample

---------

Co-authored-by: moljac <mcvjetko@holisticware.net>
  • Loading branch information
jfversluis and moljac committed Jan 18, 2024
1 parent bbcef38 commit d594604
Show file tree
Hide file tree
Showing 15 changed files with 66 additions and 0 deletions.
Expand Up @@ -26,6 +26,7 @@ public class PermissionsViewModel : BaseViewModel
new PermissionItem("Phone", new Permissions.Phone()),
new PermissionItem("Photos", new Permissions.Photos()),
new PermissionItem("Photos AddOnly", new Permissions.PhotosAddOnly()),
new PermissionItem("Post Notification", new Permissions.PostNotifications()),
new PermissionItem("Reminders", new Permissions.Reminders()),
new PermissionItem("Sensors", new Permissions.Sensors()),
new PermissionItem("SMS", new Permissions.Sms()),
Expand Down
22 changes: 22 additions & 0 deletions src/Essentials/src/Permissions/Permissions.android.cs
Expand Up @@ -455,6 +455,28 @@ public partial class PhotosAddOnly : BasePlatformPermission
{
}

public partial class PostNotifications : BasePlatformPermission
{
public override (string androidPermission, bool isRuntime)[] RequiredPermissions
{
get
{
var permissions = new List<(string, bool)>();

#if __ANDROID_33__
if (OperatingSystem.IsAndroidVersionAtLeast(33) && Application.Context.ApplicationInfo.TargetSdkVersion >= BuildVersionCodes.Tiramisu)
{
// new runtime permissions on Android 12
if (IsDeclaredInManifest(Manifest.Permission.PostNotifications))
permissions.Add((Manifest.Permission.PostNotifications, true));
}
#endif

return permissions.ToArray();
}
}
}

public partial class Reminders : BasePlatformPermission
{
}
Expand Down
Expand Up @@ -288,6 +288,10 @@ public partial class PhotosAddOnly : BasePlatformPermission
{
}

public partial class PostNotifications : BasePlatformPermission
{
}

public partial class Reminders : BasePlatformPermission
{
}
Expand Down
4 changes: 4 additions & 0 deletions src/Essentials/src/Permissions/Permissions.macos.cs
Expand Up @@ -207,6 +207,10 @@ public partial class PhotosAddOnly : BasePlatformPermission
{
}

public partial class PostNotifications : BasePlatformPermission
{
}

public partial class Reminders : BasePlatformPermission
{
}
Expand Down
4 changes: 4 additions & 0 deletions src/Essentials/src/Permissions/Permissions.netstandard.cs
Expand Up @@ -109,6 +109,10 @@ public partial class PhotosAddOnly : BasePlatformPermission
{
}

public partial class PostNotifications : BasePlatformPermission
{
}

public partial class Reminders : BasePlatformPermission
{
}
Expand Down
8 changes: 8 additions & 0 deletions src/Essentials/src/Permissions/Permissions.shared.cs
Expand Up @@ -252,6 +252,14 @@ public partial class PhotosAddOnly : BasePlatformPermission
{
}

/// <summary>
/// Represents permission to post notifications
/// </summary>
public partial class PostNotifications
{
}


/// <summary>
/// Represents permission to access the device reminders data.
/// </summary>
Expand Down
4 changes: 4 additions & 0 deletions src/Essentials/src/Permissions/Permissions.tizen.cs
Expand Up @@ -211,6 +211,10 @@ public partial class Photos : BasePlatformPermission
{
}

public partial class PostNotifications : BasePlatformPermission
{
}

public partial class Reminders : BasePlatformPermission
{
}
Expand Down
4 changes: 4 additions & 0 deletions src/Essentials/src/Permissions/Permissions.uwp.cs
Expand Up @@ -191,6 +191,10 @@ public partial class Photos : BasePlatformPermission
{
}

public partial class PostNotifications : BasePlatformPermission
{
}

public partial class Reminders : BasePlatformPermission
{
}
Expand Down
Expand Up @@ -93,6 +93,7 @@
~override Microsoft.Maui.ApplicationModel.Permissions.NearbyWifiDevices.RequiredPermissions.get -> (string androidPermission, bool isRuntime)[]
~override Microsoft.Maui.ApplicationModel.Permissions.NetworkState.RequiredPermissions.get -> (string androidPermission, bool isRuntime)[]
~override Microsoft.Maui.ApplicationModel.Permissions.Phone.RequiredPermissions.get -> (string androidPermission, bool isRuntime)[]
~override Microsoft.Maui.ApplicationModel.Permissions.PostNotifications.RequiredPermissions.get -> (string androidPermission, bool isRuntime)[]
~override Microsoft.Maui.ApplicationModel.Permissions.Sensors.RequiredPermissions.get -> (string androidPermission, bool isRuntime)[]
~override Microsoft.Maui.ApplicationModel.Permissions.Sms.RequiredPermissions.get -> (string androidPermission, bool isRuntime)[]
~override Microsoft.Maui.ApplicationModel.Permissions.Speech.RequiredPermissions.get -> (string androidPermission, bool isRuntime)[]
Expand Down Expand Up @@ -434,6 +435,8 @@ Microsoft.Maui.ApplicationModel.Permissions.Phone.Phone() -> void
Microsoft.Maui.ApplicationModel.Permissions.Photos
Microsoft.Maui.ApplicationModel.Permissions.Photos.Photos() -> void
Microsoft.Maui.ApplicationModel.Permissions.PhotosAddOnly
Microsoft.Maui.ApplicationModel.Permissions.PostNotifications.PostNotifications() -> void
Microsoft.Maui.ApplicationModel.Permissions.PostNotifications
Microsoft.Maui.ApplicationModel.Permissions.PhotosAddOnly.PhotosAddOnly() -> void
Microsoft.Maui.ApplicationModel.Permissions.Reminders
Microsoft.Maui.ApplicationModel.Permissions.Reminders.Reminders() -> void
Expand Down
2 changes: 2 additions & 0 deletions src/Essentials/src/PublicAPI/net-ios/PublicAPI.Shipped.txt
Expand Up @@ -433,6 +433,8 @@ Microsoft.Maui.ApplicationModel.Permissions.Photos
Microsoft.Maui.ApplicationModel.Permissions.Photos.Photos() -> void
Microsoft.Maui.ApplicationModel.Permissions.PhotosAddOnly
Microsoft.Maui.ApplicationModel.Permissions.PhotosAddOnly.PhotosAddOnly() -> void
Microsoft.Maui.ApplicationModel.Permissions.PostNotifications
Microsoft.Maui.ApplicationModel.Permissions.PostNotifications.PostNotifications() -> void
Microsoft.Maui.ApplicationModel.Permissions.Reminders
Microsoft.Maui.ApplicationModel.Permissions.Reminders.Reminders() -> void
Microsoft.Maui.ApplicationModel.Permissions.Sensors
Expand Down
Expand Up @@ -433,6 +433,8 @@ Microsoft.Maui.ApplicationModel.Permissions.Photos
Microsoft.Maui.ApplicationModel.Permissions.Photos.Photos() -> void
Microsoft.Maui.ApplicationModel.Permissions.PhotosAddOnly
Microsoft.Maui.ApplicationModel.Permissions.PhotosAddOnly.PhotosAddOnly() -> void
Microsoft.Maui.ApplicationModel.Permissions.PostNotifications
Microsoft.Maui.ApplicationModel.Permissions.PostNotifications.PostNotifications() -> void
Microsoft.Maui.ApplicationModel.Permissions.Reminders
Microsoft.Maui.ApplicationModel.Permissions.Reminders.Reminders() -> void
Microsoft.Maui.ApplicationModel.Permissions.Sensors
Expand Down
2 changes: 2 additions & 0 deletions src/Essentials/src/PublicAPI/net-tizen/PublicAPI.Shipped.txt
Expand Up @@ -397,6 +397,8 @@ Microsoft.Maui.ApplicationModel.Permissions.Photos
Microsoft.Maui.ApplicationModel.Permissions.Photos.Photos() -> void
Microsoft.Maui.ApplicationModel.Permissions.PhotosAddOnly
Microsoft.Maui.ApplicationModel.Permissions.PhotosAddOnly.PhotosAddOnly() -> void
Microsoft.Maui.ApplicationModel.Permissions.PostNotifications
Microsoft.Maui.ApplicationModel.Permissions.PostNotifications.PostNotifications() -> void
Microsoft.Maui.ApplicationModel.Permissions.Reminders
Microsoft.Maui.ApplicationModel.Permissions.Reminders.Reminders() -> void
Microsoft.Maui.ApplicationModel.Permissions.Sensors
Expand Down
Expand Up @@ -394,6 +394,8 @@ Microsoft.Maui.ApplicationModel.Permissions.Photos
Microsoft.Maui.ApplicationModel.Permissions.Photos.Photos() -> void
Microsoft.Maui.ApplicationModel.Permissions.PhotosAddOnly
Microsoft.Maui.ApplicationModel.Permissions.PhotosAddOnly.PhotosAddOnly() -> void
Microsoft.Maui.ApplicationModel.Permissions.PostNotifications
Microsoft.Maui.ApplicationModel.Permissions.PostNotifications.PostNotifications() -> void
Microsoft.Maui.ApplicationModel.Permissions.Reminders
Microsoft.Maui.ApplicationModel.Permissions.Reminders.Reminders() -> void
Microsoft.Maui.ApplicationModel.Permissions.Sensors
Expand Down
2 changes: 2 additions & 0 deletions src/Essentials/src/PublicAPI/net/PublicAPI.Shipped.txt
Expand Up @@ -382,6 +382,8 @@ Microsoft.Maui.ApplicationModel.Permissions.Photos
Microsoft.Maui.ApplicationModel.Permissions.Photos.Photos() -> void
Microsoft.Maui.ApplicationModel.Permissions.PhotosAddOnly
Microsoft.Maui.ApplicationModel.Permissions.PhotosAddOnly.PhotosAddOnly() -> void
Microsoft.Maui.ApplicationModel.Permissions.PostNotifications
Microsoft.Maui.ApplicationModel.Permissions.PostNotifications.PostNotifications() -> void
Microsoft.Maui.ApplicationModel.Permissions.Reminders
Microsoft.Maui.ApplicationModel.Permissions.Reminders.Reminders() -> void
Microsoft.Maui.ApplicationModel.Permissions.Sensors
Expand Down
Expand Up @@ -382,6 +382,8 @@ Microsoft.Maui.ApplicationModel.Permissions.Photos
Microsoft.Maui.ApplicationModel.Permissions.Photos.Photos() -> void
Microsoft.Maui.ApplicationModel.Permissions.PhotosAddOnly
Microsoft.Maui.ApplicationModel.Permissions.PhotosAddOnly.PhotosAddOnly() -> void
Microsoft.Maui.ApplicationModel.Permissions.PostNotifications
Microsoft.Maui.ApplicationModel.Permissions.PostNotifications.PostNotifications() -> void
Microsoft.Maui.ApplicationModel.Permissions.Reminders
Microsoft.Maui.ApplicationModel.Permissions.Reminders.Reminders() -> void
Microsoft.Maui.ApplicationModel.Permissions.Sensors
Expand Down

0 comments on commit d594604

Please sign in to comment.