Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23206] iOS: Unable to Retrieve Detailed Calendar Information via Ti.Calendar.CalendarOS: Refactor default new app-projects

GitHub Issuen/a
TypeImprovement
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2016-08-11T20:08:00.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.1.0
ComponentsiOS
Labelsn/a
ReporterKiley Williams
AssigneeAngel Petkov
Created2016-04-13T01:15:07.000+0000
Updated2016-11-23T17:20:46.000+0000

Description

We are attempting to display the user's local calendars in an organized list (arranged by which account syncs the data). Just like in the image below, we can retrieve the individual calendars, but we cannot retrieve the individually-descriptive sources where the Calendars are coming from. For example, we'd like to show "iCloud", "Facebook", "Google", "Other", and others as the sources of data where calendars are coming from. None of that data is available through the Titanium API, it seems, but it is certainly available through the native SDK on both Android and iOS.

Attachments

FileDateSize
iphone6-ios9-calendars-refresh.png2016-04-13T01:12:43.000+000098810

Comments

  1. Sharif AbuDarda 2016-04-13

    Hello, Thanks for creating the ticket. Our engineering team will look into it. Please understand that the processes is time-consuming and lots of variables in play. We will let you know if and when we will be including this feature in our platform. Regards, Sharif.
  2. Kiley Williams 2016-04-14

    Hi @sdarda, thanks for the quick action on this. One thing to note is that this is not only an Android issue, but it is also an iOS issue. Did you simply separate the Improvement tickets? I don't want this to get logged as only an Android issue. I think the two should be linked as well if there are two separate tickets for Android and iOS. Lastly, this may also be an issue for Windows, but I am not entirely sure since I have not tested on Windows yet. Thanks!
  3. Melissa Chan 2016-04-17

    Hi @sdara, this is definitely something valuable that's missing and would help me greatly with my project. It would be great to see this as a feature in the platform.
  4. Sean Cerney 2016-04-18

    Looking forward to seeing this improvement completed. I would agree with the Reporter that gathering more detailed calendar information through Ti.Calendar in this case would be a big help, especially since it is available in the iOS and Android native SDKs.
  5. Angel Petkov 2016-08-08

    [~Yrkh8trnoy] Hello, I've made this ticket iOS only and also created a counterpart android ticket to go along side, hope you don't mind. All the sub-properties of the source property should now be exposed. PR: https://github.com/appcelerator/titanium_mobile/pull/8197/files Demo Code:
       function showCalendars(calendars) {
           for (var i = 0; i < calendars.length; i++) {
               Ti.API.info(calendars[i].name);
               Ti.API.info(calendars[i].sourceTitle);
               Ti.API.info(calendars[i].sourceIdentifier);
               Ti.API.info(formatSourceType(calendars[i].sourceType)+ '\n');
           }
       }
       
        function formatSourceType(type) {
           switch (type) {
               case Ti.Calendar.SOURCE_TYPE_LOCAL:
               return "Ti.Calendar.SOURCE_TYPE_LOCAL";
               
               case Ti.Calendar.SOURCE_TYPE_EXCHANGE:
               return "Ti.Calendar.SOURCE_TYPE_EXCHANGE";
           
               case Ti.Calendar.SOURCE_TYPE_CALDAV:
               return "Ti.Calendar.SOURCE_TYPE_CALDAV";
           
               case Ti.Calendar.SOURCE_TYPE_MOBILEME:
               return "Ti.Calendar.SOURCE_TYPE_MOBILEME";
           
               case Ti.Calendar.SOURCE_TYPE_SUBSCRIBED:
               return "Ti.Calendar.SOURCE_TYPE_SUBSCRIBED";        
       
               case Ti.Calendar.SOURCE_TYPE_BIRTHDAYS:
               return "Ti.Calendar.SOURCE_TYPE_BIRTHDAYS";      
           }
           
           return "Unknown attendee role: " + type;
       }
       
       Ti.API.info('ALL CALENDARS:'+'\n');
       if (Ti.Calendar.hasCalendarPermissions()) {
           showCalendars(Ti.Calendar.allCalendars);
       } else {
           Ti.Calendar.requestCalendarPermissions(function(e) {
               if (e.success) {
                   showCalendars(Ti.Calendar.allCalendars);
               } else {
                   Ti.API.error(e.error);
                   alert('Access to calendar is not allowed');
               }
           });
       }
       
  6. Kiley Williams 2016-08-29

    Angel, thanks a bunch for knocking this out. I will give it a test run this week!
  7. Angel Petkov 2016-08-29

    [~Yrkh8trnoy] No problem, code strong!
  8. Abir Mukherjee 2016-11-23

    I verified the fix with the following environment: NPM Version: 2.15.9 Node Version: 4.5.0 Mac OS: 10.12.1 Appc CLI: 6.0.0 Appc CLI NPM: 4.2.8 Titanium SDK version: 6.1.0.v20161122053743 Appcelerator Studio, build: 4.8.0.201611121409 Xcode 8.1 GM I installed the app on a device first using SDK 6.0.0, and saw the console log this message for the local calendar case: [INFO] : Unknown attendee role: [object C4A00D65-D59D-4872-A586-B2C73ADEB2D4] I reran the app with SDK 6.1.0, and the message changed to: [INFO] : Ti.Calendar.SOURCE_TYPE_LOCAL Based on this behavior, it appears that detailed Calendar information is being retrieved.

JSON Source