Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20005] Line up *Authorization properties

GitHub Issuen/a
TypeImprovement
PriorityTrivial
StatusClosed
ResolutionFixed
Resolution Date2015-12-07T05:27:57.000+0000
Affected Version/sRelease 5.1.0
Fix Version/sRelease 5.2.0
ComponentsiOS
Labelsn/a
ReporterFokke Zandbergen
AssigneeAngel Petkov
Created2015-11-17T14:25:58.000+0000
Updated2016-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

Comments

  1. Angel Petkov 2015-12-01

    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);
                   }
               });
           }
       
       };
       
  2. Chee Kiat Ng 2015-12-07

    CR and FT passed. PR Merged.
  3. Josh Longton 2016-01-26

JSON Source