parse-community / parse-server-push-adapter

A push notification adapter for Parse Server
https://parseplatform.org
MIT License
88 stars 100 forks source link

Added push data key for APNS key thread-id #117

Closed mtrezza closed 6 years ago

flovilmart commented 6 years ago

Thanks for the PR

codecov[bot] commented 6 years ago

Codecov Report

Merging #117 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #117   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           5      5           
  Lines         256    258    +2     
=====================================
+ Hits          256    258    +2
Impacted Files Coverage Δ
src/APNS.js 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 425d7d8...fec1644. Read the comment docs.

flovilmart commented 6 years ago

Can you please add a test to ensure the notification get the proper setter called when the added key value pairs are passed part of the payload?

flovilmart commented 6 years ago

Awesome! Thanks!

bmueller commented 5 years ago

@mtrezza @flovilmart I'm trying to implement thread-id via Cloud Code, but haven't been able to get it to work. I've tried putting threadId in the alert and the data dictionary, and have also tried threadId and thread-id for the variable name. Any thoughts on what I could be doing wrong here?

Parse.Push.send({
    where: pushQuery, // Set our Installation query
    collapse_id: request.params.collapseId,
    threadId: request.params.threadId,
    data: {
      alert: {
        title: request.params.title,
        body: request.params.body,
        threadId: request.params.threadId,
      },
      sound: request.params.sound,
      category: request.params.category,
      threadId: request.params.threadId,
      userInfo: request.params.userInfo,
    }
  }
mtrezza commented 5 years ago

@bmueller

Parse.Push.send({
    where: pushQuery, // Set our Installation query
    collapse_id: request.params.collapseId,
    data: {
      alert: {
        title: request.params.title,
        body: request.params.body
      },
      sound: request.params.sound,
      category: request.params.category,
      threadId: request.params.threadId,
      userInfo: request.params.userInfo
    }
  }

This should work. If it doesn't, I suggest you start by checking the APN data received on the device.

bmueller commented 5 years ago

@mtrezza

Hmm, when I put the thread ID in the data dictionary, the payload sent by Parse has threadId in it (see below), but when I put a breakpoint on the UNNotification in willPresentNotification in the app, threadIdentifier is set to @"". Everything else sent in the payload (category, title, etc) is set correctly on the UNNotification.

"payload":"{\"alert\":{\"title\":\"Test\",\"body\":\"Testing 1 2 3.\"},\"sound\":\"default\",\"category\":\"custom\",\"threadId\":\"Testing This\",\"userInfo\":{\"dataPoint\":4}}"

bmueller commented 5 years ago

@mtrezza

Here's the userInfo dictionary on the notification as it comes in. Shouldn't the threadId appear inside the aps dictionary?

    aps =     {
        alert =         {
            body = "Testing 1 2 3.";
            title = Test;
        };
        category = custom;
        sound = default;
    };
    threadId = "test test";