{ "id": "136191", "key": "TIMOB-17647", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "15972", "description": "Release 3.4.0", "name": "Release 3.4.0", "archived": false, "released": true, "releaseDate": "2014-09-28" }, { "id": "16704", "description": "Release 3.5.0", "name": "Release 3.5.0", "archived": false, "released": true, "releaseDate": "2015-01-13" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-09-15T16:10:22.000+0000", "created": "2014-09-07T01:17:07.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "ios8" ], "versions": [], "issuelinks": [ { "id": "41020", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "136078", "key": "TIMOB-17640", "fields": { "summary": "iOS8: Add isRegisteredForRemoteNotifications to determine whether the app is currently registered for remote notifications.", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } }, { "id": "41023", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "136465", "key": "TIMOB-17683", "fields": { "summary": "iOS8: call registerUserNotificationSettings when Ti.Network.registerForPushNotifications() is called", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } } ], "assignee": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2014-11-21T20:27:24.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "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.\r\n\r\nTo address this, it would be nice to have the following:\r\n\r\n1. A method that returns the types currently registered and allow by the app's [UIApplication sharedApplication] currentUserNotificationSettings\r\n\r\n2. An event which fires with the UIUserNotificationSettings provided to the app delegate didRegisterUserNotificationSettings method\r\n\r\nAn approach on how to do this is available in this gist https://gist.github.com/benbahrenburg/7b65d074c728cba0de4c\r\n\r\nPR available here https://github.com/appcelerator/titanium_mobile/pull/6025", "attachment": [], "flagged": false, "summary": "iOS8: Access to currentUserNotificationSettings & didRegisterUserNotificationSettings", "creator": { "name": "ben.bahrenburg@gmail.com", "key": "ben.bahrenburg@gmail.com", "displayName": "Ben Bahrenburg", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "ben.bahrenburg@gmail.com", "key": "ben.bahrenburg@gmail.com", "displayName": "Ben Bahrenburg", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "closedSprints": [ { "id": 199, "state": "closed", "name": "2014 Sprint 18 SDK", "startDate": "2014-09-02T22:56:57.421Z", "endDate": "2014-09-13T00:00:00.000Z", "completeDate": "2014-09-15T20:08:19.146Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "322326", "author": { "name": "ben.bahrenburg@gmail.com", "key": "ben.bahrenburg@gmail.com", "displayName": "Ben Bahrenburg", "active": true, "timeZone": "America/Los_Angeles" }, "body": "How to test:\r\n___________________\r\n\r\n1. Using an Ti SDK with this patch applied create a test app ( in classic mode )\r\n2. Update the app.js with this sample https://gist.github.com/benbahrenburg/7b65d074c728cba0de4c#testing-the-updates\r\n3. Compile your sample app against the iOS8 SDK\r\n4. Press bntTest1, you will get a permissions prompt\r\n5. Accept the permissions request\r\n6. You will see the below event, usernotificationsetting, fire\r\n~~~\r\nTi.App.iOS.addEventListener('usernotificationsetting',function(e){\r\n Ti.API.info('usernotificationsetting:' + JSON.stringify(e)); \r\n})\r\n~~~\r\n7. 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\r\n8. Reset the simulator and run the same tests as above, but do not approve the rights request\r\n9. Then press the btnTest2 button. You should see an empty array printed to the console.\r\n10. Reset the simulator\r\n11. Compile the sample app against the iOS7 SDK\r\n12. Perform steps 4 thru 9. For all steps you should not see any rights provided\r\n", "updateAuthor": { "name": "ben.bahrenburg@gmail.com", "key": "ben.bahrenburg@gmail.com", "displayName": "Ben Bahrenburg", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-08T19:20:54.000+0000", "updated": "2014-09-08T19:20:54.000+0000" }, { "id": "322559", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Hi Ben,\r\nI believe this was implemented in this PR, can you check if it has what you need?", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-09-09T17:09:07.000+0000", "updated": "2014-09-09T17:10:04.000+0000" }, { "id": "322560", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "This PR: https://github.com/appcelerator/titanium_mobile/pull/5988", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-09-09T17:10:19.000+0000", "updated": "2014-09-09T17:10:19.000+0000" }, { "id": "322566", "author": { "name": "ben.bahrenburg@gmail.com", "key": "ben.bahrenburg@gmail.com", "displayName": "Ben Bahrenburg", "active": true, "timeZone": "America/Los_Angeles" }, "body": "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.\r\n\r\nYou would use my PR before and after using PR #5988", "updateAuthor": { "name": "ben.bahrenburg@gmail.com", "key": "ben.bahrenburg@gmail.com", "displayName": "Ben Bahrenburg", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-09T17:31:04.000+0000", "updated": "2014-09-09T17:31:04.000+0000" }, { "id": "323173", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "All, please see TIMOB-17683 as well. Thoughts appreciated.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-11T22:46:03.000+0000", "updated": "2014-09-11T22:46:03.000+0000" }, { "id": "323175", "author": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This ticket is resolved by TIMOB-17640", "updateAuthor": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-11T22:50:41.000+0000", "updated": "2014-09-12T22:17:17.000+0000" }, { "id": "323597", "author": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested as per Ben's instructions but with the app.js code below\r\n{code}\r\nvar win = Titanium.UI.createWindow({ \r\n backgroundColor:'#fff',layout:'vertical'\r\n});\r\n\r\nvar bntTest1 = Titanium.UI.createButton({\r\n title:'Test 1', width:'auto', top:80\r\n});\r\nwin.add(bntTest1);\r\n\r\nvar bntTest2 = Titanium.UI.createButton({\r\n title:'Test 2', width:'auto', top:60\r\n});\r\nwin.add(bntTest2);\r\n\r\nTi.App.iOS.addEventListener('usernotificationsettings',function(e){\r\n Ti.API.info('usernotificationsetting:' + JSON.stringify(e)); \r\n});\r\n\r\nbntTest1.addEventListener('click',function(d){\r\n\r\n Ti.App.iOS.registerUserNotificationSettings({\r\n types: [Ti.App.iOS.USER_NOTIFICATION_TYPE_BADGE,\r\n Ti.App.iOS.USER_NOTIFICATION_TYPE_SOUND,\r\n Ti.App.iOS.USER_NOTIFICATION_TYPE_ALERT]\r\n });\r\n\r\n});\r\n\r\nbntTest2.addEventListener('click',function(d){\r\n\r\n var currentNotifications = Ti.App.iOS.getCurrentUserNotificationSettings();\r\n var userSettings = [];\r\n for (var iLoop=0;iLoop