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

[expo-notifications][Android] Fix FCMv1 icons and NPE #29204

Merged

Conversation

douglowder
Copy link
Contributor

Why

How

  • Change constants in the expo-notifications plugin to the correct ones expected for FCMv1
  • Add the recommended code to guard against NPE when logging Android lifecycle events

Test Plan

  • CI should pass
  • Test app should show the correct icon and color in notification banners

Checklist

Copy link

linear bot commented May 30, 2024

@expo-bot
Copy link
Collaborator

expo-bot commented May 30, 2024

The Pull Request introduced fingerprint changes against the base commit: 2838b79

Fingerprint diff
[
  {
    "type": "file",
    "filePath": "../../packages/expo-notifications/plugin/build/withNotificationsAndroid.js",
    "reasons": [
      "expoConfigPlugins"
    ],
    "hash": "7631970262a7128665478596c766d12b49b1da5a"
  },
  {
    "type": "dir",
    "filePath": "../../packages/expo-notifications/android",
    "reasons": [
      "expoAutolinkingAndroid"
    ],
    "hash": "ace590ae951e514059650b7d06b90f1fd27f54fe"
  }
]

Generated by PR labeler 🤖

@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels May 30, 2024
@douglowder douglowder merged commit 0bd7c3a into main May 30, 2024
20 checks passed
@douglowder douglowder deleted the doug/eng-12395-fix-notification-icons-on-android-with-fcmv1 branch May 30, 2024 09:41
douglowder added a commit that referenced this pull request May 30, 2024
- Fixes #24844
- Corrects an NPE that can happen if a deep link in the app is opened

- Change constants in the `expo-notifications` plugin to the correct
ones expected for FCMv1
- Add the recommended code to guard against NPE when logging Android
lifecycle events

- CI should pass
- Test app should show the correct icon and color in notification
banners

<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
@brentvatne brentvatne added the published Changes from the PR have been published to npm label May 31, 2024
@douglowder
Copy link
Contributor Author

Published in expo-notifications 0.28.5

@mlukasik-dev
Copy link

@douglowder, @christopherwalter,
The release did not resolve the NPE issue. It still occurs when a user opens an app link.

Although I'm not a Java developer, I am curious about how using Objects.requireNonNull would solve this issue.
From my understanding, this method throws a [customized] exception when the value is null.

@douglowder
Copy link
Contributor Author

@mlukasik-dev thanks for the report. I will get the NPE fixed in the next two days. Sorry for my confusion about that API.

douglowder added a commit that referenced this pull request Jun 3, 2024
# Why

After the fixes in #29204 , there are still reports of NPEs happening in
the notification lifecycle listener methods. These NPEs are coming from
code that causes Android to log events.

# How

Remove the logging code that was causing the issue.

# Test Plan

- CI should pass
- Test app should work, show correct icons in notifications, and
responses should show up even if app is killed

# Checklist

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
douglowder added a commit that referenced this pull request Jun 3, 2024
After the fixes in #29204 , there are still reports of NPEs happening in
the notification lifecycle listener methods. These NPEs are coming from
code that causes Android to log events.

Remove the logging code that was causing the issue.

- CI should pass
- Test app should work, show correct icons in notifications, and
responses should show up even if app is killed

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
@douglowder
Copy link
Contributor Author

@mlukasik-dev NPE is fixed in #29370 and published in expo-notifications@0.28.6

@mlukasik-dev
Copy link

That was quick. Thank you very much! I can confirm that the issue has been resolved and deep links are working correctly on Android.

douglowder added a commit that referenced this pull request Jun 12, 2024
- Fixes #24844
- Corrects an NPE that can happen if a deep link in the app is opened

- Change constants in the `expo-notifications` plugin to the correct
ones expected for FCMv1
- Add the recommended code to guard against NPE when logging Android
lifecycle events

- CI should pass
- Test app should show the correct icon and color in notification
banners

<!--
Please check the appropriate items below if they apply to your diff.
This is required for changes to Expo modules.
-->

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
douglowder added a commit that referenced this pull request Jun 12, 2024
After the fixes in #29204 , there are still reports of NPEs happening in
the notification lifecycle listener methods. These NPEs are coming from
code that causes Android to log events.

Remove the logging code that was causing the issue.

- CI should pass
- Test app should work, show correct icons in notifications, and
responses should show up even if app is killed

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: fingerprint changed bot: passed checks ExpoBot has nothing to complain about published Changes from the PR have been published to npm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Push Notification Icon not working on Android
5 participants