[TIMOB-17647] iOS8: Access to currentUserNotificationSettings & didRegisterUserNotificationSettings
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-09-15T16:10:22.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 3.4.0, Release 3.5.0 |
Components | iOS |
Labels | ios8 |
Reporter | Ben Bahrenburg |
Assignee | Jon Alter |
Created | 2014-09-07T01:17:07.000+0000 |
Updated | 2014-11-21T20:27:24.000+0000 |
Description
iOS 8 has implemented permission dialogs and management around local notifications. A user can "not allow" or adjust the local notifications they allow to be registered in this app.
To address this, it would be nice to have the following:
1. A method that returns the types currently registered and allow by the app's [UIApplication sharedApplication] currentUserNotificationSettings
2. An event which fires with the UIUserNotificationSettings provided to the app delegate didRegisterUserNotificationSettings method
An approach on how to do this is available in this gist https://gist.github.com/benbahrenburg/7b65d074c728cba0de4c
PR available here https://github.com/appcelerator/titanium_mobile/pull/6025
How to test: ___________________ 1. Using an Ti SDK with this patch applied create a test app ( in classic mode ) 2. Update the app.js with this sample https://gist.github.com/benbahrenburg/7b65d074c728cba0de4c#testing-the-updates 3. Compile your sample app against the iOS8 SDK 4. Press bntTest1, you will get a permissions prompt 5. Accept the permissions request 6. You will see the below event, usernotificationsetting, fire ~~~ Ti.App.iOS.addEventListener('usernotificationsetting',function(e){ Ti.API.info('usernotificationsetting:' + JSON.stringify(e)); }) ~~~ 7. Press the btnTest2 button, you will now see the requested rights ( Ti.App.iOS.NOTIFICATION_TYPE_BADGE,Ti.App.iOS.NOTIFICATION_TYPE_SOUND,Ti.App.iOS.NOTIFICATION_TYPE_ALERT) printed to the console 8. Reset the simulator and run the same tests as above, but do not approve the rights request 9. Then press the btnTest2 button. You should see an empty array printed to the console. 10. Reset the simulator 11. Compile the sample app against the iOS7 SDK 12. Perform steps 4 thru 9. For all steps you should not see any rights provided
Hi Ben, I believe this was implemented in this PR, can you check if it has what you need?
This PR: https://github.com/appcelerator/titanium_mobile/pull/5988
Hi Pedro, these methods are helpful but don't provide access to the registered and approved permissions. The issue my PR solves is allowing the developer to tell what permissions are available to their app, and which have been requested vs approved. You would use my PR before and after using PR #5988
All, please see TIMOB-17683 as well. Thoughts appreciated.
This ticket is resolved by TIMOB-17640
Tested as per Ben's instructions but with the app.js code below
Tested On: SDK: 3.4.0.v20140913174915 Studio: 3.4.0.201409131030 CLI: 3.4.0-rc3 Alloy: 1.5.0-rc2 Xcode: Xcode 6 GM