jariz / Noti

Receive Android notifications on your mac. (w/PushBullet) ⛺
MIT License
910 stars 63 forks source link

Actions don't work #82

Closed matthewdias closed 6 years ago

matthewdias commented 6 years ago

Noti seems to be setting a trigger_action field when dismissing notifications, but I couldn't find any reference to that in the documentation. Perhaps they removed it?

matthewdias commented 6 years ago

Actually the chrome extension does the same, and it appears to work now, even using Noti. Not sure what caused it to fail earlier but I'll monitor the stream and report back if it does again.

matthewdias commented 6 years ago

Ok so I found a discrepancy between how Noti is dismissing and how the chrome extension is dismissing. When Noti tried it, the action didn't work, but when the extension did it did. Noti is missing the notification_tag attribute.

// notification

{
  type: "mirror",
  source_device_iden: "udrPbsjAcrcUydpY",
  source_user_iden: "udrPb",
  client_version: 289,
  dismissible: true,
  actions: [
    {
      label: "Play",
      trigger_key: "com.google.android.youtube_0_TzLRZUgelatKZ4nyIKcAbg_Play"
    },
    {
      label: "Turn Off",
      trigger_key: "com.google.android.youtube_0_TzLRZUgelatKZ4nyIKcAbg_Turn Off"
    },
    {
      label: "Watch Later",
      trigger_key: "com.google.android.youtube_0_TzLRZUgelatKZ4nyIKcAbg_Watch Later"
    }
  ],
  application_name: "YouTube",
  body: "NZXT H500i Review - REALLY That Special?",
  client_version: 289,
  dismissible: true,
  icon: "...",
  notification_id: "0",
  notification_tag: "TzLRZUgelatKZ4nyIKcAbg",
  package_name: "com.google.android.youtube",
  source_device_iden: "udrPbsjAcrcUydpY",
  source_user_iden: "udrPb",
  title: "HardwareCanucks",
  type: "mirror"
}

// noti dismissal

{
  type: "push", 
  targets: ["stream", "android", "ios"], 
  push: {
    notification_id: "0",
    package_name: "com.google.android.youtube",
    source_user_iden: "udrPb",
    trigger_action: "com.google.android.youtube_0_TIWuVJE1Ms0-H8gBImjeZg_Watch Later",
    type: "dismissal"
  }
}

// pb chrome dismissal

{
  type: "push", 
  targets: ["stream", "android", "ios"], 
  push: {
    notification_id: "0",
    notification_tag: "TzLRZUgelatKZ4nyIKcAbg",
    package_name: "com.google.android.youtube",
    source_user_iden: "udrPb",
    trigger_action: "com.google.android.youtube_0_TzLRZUgelatKZ4nyIKcAbg_Watch Later",
    type: "dismissal"
  }
}
jariz commented 6 years ago

The research is much appreciated, shouldn't be too hard to add this. I don't have premium myself (anymore) though, so it'll be kind of hard to test, but regardless, I'll add the attribute.