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

Push Payload does not properly set the environment for APNS from init configuration #164

Closed
jarchowk opened this issue May 17, 2024 · 1 comment

Comments

@jarchowk
Copy link

I don't believe apnsEnvironment is actually ever sent in the message push payload, and is always sent with the "development" default from the javascript SDK.

Example of my Chat.init:

Chat.init({
        ...
        pushNotifications:  {
              sendPushes: false,
              deviceToken: deviceToken,
              deviceGateway: "apns2",
              apnsTopic: "<topic>",
              apnsEnvironment: "production",
            },
         ...
      });

In the file js-chat: js-chat/lib/src/entities/channel.ts:

protected getPushPayload(text: string) {
const { sendPushes, apnsTopic } = this.chat.config.pushNotifications
if (!sendPushes) return {}

const title = this.chat.currentUser.name || this.chat.currentUser.id
const pushBuilder = PubNub.notificationPayload(title, text)
const pushGateways = ["fcm"]
pushBuilder.sound = "default"
if (this.name) pushBuilder.subtitle = this.name
if (apnsTopic) {
pushBuilder.apns.configurations = [{ targets: [{ topic: apnsTopic }] }]
pushGateways.push("apns2")
}

return pushBuilder.buildPayload(pushGateways)
}
@Salet
Copy link
Contributor

Salet commented May 22, 2024

Thanks for your input and patience @jarchowk, happy to inform this has been fixed in #167 and included in both 0.6.2 and 0.7.0 versions released today.

@Salet Salet closed this as completed May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants