这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions RNCalendarEvents.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,19 @@ @implementation RNCalendarEvents
- (NSString *)hexStringFromColor:(UIColor *)color {
const CGFloat *components = CGColorGetComponents(color.CGColor);

CGFloat r = components[0];
CGFloat g = components[1];
CGFloat b = components[2];

CGFloat r;
CGFloat g;
CGFloat b;
if(components && sizeof(components) >= 3){
r = components[0];
g = components[1];
b = components[2];
}else{
r = 1;
g = 1;
b = 1;
}

return [NSString stringWithFormat:@"#%02lX%02lX%02lX",
lroundf(r * 255),
lroundf(g * 255),
Expand Down Expand Up @@ -494,7 +503,7 @@ - (NSDictionary *)serializeCalendarEvent:(EKEvent *)event

if (event.calendar) {
[formedCalendarEvent setValue:@{
@"id": event.calendar.calendarIdentifier,
@"id": event.calendar.calendarIdentifier?event.calendar.calendarIdentifier: @"tempCalendar",
@"title": event.calendar.title ? event.calendar.title : @"",
@"source": event.calendar.source && event.calendar.source.title ? event.calendar.source.title : @"",
@"allowsModifications": @(event.calendar.allowsContentModifications),
Expand Down Expand Up @@ -655,7 +664,7 @@ - (NSDictionary *)serializeCalendarEvent:(EKEvent *)event

[formedCalendarEvent setValue:[self availabilityStringMatchingConstant:event.availability] forKey:_availability];

if (event.structuredLocation) {
if (event.structuredLocation && event.structuredLocation.title && event.structuredLocation.radius) {
NSMutableDictionary *structuredLocation = [[NSMutableDictionary alloc] initWithCapacity:3];
[structuredLocation addEntriesFromDictionary: @{
@"title": event.structuredLocation.title,
Expand Down