Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-23206] iOS: Expose calendar source-details #8197

Merged
merged 3 commits into from Aug 11, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 42 additions & 0 deletions apidoc/Titanium/Calendar/Calendar.yml
Expand Up @@ -607,6 +607,48 @@ properties:
platforms: [iphone, ipad]
since: "6.0.0"

- name: SOURCE_TYPE_LOCAL
summary: A local calendar source.
type: Number
permission: read-only
platforms: [iphone, ipad]
since: "6.1.0"

- name: SOURCE_TYPE_EXCHANGE
summary: A microsoft exchange calendar source.
type: Number
permission: read-only
platforms: [iphone, ipad]
since: "6.1.0"

- name: SOURCE_TYPE_CALDAV
summary: A calDev calendar source.
Copy link
Contributor

@mrkiley mrkiley Aug 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

summary typo here "calDev" should be "calDav". Not nitpicking, just trying to help! =)

type: Number
permission: read-only
platforms: [iphone, ipad]
since: "6.1.0"

- name: SOURCE_TYPE_MOBILEME
summary: A mobileMe calendar source.
type: Number
permission: read-only
platforms: [iphone, ipad]
since: "6.1.0"

- name: SOURCE_TYPE_SUBSCRIBED
summary: A subscribed calendar source.
type: Number
permission: read-only
platforms: [iphone, ipad]
since: "6.1.0"

- name: SOURCE_TYPE_BIRTHDAYS
summary: A birthday calendar source.
type: Number
permission: read-only
platforms: [iphone, ipad]
since: "6.1.0"

- name: eventsAuthorization
summary: Returns an authorization constant indicating if the application has access to the events in the EventKit.
description: |
Expand Down
22 changes: 22 additions & 0 deletions apidoc/Titanium/Calendar/CalendarProxy.yml
Expand Up @@ -113,3 +113,25 @@ properties:
type: Boolean
permission: read-only
platforms: [android]

- name: sourceTitle
summary: Displays the source title.
type: String
permission: read-only
since: "6.1.0"
platforms: [iphone, ipad]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing since in all properties.


- name: sourceType
summary: Displays the source type.
type: Number
permission: read-only
since: "6.1.0"
constants: Titanium.Calendar.SOURCE_TYPE_*
platforms: [iphone, ipad]

- name: sourceIdentifier
summary: Displays the source identifier.
type: String
permission: read-only
since: "6.1.0"
platforms: [iphone, ipad]
6 changes: 6 additions & 0 deletions iphone/Classes/CalendarModule.h
Expand Up @@ -68,6 +68,12 @@
@property (nonatomic, readonly)NSNumber* ATTENDEE_TYPE_RESOURCE;
@property (nonatomic, readonly)NSNumber* ATTENDEE_TYPE_GROUP;

@property (nonatomic, readonly)NSNumber* SOURCE_TYPE_LOCAL;
@property (nonatomic, readonly)NSNumber* SOURCE_TYPE_EXCHANGE;
@property (nonatomic, readonly)NSNumber* SOURCE_TYPE_CALDAV;
@property (nonatomic, readonly)NSNumber* SOURCE_TYPE_MOBILEME;
@property (nonatomic, readonly)NSNumber* SOURCE_TYPE_SUBSCRIBED;
@property (nonatomic, readonly)NSNumber* SOURCE_TYPE_BIRTHDAYS;

@end

Expand Down
6 changes: 6 additions & 0 deletions iphone/Classes/CalendarModule.m
Expand Up @@ -348,6 +348,12 @@ -(NSNumber*) calendarAuthorization
MAKE_SYSTEM_PROP(ATTENDEE_TYPE_RESOURCE, EKParticipantTypeResource);
MAKE_SYSTEM_PROP(ATTENDEE_TYPE_GROUP, EKParticipantTypeGroup);

MAKE_SYSTEM_PROP(SOURCE_TYPE_LOCAL, EKSourceTypeLocal);
MAKE_SYSTEM_PROP(SOURCE_TYPE_EXCHANGE, EKSourceTypeExchange);
MAKE_SYSTEM_PROP(SOURCE_TYPE_CALDAV, EKSourceTypeCalDAV);
MAKE_SYSTEM_PROP(SOURCE_TYPE_MOBILEME, EKSourceTypeMobileMe);
MAKE_SYSTEM_PROP(SOURCE_TYPE_SUBSCRIBED, EKSourceTypeSubscribed);
MAKE_SYSTEM_PROP(SOURCE_TYPE_BIRTHDAYS, EKSourceTypeBirthdays);
@end

#endif
29 changes: 29 additions & 0 deletions iphone/Classes/TiCalendarCalendar.m
Expand Up @@ -291,6 +291,35 @@ -(NSString*)name
return [[self calendar] title];
}

-(NSString*)sourceTitle
{
__block id result;
TiThreadPerformOnMainThread(^{
result = [[[self calendar] source] title];
},YES);

return result;
}

-(NSNumber*)sourceType
{
__block id result;
TiThreadPerformOnMainThread(^{
result = NUMINT([[[self calendar] source] sourceType]);
},YES);

return result;
}

-(NSString*)sourceIdentifier
{
__block id result;
TiThreadPerformOnMainThread(^{
result = [[[self calendar] source] sourceIdentifier];
},YES);

return result;
}

@end

Expand Down