ios - Apple Watch OS 2 how to show/ hide action button from custom notification -
i building apple watch os 2 app extension , need implement notifications. read apple docs sow need custom notification, have build ui it, thing have handle multiple notifications cases , not of them have 1 action button, question how change name of action button , if possible hide it.
i know action buttons can created using pushnotificationpayload.apns file , in apns file set action button , function, possible in code(hide/ show button action , adjust it's name).
i thinking implementation in didreceiveremotenotification:withcompletion:?
and here background info:
update 1
after reading again apple doc made next changes:
- implemented notification interface controller , checked "has dynamic interface"
- added "notification category name"
- created subclass of "wkusernotificationinterfacecontroller" , associated new custom notification in storyboard
managed test correct categorry loaded when notification arrives using "category" key , correct value each custom category, in case "cat1" , "cat2".
and question have is:
how manage custom notifications button locally?(how many buttons displayed, title of buttons, not depending on server in .apns test notification)
if not possible question becomes:
how should notification server like(the format) regarding actions displayed? should still send actions as:
"watchkit simulator actions": [ { "title": "first button", "identifier": "firstbuttonaction" } ]
or should pass them in aps
key as:
"alert" : { "body" : "test message", "title" : "optional title", "action" : [ { "title" : "first button", "identifier" : "firstbuttonaction" } ] }
update 2
after reading documentation adding action buttons notifications think need do, read tutorial. main difference doing affect ios app , want action button notifications retrieve on watch, possible add actions in app delegate on ios app , affect of notifications on watch app?
Comments
Post a Comment