Skip to content

New Chat sample - #296

Merged
DaveLomber merged 21 commits into
masterfrom
rnchat-upgrade
May 13, 2022
Merged

DaveLomber merged 21 commits into
masterfrom
rnchat-upgrade

Conversation

@DaveLomber

@DaveLomber DaveLomber commented May 3, 2022 •

Copy link
Copy Markdown
Collaborator

CHANGES

TODO:

Push Notifications details:

With new push notifications lib we bring some changes to the setup process

  • read the guide how to connect it and use https://wix.github.io/react-native-notifications/docs/getting-started
  • in order to test Chat sample on Android, you need to create google-services.json file and copy it into project's android/app folder. Also, you need to update the applicationId in android/app/build.gradle to the one which is specified in google-services.json, so they must match.
  • There was an issue on Android with receiving a callback when a push arrived and an app is in killed/dead state. We addressed it here:
    -- we created a patch to push notification lib - patches/react-native-notifications+4.3.1.patch - which is applied automatically when you do yarn (it's specified as a part of package.json postinstall step - "postinstall": "patch-package && npx jetify && cd ios && pod install")
    -- you also need to add <service android:name="com.wix.reactnativenotifications.JSNotifyWhenKilledTask" /> into AndroidManifest.xml file
    -- and now you can process the notifications in killed/dead state via the following code snippet:
    const { AppRegistry } = require("react-native");

    // https://reactnative.dev/docs/headless-js-android
    //
    AppRegistry.registerHeadlessTask(
      "JSNotifyWhenKilledTask",
      () => {
        return async (notificationBundle) => {
          console.log('[JSNotifyWhenKilledTask] notificationBundle', notificationBundle);

          PushNotificationService.displayNotification(notificationBundle);
        }
      },
    );

@DaveLomber
DaveLomber merged commit 61eadf1 into master May 13, 2022
@DaveLomber
DaveLomber deleted the rnchat-upgrade branch May 13, 2022 11:45
@DaveLomber

Copy link
Copy Markdown
Collaborator Author

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

Successfully merging this pull request may close these issues.

1 participant