invertase / notifee

⚛️ A feature rich notifications library for React Native.
https://notifee.app
Apache License 2.0
1.88k stars 228 forks source link

IOS attachment image not displaying when app is closed #989

Closed racic99 closed 6 months ago

racic99 commented 9 months ago

Just reopening the issue mentioned in https://github.com/invertase/notifee/issues/901

I have the exact same problem

fukemy commented 9 months ago

bump

mironemanueldanut commented 9 months ago

same issue here! works in the right way when the app is opened but not displaying the image when the app is closed

ChammounC commented 9 months ago

+1

mironemanueldanut commented 9 months ago

any updates regarding this ?

alexmartinezm commented 8 months ago

Same issue here, any workarounds?

toy0605 commented 8 months ago

~I found workaround I guess.~ ~I've tested by physical device.~

~If you're using require(), It doesn't work.~ ~It works only dev mode.~ ~If app is deployed for release mode, attachment that using require() is not displayed.~

~You need to change to absolute path. The path is started assets.~

~This source file is located 'src/example.ts' for example.~ ~and image file is located 'src/assets/example.png'.~

// It works only dev mode.
{
  url: require("./assets/example.png"),
  typeHint: "public.png",
}

// You must change absolute path conditional.
{
  url: __DEV__ === true ? require("./assets/example.png") : "assets/src/assets/example.png",
  typeHint: "public.png",
}

~I think it works. Maybe react-native's require() doesn't works properly in ios native code.~

mironemanueldanut commented 8 months ago

but this example is not working when you send the image url from firebase and you take it like this : const notificationImageIOS = remoteMessage?.data?.fcm_options.image and then you replace that image in notificationConfig.ios.attachments = [ { id: 'image', options: { thumbnailHidden: false, }, url: notificationImageIOS, }, ];

this workaround works 
only when the app is opened, 
in case that is killed or in background don't work 

@toy0605 
toy0605 commented 8 months ago

I found workaround I guess.

I've tested by physical device.

If you're using require(), It doesn't work.

It works only dev mode.

If app is deployed for release mode, attachment that using require() is not displayed.

You need to change to absolute path. The path is started assets.

This source file is located 'src/example.ts' for example.

and image file is located 'src/assets/example.png'.


// It works only dev mode.

{

  url: require("./assets/example.png"),

  typeHint: "public.png",

}

// You must change absolute path conditional.

{

  url: __DEV__ === true ? require("./assets/example.png") : "assets/src/assets/example.png",

  typeHint: "public.png",

}

I think it works. Maybe react-native's require() doesn't works properly in ios native code.

Sorry. I've not read original issue's source code.

I'll post new issue my case for someone needs help

+) https://github.com/invertase/notifee/issues/1022

github-actions[bot] commented 7 months ago

Hello 👋, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.