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

[📚] Add description about adding extension to iOS App to receive notification with image #4218

Closed
Pittan opened this issue Sep 6, 2020 · 13 comments
Labels
help: good-first-issue Issues that are non-critical issues & well defined for first time contributors.

Comments

@Pittan
Copy link

Pittan commented Sep 6, 2020

Documentation Feedback

https://rnfirebase.io/messaging/server-integration#ios

Hello! I'm working on a new App for iOS built with React Native and react-native-firebase!

@react-native-firebase/messaging is awesome to implement notification feature quickly!

But I thought adding "You must create an App-extension to receive notification with image" to its document will be nice for beginners.

I had a few background for iOS App developing, so it won't be a huge problem.
But maybe for people who are not familiar with iOS App developing, it would be a great assist!


@Pittan Pittan added help: good-first-issue Issues that are non-critical issues & well defined for first time contributors. Type: Docs labels Sep 6, 2020
@mikehardy
Copy link
Collaborator

Hi there! This feature is generally available for anyone I think? #4085

And it has been documented? #4089

https://rnfirebase.io/messaging/server-integration#ios

Is there some other place this could be to make it more obvious?

@Pittan
Copy link
Author

Pittan commented Sep 6, 2020

@mikehardy
Hi! I created an extension using this method.

I know Firebase has a document about creating a notification with image, but we should appeal to developer that we have an easier way to implement it.
(Or am I missing something? I thought @react-native-firebase/messaging doesn't have an out-of-box image support for notification, which need to create extension manually.)

@mikehardy
Copy link
Collaborator

Did you follow the links I sent?

@Pittan
Copy link
Author

Pittan commented Sep 6, 2020

@mikehardy
Yes, I read #4085, #4089 and https://rnfirebase.io/messaging/server-integration#ios .

@davidepalazzo
Does changes from #4085 expected to support image without creating extension?

@helenaford
Copy link
Member

I'm facing the same problem. Doesn't seem like the extension works out of the box without having to do additional steps, but not sure. @davidepalazzo I'm creating my own extension then trying to inherit the RNFBMessaging one but no luck.

@davidepalazzo
Copy link
Contributor

Hi @Pittan. Yes, that was the intent of the PR. Although, it looks like it stopped working. I tested it with a fresh install – the payload comes through fine, the notification is displayed but the image isn't showing. Not too sure what changed since I pushed the code.

Hey @helenaford, I found that to make it work with you need to target FirebaseMessaging in your service extension and add a new target in the main Podfile. So the steps would be to:

  1. From Xcode create a new Notification Service Extension
  2. Add a pod to the target
target 'EXTENSION_NAME' do
  pod 'Firebase/Messaging', '~> VERSION_NUMBER'
end
  1. Import FirebaseMessaging.h in the EXTENSION_NAME.m file

This is a solid solution and should work reliably.

@mikehardy, I'm happy to extend on the above steps and add it to the doc. I'll remove the previous code I added in favour of the native extension as I feel this is a better and more stable approach. Thoughts?

@mikehardy
Copy link
Collaborator

@davidepalazzo I trust your judgement and will happily work with you to ingest the change here, thanks for the offer

@davidepalazzo
Copy link
Contributor

No worries @mikehardy, I'm more than happy to work on this change and have a PR within a few days.

In terms of structure, I'd probably move out the instructions from under Server Integration to its own section if that works for you guys. Perhaps something like messaging/notifications-with-image?

@mikehardy
Copy link
Collaborator

That sounds good

@davidepalazzo
Copy link
Contributor

Hey @mikehardy, I just pushed 2 PRs:

Cheers.

@vuongductuanktmt
Copy link

Please support for ipad! iphone worked but ipad not working.

@davidepalazzo
Copy link
Contributor

@vuongductuanktmt try changing the version of the Notification Service Extension to a lower value:
Screen Shot 2020-09-10 at 5 12 10 pm

It should match whatever version you're using in your main app target. iOS 10 is the minimum version required to make this work.

@Pittan
Copy link
Author

Pittan commented Sep 13, 2020

@mikehardy
With the help of @davidepalazzo ,
I think we're good to close this issue!

Thank you for your cooperation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help: good-first-issue Issues that are non-critical issues & well defined for first time contributors.
Projects
None yet
Development

No branches or pull requests

5 participants