diff --git a/src/Essentials/samples/Samples/ViewModel/PermissionsViewModel.cs b/src/Essentials/samples/Samples/ViewModel/PermissionsViewModel.cs index 02cfe2684f55..30c81375deeb 100644 --- a/src/Essentials/samples/Samples/ViewModel/PermissionsViewModel.cs +++ b/src/Essentials/samples/Samples/ViewModel/PermissionsViewModel.cs @@ -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()), diff --git a/src/Essentials/src/Permissions/Permissions.android.cs b/src/Essentials/src/Permissions/Permissions.android.cs index 6a86b2e61e2a..b9db28e20f9c 100644 --- a/src/Essentials/src/Permissions/Permissions.android.cs +++ b/src/Essentials/src/Permissions/Permissions.android.cs @@ -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 { } diff --git a/src/Essentials/src/Permissions/Permissions.ios.tvos.watchos.cs b/src/Essentials/src/Permissions/Permissions.ios.tvos.watchos.cs index 6c1651c32821..c1fbf2904207 100644 --- a/src/Essentials/src/Permissions/Permissions.ios.tvos.watchos.cs +++ b/src/Essentials/src/Permissions/Permissions.ios.tvos.watchos.cs @@ -288,6 +288,10 @@ public partial class PhotosAddOnly : BasePlatformPermission { } + public partial class PostNotifications : BasePlatformPermission + { + } + public partial class Reminders : BasePlatformPermission { } diff --git a/src/Essentials/src/Permissions/Permissions.macos.cs b/src/Essentials/src/Permissions/Permissions.macos.cs index abfc30ae57ae..c84d854b555c 100644 --- a/src/Essentials/src/Permissions/Permissions.macos.cs +++ b/src/Essentials/src/Permissions/Permissions.macos.cs @@ -207,6 +207,10 @@ public partial class PhotosAddOnly : BasePlatformPermission { } + public partial class PostNotifications : BasePlatformPermission + { + } + public partial class Reminders : BasePlatformPermission { } diff --git a/src/Essentials/src/Permissions/Permissions.netstandard.cs b/src/Essentials/src/Permissions/Permissions.netstandard.cs index 1222ae3c3b3e..22366624b63e 100644 --- a/src/Essentials/src/Permissions/Permissions.netstandard.cs +++ b/src/Essentials/src/Permissions/Permissions.netstandard.cs @@ -109,6 +109,10 @@ public partial class PhotosAddOnly : BasePlatformPermission { } + public partial class PostNotifications : BasePlatformPermission + { + } + public partial class Reminders : BasePlatformPermission { } diff --git a/src/Essentials/src/Permissions/Permissions.shared.cs b/src/Essentials/src/Permissions/Permissions.shared.cs index 4e2f9d36b62c..60aeb279bc70 100644 --- a/src/Essentials/src/Permissions/Permissions.shared.cs +++ b/src/Essentials/src/Permissions/Permissions.shared.cs @@ -252,6 +252,14 @@ public partial class PhotosAddOnly : BasePlatformPermission { } + /// + /// Represents permission to post notifications + /// + public partial class PostNotifications + { + } + + /// /// Represents permission to access the device reminders data. /// diff --git a/src/Essentials/src/Permissions/Permissions.tizen.cs b/src/Essentials/src/Permissions/Permissions.tizen.cs index 96c843a2a249..de00d195872c 100644 --- a/src/Essentials/src/Permissions/Permissions.tizen.cs +++ b/src/Essentials/src/Permissions/Permissions.tizen.cs @@ -211,6 +211,10 @@ public partial class Photos : BasePlatformPermission { } + public partial class PostNotifications : BasePlatformPermission + { + } + public partial class Reminders : BasePlatformPermission { } diff --git a/src/Essentials/src/Permissions/Permissions.uwp.cs b/src/Essentials/src/Permissions/Permissions.uwp.cs index c2c58c7983c6..9922e57ea00d 100644 --- a/src/Essentials/src/Permissions/Permissions.uwp.cs +++ b/src/Essentials/src/Permissions/Permissions.uwp.cs @@ -191,6 +191,10 @@ public partial class Photos : BasePlatformPermission { } + public partial class PostNotifications : BasePlatformPermission + { + } + public partial class Reminders : BasePlatformPermission { } diff --git a/src/Essentials/src/PublicAPI/net-android/PublicAPI.Shipped.txt b/src/Essentials/src/PublicAPI/net-android/PublicAPI.Shipped.txt index 3c120bbc1281..d828319966d8 100644 --- a/src/Essentials/src/PublicAPI/net-android/PublicAPI.Shipped.txt +++ b/src/Essentials/src/PublicAPI/net-android/PublicAPI.Shipped.txt @@ -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)[] @@ -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 diff --git a/src/Essentials/src/PublicAPI/net-ios/PublicAPI.Shipped.txt b/src/Essentials/src/PublicAPI/net-ios/PublicAPI.Shipped.txt index bfb283291c70..8ee6222cb32f 100644 --- a/src/Essentials/src/PublicAPI/net-ios/PublicAPI.Shipped.txt +++ b/src/Essentials/src/PublicAPI/net-ios/PublicAPI.Shipped.txt @@ -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 diff --git a/src/Essentials/src/PublicAPI/net-maccatalyst/PublicAPI.Shipped.txt b/src/Essentials/src/PublicAPI/net-maccatalyst/PublicAPI.Shipped.txt index bfb283291c70..8ee6222cb32f 100644 --- a/src/Essentials/src/PublicAPI/net-maccatalyst/PublicAPI.Shipped.txt +++ b/src/Essentials/src/PublicAPI/net-maccatalyst/PublicAPI.Shipped.txt @@ -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 diff --git a/src/Essentials/src/PublicAPI/net-tizen/PublicAPI.Shipped.txt b/src/Essentials/src/PublicAPI/net-tizen/PublicAPI.Shipped.txt index 70686d8bc3db..a71b88159452 100644 --- a/src/Essentials/src/PublicAPI/net-tizen/PublicAPI.Shipped.txt +++ b/src/Essentials/src/PublicAPI/net-tizen/PublicAPI.Shipped.txt @@ -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 diff --git a/src/Essentials/src/PublicAPI/net-windows/PublicAPI.Shipped.txt b/src/Essentials/src/PublicAPI/net-windows/PublicAPI.Shipped.txt index 7497c6255176..56f3d769ef88 100644 --- a/src/Essentials/src/PublicAPI/net-windows/PublicAPI.Shipped.txt +++ b/src/Essentials/src/PublicAPI/net-windows/PublicAPI.Shipped.txt @@ -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 diff --git a/src/Essentials/src/PublicAPI/net/PublicAPI.Shipped.txt b/src/Essentials/src/PublicAPI/net/PublicAPI.Shipped.txt index bfde94b80115..a7d909f7b5a3 100644 --- a/src/Essentials/src/PublicAPI/net/PublicAPI.Shipped.txt +++ b/src/Essentials/src/PublicAPI/net/PublicAPI.Shipped.txt @@ -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 diff --git a/src/Essentials/src/PublicAPI/netstandard/PublicAPI.Shipped.txt b/src/Essentials/src/PublicAPI/netstandard/PublicAPI.Shipped.txt index bfde94b80115..a7d909f7b5a3 100644 --- a/src/Essentials/src/PublicAPI/netstandard/PublicAPI.Shipped.txt +++ b/src/Essentials/src/PublicAPI/netstandard/PublicAPI.Shipped.txt @@ -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