Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#fixes expiry in notification #37

Merged
merged 2 commits into from
Dec 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/utils/queue/SchedulerQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ const notificationId =(Math.floor(Math.random() * 10000) + 1) + new Date().getTi
try {
//preparing curl request
const opts: any = {
push_type: "apns",
deviceType:0, //for phone
push_type: "apns",
api_key: `${process.env.PUSH_GATEWAY_APIKEY}`,
device_token: device_token,
payload: {
Expand All @@ -109,13 +108,17 @@ const notificationId =(Math.floor(Math.random() * 10000) + 1) + new Date().getTi
sound: "default",
"mutable-content": 1,
"content-available": 1,
},
"push-type":"alert",
"collapse-id":`${notificationId}`,
"expiration":10
},
notificationId: `${notificationId}`,
expiry: 21600000,
expiry: 21600000,
page: `${url}`,
actions: [{ name: "Open App", page: `${url}` }],
}
}

//connect to api gateway and send notifications
fetch(`${process.env.PUSH_GATEWAY}`, {
method: "post",
Expand All @@ -139,7 +142,6 @@ const notificationId =(Math.floor(Math.random() * 10000) + 1) + new Date().getTi
//preparing curl request
const opts: any = {
push_type: "apns",
deviceType:1,//for watch
api_key: `${process.env.PUSH_GATEWAY_APIKEY}`,
device_token: device_token,
payload: {
Expand All @@ -149,9 +151,12 @@ const notificationId =(Math.floor(Math.random() * 10000) + 1) + new Date().getTi
sound: "default",
"mutable-content": 1,
"content-available": 1,
},
"push-type":"background",
"collapse-id":`${notificationId}`,
"expiration":10
},
notificationId: `${notificationId}`,
expiry: 21600000,
expiry: 21600000,
page: `${url}`,
actions: [{ name: "Open App", page: `${url}` }],
}
Expand Down