{ "id": "151444", "key": "TIMOB-19573", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "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": [], "resolution": null, "resolutiondate": null, "created": "2015-09-24T03:38:44.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "reminders" ], "versions": [], "issuelinks": [], "assignee": null, "updated": "2018-02-28T19:55:44.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "Apple introduced the Reminders API in iOS 6, that uses the EventKit framework (the same as {{Ti.Calendar}} is using now). We could expose the following methods on a new {{Reminders}} module:\r\n\r\n{{const Reminders = require('ti.reminders');}}\r\n\r\n- {{Reminders.requestAuthorization()}}\r\n- {{Reminders.getAllReminders();}}\r\n- {{Reminders.getReminderById();}}\r\n- {{Reminders.createReminder();}}\r\n- {{Reminders.removeReminder();}}\r\n\r\n*Apple docs:*\r\nhttps://developer.apple.com/library/ios/documentation/DataManagement/Conceptual/EventKitProgGuide/ReadingAndWritingReminders/ReadingAndWritingReminders.html\r\n\r\n*Example architecture:*\r\n{code:js}\r\nconst Reminders = require('ti.reminders');\r\n\r\nconst dataStructure = [{\r\n\ttitle: \"Request authorization\",\r\n\taction: requestRemindersAuthorization\r\n},{\r\n\ttitle: \"Get all reminders\",\r\n\taction: getAllReminders\r\n},{\r\n\ttitle: \"Get reminder by ID\",\r\n\taction: getReminderById\r\n},{\r\n\ttitle: \"Create reminder\",\r\n\taction: createReminder\r\n},{\r\n\ttitle: \"Remove reminder\",\r\n\taction: removeReminder\r\n}]\r\n\r\nconst win = Titanium.UI.createWindow({\r\n\tbackgroundColor : '#fff',\r\n\tlayout : 'vertical'\r\n});\r\n\r\ndataStructure.forEach((data) => {\r\n\tconst btn = Ti.UI.createButton({\r\n\t\ttop : 20,\r\n\t\tleft: 20,\r\n\t\tright: 20,\r\n\t\theight : 60,\r\n\t\tbackgroundColor : '#efefef',\r\n\t\ttitle : data.title\r\n\t});\r\n\r\n\tbtn.addEventListener(\"click\", data.action);\r\n\twin.add(btn);\r\n});\r\n\r\nfunction requestRemindersAuthorization() {\r\n\tReminders.requestAuthorization(function(e) {\r\n\t\tTi.API.warn(e);\r\n\t});\r\n}\r\n\r\nfunction getAllReminders() {\r\n\tconst allReminders = Reminders.getAllReminders()\r\n\tTi.API.warn(allReminders);\r\n}\r\n\r\nfunction getReminderById() {\r\n\tconst reminder = Reminders.getReminderById(3);\r\n\r\n\tif (!reminder) {\r\n\t\talert(\"No reminder found matching the ID=\" + id + \"!\");\r\n\t} else {\r\n\t\tTi.API.warn(reminder);\r\n\t}\r\n}\r\n\r\nfunction createReminder() {\r\n\tconst mainCalendar = Ti.Calendar.getCalendarById(1);\r\n\r\n\tif (!mainCalendar) {\r\n\t\talert(\"The associated calendar could not be found!\");\r\n\t\treturn;\r\n\t}\r\n\r\n\tconst newReminder = TiReminders.createReminder({\r\n\t\ttitle: \"My Reminder\",\r\n\t\tcalendar: mainCalendar,\r\n\t\talarm: new Date(2015,09,24)\r\n\t});\r\n\tnewReminder.save();\r\n}\r\n\r\nfunction removeReminder() {\r\n\tconst success = Reminders.removeReminder(3);\r\n\t\r\n if (!success) {\r\n\t\talert(\"The reminder could not be deleted!\");\r\n\t} else {\r\n\t\talert(\"The reminder was successfully deleted!\");\r\n\t}\r\n}\r\n\r\nwin.open();\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS: Expose Reminders API", "creator": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "430996", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Considering as a native module instead of a new namespace these days!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-11-19T23:29:59.000+0000", "updated": "2017-11-19T23:29:59.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }