Make this Mac App Store compatible
adam-lynch opened this issue · 7 comments
If someone uses this module in their app (e.g. NW.js or Electron app), it should not cause the app to be rejected.
As of 5.0.0, we have two methods for auto-launching on Mac;
- Using AppleScript to tell System Events to add a Login Item for the app.
- Adding a file-based Launch Agent; i.e. adding a
.plist
to the user'sLibrary/LaunchAgents
directory.
Neither of these will be accepted in the MAS. I'm 99% sure about number 1, just because I haven't tried to get it into the app store.
Number 2 reaches outside the app sandbox.
It seems like a tricky problem even if you were writing a completely native app. So is it possible at all to have an auto-launching app in the app store? Yes, according to Modern Login Items. Your app would need to not be auto-launching by default, there would have to be a setting for the user to toggle it on or off, and you need a Launch Agent. The Launch Agent needs to be a separate app/executable with special permissions (and needs to be signed like your main app).
Since it needs custom native code and it needs to be signed, that's not something that will be added to this module.
It makes more sense to either create this manually yourself, or if it was added to nw-builder, electron-builder (see electron-userland/electron-builder#756), etc.
Even if you have this extra (signed) app, that might not be enough as Modern Login Items tells us it needs to contain a "user preference". I don't think there is any way you could toggle this user preference aside from programmatically with native code. This leads me to think that NW.js and Electron would need to expose an API for this with native code underneath which toggles the preference.
Or (which just popped into my head...) maybe it's possible to toggle it with a custom native module. I'm not sure.
I created this module for future reference and assume we won't make much progress on it, but if you have an idea or can help, feel free to reply below.
This was marked closed and marked as invalid. Is this not a concern for the project, or is there a work around elsewhere (I'm guessing no since the readme says explicitly the app is likely to be rejected).
@transitorykris we'd love to support this but I'm not sure how. The above comment and links sum up everything we know on the subject. We're open to suggestions.
seems like electron has find a way to MAS friendly auto-start option for MAC. see here https://electron.atom.io/docs/api/app/#appsetloginitemsettingssettings-macos-windows
@JerryGoyal
Note: This API has no effect on MAS builds.
I interpret that as: this API does nothing when used in MAS builds.
This appears to be possible in the latest 2.x betas?
https://github.com/electron/electron/blob/v2.0.0-beta.2/docs/api/app.md#appsetloginitemsettingssettings-macos-windows
Changes appear to have been added here electron/electron@8184cbf#diff-c0db39733aba3af6dedd3c8a42082f92