[TIMOB-20005] Line up *Authorization properties
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | Trivial |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2015-12-07T05:27:57.000+0000 |
| Affected Version/s | Release 5.1.0 |
| Fix Version/s | Release 5.2.0 |
| Components | iOS |
| Labels | n/a |
| Reporter | Fokke Zandbergen |
| Assignee | Angel Petkov |
| Created | 2015-11-17T14:25:58.000+0000 |
| Updated | 2016-01-26T18:23:30.000+0000 |
Description
Just a small change to align the property names between the 4 API's for better predictability (ability to guess the property name without using docs).
*
Ti.Calendar.eventsAuthorization > calendarAuthorization
* Ti.Media.cameraAuthorizationStatus > cameraAuthorization
PR pending : https://github.com/appcelerator/titanium_mobile/pull/7524.
var win = Ti.UI.createWindow({ backgroundColor:'white', layout : "vertical", title: "Something" }); addButton("Camera Permissions", checkCameraPermissions); addButton("Calendar Permissions", checkCalendarPermissions); win.open(); function addButton(title, callback) { var btn = Ti.UI.createButton({ title : title, top : 50 }); btn.addEventListener("click", callback); win.add(btn); } function checkCameraPermissions() { if (Ti.Media.hasCameraPermissions()) { Ti.API.info("Premissions", Ti.Media.cameraAuthorizationStatus); //Un-comment on second launch and comment out the above //Ti.API.info("Premissions", Ti.Media.cameraAuthorization); } else { Ti.Media.requestCameraPermissions(function(e) { if (e.success === true) { alert("Access granted"); } else { alert("Access denied, error: " + e.error); } }); } } function checkCalendarPermissions() { if (Ti.Calendar.hasCalendarPermissions()) { Ti.Calendar.getAllCalendars(); alert("Access already granted"); Ti.API.info("Premissions", Ti.Calendar.eventsAuthorization); //Un-comment on second launch and comment out the above //Ti.API.info("Premissions", Ti.Calendar.calendarAuthorization); } else { Ti.Calendar.requestCalendarPermissions(function(e) { if (e.success === true) { alert("Access granted"); Ti.Calendar.getAllCalendars(); } else { alert("Access denied, error: " + e.error); } }); } };CR and FT passed. PR Merged.