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:

enter image description here enter image description here

update 1

after reading again apple doc made next changes:

  1. implemented notification interface controller , checked "has dynamic interface"

enter image description here

  1. added "notification category name"

enter image description here

  1. 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

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -