ostinelli / apnotic

A Ruby APNs HTTP/2 gem able to provide instant feedback.
MIT License
477 stars 94 forks source link

action-loc-key to customize button #44

Closed augustosamame closed 7 years ago

augustosamame commented 7 years ago

Hi. According to the Apple Docs: https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html#//apple_ref/doc/uid/TP40008194-CH17-SW5

I can use an action-loc-key field to customize the texts shown in action buttons in push notifications. I've been trying this:

notification       = Apnotic::Notification.new(token)
        notification.alert = {
          body: alert,
          action-loc-key: 'Accept'
          }

but action-loc-key is an invalid key in Ruby. Any ideas?

benubois commented 7 years ago

Try the old "rocket" syntax:

"action-loc-key" => "Accept"
ostinelli commented 7 years ago

Indeed, thank you @benubois.