I need to show dynamic actions for push notifications by payload . something like this :
{
Platform": "apns",
"Title":"Booking from API",
"Content": "Hello there",
"Category": "confirmBooking",
"Actions":[
{
"ButtonText": "Confirm",
"ActionName": "confirmBooking"
},
{
"ButtonText": "Decline",
"ActionName": "declineBooking"
},
]
}
what is the good practice of it ? is it possible so far?
for now I'm using static configuration for categories and it works fine:
var confirm_action = UNNotificationAction.FromIdentifier("confirm", "Confirm", UNNotificationActionOptions.None);
var decline_action = UNNotificationAction.FromIdentifier("decline", "Decline", UNNotificationActionOptions.None);
// Create category
var categoryID = "bookingConfirm";
var actions = new UNNotificationAction[] { confirm_action, decline_action };
var intentIDs = new string[] { };
var categoryOptions = new UNNotificationCategoryOptions[] { };
var category = UNNotificationCategory.FromIdentifier(categoryID, actions, intentIDs, UNNotificationCategoryOptions.None);
var categories = new UNNotificationCategory[] { category };
UNUserNotificationCenter.Current.SetNotificationCategories(new NSSet<UNNotificationCategory>(categories));
but doesn't handle the task