feat(calendar): add getCreateCalendarOptions function

This commit is contained in:
Daniel Sogl 2018-03-16 14:42:22 +01:00 committed by GitHub
parent f11be24f74
commit 13765d2d6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,8 +1,7 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Cordova, Plugin, IonicNativePlugin } from '@ionic-native/core'; import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
export interface CalendarOptions { export interface CalendarOptions {
/** /**
* Id * Id
*/ */
@ -47,7 +46,14 @@ export interface CalendarOptions {
* URL * URL
*/ */
url?: string; url?: string;
}
export interface NameOrOptions {
/** Calendar name */
calendarName?: string;
/** Calendar color as a HEX string */
calendarColor?: string;
} }
/** /**
@ -72,6 +78,7 @@ export interface CalendarOptions {
* ``` * ```
* @interfaces * @interfaces
* CalendarOptions * CalendarOptions
* NameOrOptions
*/ */
@Plugin({ @Plugin({
pluginName: 'Calendar', pluginName: 'Calendar',
@ -82,7 +89,6 @@ export interface CalendarOptions {
}) })
@Injectable() @Injectable()
export class Calendar extends IonicNativePlugin { export class Calendar extends IonicNativePlugin {
/** /**
* This function checks if we have permission to read/write from/to the calendar. * This function checks if we have permission to read/write from/to the calendar.
* The promise will resolve with `true` when: * The promise will resolve with `true` when:
@ -95,51 +101,65 @@ export class Calendar extends IonicNativePlugin {
* @returns {Promise<boolean>} * @returns {Promise<boolean>}
*/ */
@Cordova() @Cordova()
hasReadWritePermission(): Promise<boolean> { return; } hasReadWritePermission(): Promise<boolean> {
return;
}
/** /**
* Check if we have read permission * Check if we have read permission
* @returns {Promise<boolean>} * @returns {Promise<boolean>}
*/ */
@Cordova() @Cordova()
hasReadPermission(): Promise<boolean> { return; } hasReadPermission(): Promise<boolean> {
return;
}
/** /**
* Check if we have write permission * Check if we have write permission
* @returns {Promise<boolean>} * @returns {Promise<boolean>}
*/ */
@Cordova() @Cordova()
hasWritePermission(): Promise<boolean> { return; } hasWritePermission(): Promise<boolean> {
return;
}
/** /**
* Request write permission * Request write permission
* @returns {Promise<any>} * @returns {Promise<any>}
*/ */
@Cordova() @Cordova()
requestWritePermission(): Promise<any> { return; } requestWritePermission(): Promise<any> {
return;
}
/** /**
* Request read permission * Request read permission
* @returns {Promise<any>} * @returns {Promise<any>}
*/ */
@Cordova() @Cordova()
requestReadPermission(): Promise<any> { return; } requestReadPermission(): Promise<any> {
return;
}
/** /**
* Requests read/write permissions * Requests read/write permissions
* @returns {Promise<any>} * @returns {Promise<any>}
*/ */
@Cordova() @Cordova()
requestReadWritePermission(): Promise<any> { return; } requestReadWritePermission(): Promise<any> {
return;
}
/** /**
* Create a calendar. (iOS only) * Create a calendar. (iOS only)
* *
* @param {string | Object} nameOrOptions either a string name or a options object. If string, provide the calendar name. IF an object, provide a calendar name as a string and a calendar color in hex format as a string * @param {string | CalendarOptions} nameOrOptions either a string name or a options object. If string, provide the calendar name. IF an object, provide a calendar name as a string and a calendar color in hex format as a string
* @returns {Promise<any>} Returns a Promise * @returns {Promise<any>} Returns a Promise
*/ */
@Cordova() @Cordova()
createCalendar(nameOrOptions: string | any): Promise<any> { return; } createCalendar(nameOrOptions: string | CalendarOptions): Promise<any> {
return;
}
/** /**
* Delete a calendar. (iOS only) * Delete a calendar. (iOS only)
@ -147,7 +167,9 @@ export class Calendar extends IonicNativePlugin {
* @returns {Promise<any>} Returns a Promise * @returns {Promise<any>} Returns a Promise
*/ */
@Cordova() @Cordova()
deleteCalendar(name: string): Promise<any> { return; } deleteCalendar(name: string): Promise<any> {
return;
}
/** /**
* Returns the default calendar options. * Returns the default calendar options.
@ -157,7 +179,21 @@ export class Calendar extends IonicNativePlugin {
@Cordova({ @Cordova({
sync: true sync: true
}) })
getCalendarOptions(): CalendarOptions { return; } getCalendarOptions(): CalendarOptions {
return;
}
/**
* Returns options for a custom calender with sepcific colord
*
* @return {NameOrOptions} Returns an object with the default options
*/
@Cordova({
sync: true
})
getCreateCalendarOptions(): NameOrOptions {
return;
}
/** /**
* Silently create an event. * Silently create an event.
@ -175,7 +211,9 @@ export class Calendar extends IonicNativePlugin {
notes?: string, notes?: string,
startDate?: Date, startDate?: Date,
endDate?: Date endDate?: Date
): Promise<any> { return; } ): Promise<any> {
return;
}
/** /**
* Silently create an event with additional options. * Silently create an event with additional options.
@ -196,7 +234,9 @@ export class Calendar extends IonicNativePlugin {
startDate?: Date, startDate?: Date,
endDate?: Date, endDate?: Date,
options?: CalendarOptions options?: CalendarOptions
): Promise<any> { return; } ): Promise<any> {
return;
}
/** /**
* Interactively create an event. * Interactively create an event.
@ -215,7 +255,9 @@ export class Calendar extends IonicNativePlugin {
notes?: string, notes?: string,
startDate?: Date, startDate?: Date,
endDate?: Date endDate?: Date
): Promise<any> { return; } ): Promise<any> {
return;
}
/** /**
* Interactively create an event with additional options. * Interactively create an event with additional options.
@ -236,7 +278,9 @@ export class Calendar extends IonicNativePlugin {
startDate?: Date, startDate?: Date,
endDate?: Date, endDate?: Date,
options?: CalendarOptions options?: CalendarOptions
): Promise<any> { return; } ): Promise<any> {
return;
}
/** /**
* Find an event. * Find an event.
@ -255,7 +299,9 @@ export class Calendar extends IonicNativePlugin {
notes?: string, notes?: string,
startDate?: Date, startDate?: Date,
endDate?: Date endDate?: Date
): Promise<any> { return; } ): Promise<any> {
return;
}
/** /**
* Find an event with additional options. * Find an event with additional options.
@ -275,7 +321,9 @@ export class Calendar extends IonicNativePlugin {
startDate?: Date, startDate?: Date,
endDate?: Date, endDate?: Date,
options?: CalendarOptions options?: CalendarOptions
): Promise<any> { return; } ): Promise<any> {
return;
}
/** /**
* Find a list of events within the specified date range. (Android only) * Find a list of events within the specified date range. (Android only)
@ -287,14 +335,18 @@ export class Calendar extends IonicNativePlugin {
@Cordova({ @Cordova({
platforms: ['Android'] platforms: ['Android']
}) })
listEventsInRange(startDate: Date, endDate: Date): Promise<any> { return; } listEventsInRange(startDate: Date, endDate: Date): Promise<any> {
return;
}
/** /**
* Get a list of all calendars. * Get a list of all calendars.
* @returns {Promise<any>} A Promise that resolves with the list of calendars, or rejects with an error. * @returns {Promise<any>} A Promise that resolves with the list of calendars, or rejects with an error.
*/ */
@Cordova() @Cordova()
listCalendars(): Promise<any> { return; } listCalendars(): Promise<any> {
return;
}
/** /**
* Get a list of all future events in the specified calendar. (iOS only) * Get a list of all future events in the specified calendar. (iOS only)
@ -303,7 +355,9 @@ export class Calendar extends IonicNativePlugin {
@Cordova({ @Cordova({
platforms: ['iOS'] platforms: ['iOS']
}) })
findAllEventsInNamedCalendar(calendarName: string): Promise<any> { return; } findAllEventsInNamedCalendar(calendarName: string): Promise<any> {
return;
}
/** /**
* Modify an event. (iOS only) * Modify an event. (iOS only)
@ -334,7 +388,9 @@ export class Calendar extends IonicNativePlugin {
newNotes?: string, newNotes?: string,
newStartDate?: Date, newStartDate?: Date,
newEndDate?: Date newEndDate?: Date
): Promise<any> { return; } ): Promise<any> {
return;
}
/** /**
* Modify an event with additional options. (iOS only) * Modify an event with additional options. (iOS only)
@ -369,7 +425,9 @@ export class Calendar extends IonicNativePlugin {
newEndDate?: Date, newEndDate?: Date,
filterOptions?: CalendarOptions, filterOptions?: CalendarOptions,
newOptions?: CalendarOptions newOptions?: CalendarOptions
): Promise<any> { return; } ): Promise<any> {
return;
}
/** /**
* Delete an event. * Delete an event.
@ -388,7 +446,9 @@ export class Calendar extends IonicNativePlugin {
notes?: string, notes?: string,
startDate?: Date, startDate?: Date,
endDate?: Date endDate?: Date
): Promise<any> { return; } ): Promise<any> {
return;
}
/** /**
* Delete an event from the specified Calendar. (iOS only) * Delete an event from the specified Calendar. (iOS only)
@ -411,7 +471,9 @@ export class Calendar extends IonicNativePlugin {
startDate?: Date, startDate?: Date,
endDate?: Date, endDate?: Date,
calendarName?: string calendarName?: string
): Promise<any> { return; } ): Promise<any> {
return;
}
/** /**
* Open the calendar at the specified date. * Open the calendar at the specified date.
@ -419,6 +481,7 @@ export class Calendar extends IonicNativePlugin {
* @return {Promise<any>} Promise returns a promise * @return {Promise<any>} Promise returns a promise
*/ */
@Cordova() @Cordova()
openCalendar(date: Date): Promise<any> { return; } openCalendar(date: Date): Promise<any> {
return;
}
} }