apache / cordova-ios

Apache Cordova iOS
https://cordova.apache.org/
Apache License 2.0
2.15k stars 987 forks source link

Automate "Notification Service Extension" (File > New > Target) step #582

Open rricamar opened 5 years ago

rricamar commented 5 years ago

Hi βœ‹ ,

I'm working with a Cordova based App, and I would like to automate the "Notification Service Extension" step (In Xcode: File > New > Target) (for example, in Jenkins pipeline) , since I saw that after doing it, remove platform, and add it again, the associated target is removed 😭

I've been searching through the docs, stack overflow and another issues and I haven't seen anything... is this possible (config.xml, custom hook, post build script) ?

Thanks a lot in advance!

manudefrutosvila commented 5 years ago

it's a pain that in every build you have to do all the steps, because it is lost when platform is removed

it should be possible to do it with hooks and xcodebuild... but I haven't found info about how to do it either

dpogue commented 5 years ago

Yeah, a hook is probably the best option here.

rricamar commented 5 years ago

Yeah, a hook is probably the best option here.

Thanks for the reply!

Do you have any idea about this? 😭

I've been searching and I couldn't find anything... 😒

janpio commented 5 years ago

Can you diff the project before and after? Maybe the changes are simple enough so that you can just apply them via git? If not, maybe https://github.com/apache/cordova-node-xcode can help to manipulate the Xcode project via JS.

rricamar commented 5 years ago

Can you diff the project before and after? Maybe the changes are simple enough so that you can just apply them via git? If not, maybe https://github.com/apache/cordova-node-xcode can help to manipulate the Xcode project via JS.

Yeah, I checked that and as long as I know, these are the changes (with a quick diff command):

Use a hook for copy the OneSignalNotificationServiceExtension dir should be easy, but after check the changes in another files, I think that they are non-trivial and a little bit dangerous for do it in a ci environment ... ⚠️ because that would require a lot of additions and deletions maybe 😱 ...

I'm going to read docs of cordova-node-xcode , thanks for the help ... meanwhile any idea πŸ’‘ or a working example would be great πŸ™

Thanks for the help❗️

jkasten2 commented 4 years ago

Attaching an additional reference, there is an open ticket to support iOS "App Extension" target in Cordova's Jira system: https://issues.apache.org/jira/browse/CB-10218

crapthings commented 4 years ago

i use trick in this one

https://github.com/crapthings/cordova-plugin-ios-shareextension

hooks code from cordova-openwith

https://github.com/nexushubs/cube/tree/cordova-openwith

NiklasMerz commented 4 years ago

Yeah hooks are the way to go to copy extension code from a plugin and the Xcode settings. I did this with "openwith" and call directory extensions https://github.com/GEDYSIntraWare/cordova-plugin-call-directory

vesper8 commented 3 years ago

So does anyone have a working hook they could share to automate this step for the purpose of being able to send images inside of remote push notifications on IOS please?

imirs commented 3 years ago

@vesper8 , did you find a way to do that? send images inside of remote push notifications on IOS?

srinivasaraosaluru commented 1 year ago

Hi @rricamar have you found the fix for this, after 2 years of your post, I am struggling with same issue now, if you have any solution on it, can you please help us with your inputs. Thank You in advance.

rricamar commented 1 year ago

Hi @rricamar have you found the fix for this, after 2 years of your post, I am struggling with same issue now, if you have any solution on it, can you please help us with your inputs. Thank You in advance.

Hello @srinivasaraosaluru, sadly I wasn't able to automate these steps since my low knowledge of the Xcode/iOS ecosystem. I had to replicate manually the steps before sending the app to the Apple Store revision until the project was over... πŸ˜…

I quickly checked One Signal's newest documentation and the process looks almost the same as back then, really sad to see that after 4 years after this hasn't been automated somehow 😞

Good luck πŸ€

srinivasaraosaluru commented 1 year ago

Thank Ypou @rricamar for your comments, I have achieved the same with help of manual steps. Thank You once again.