ionic-native
Version:
Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support
341 lines • 13.7 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var plugin_1 = require('./plugin');
/**
* @name Calendar
* @description
* This plugin allows you to add events to the Calendar of the mobile device.
*
* Requires Cordova plugin: `cordova-plugin-calendar`. For more info, please see the [Calendar plugin docs](https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin).
*
*
* @usage
* ```
* import {Calendar} from 'ionic-native';
*
*
*
* Calendar.createCalendar('MyCalendar').then(
* (msg) => { console.log(msg); },
* (err) => { console.log(err); }
* );
* ```
* @interfaces
* CalendarOptions
*/
var Calendar = (function () {
function Calendar() {
}
/**
* This function checks if we have permission to read/write from/to the calendar.
* The promise will resolve with `true` when:
* - You're running on iOS, or
* - You're targetting API level lower than 23, or
* - You're using Android < 6, or
* - You've already granted permission
*
* If this returns false, you should call the `requestReadWritePermission` function
* @returns {Promise<boolean>}
*/
Calendar.hasReadWritePermission = function () { return; };
/**
* Check if we have read permission
* @returns {Promise<boolean>}
*/
Calendar.hasReadPermission = function () { return; };
/**
* Check if we have write permission
* @returns {Promise<boolean>}
*/
Calendar.hasWritePermission = function () { return; };
/**
* Request write permission
* @returns {Promise<any>}
*/
Calendar.requestWritePermission = function () { return; };
/**
* Request read permission
* @returns {Promise<any>}
*/
Calendar.requestReadPermission = function () { return; };
/**
* Requests read/write permissions
* @returns {Promise<any>}
*/
Calendar.requestReadWritePermission = function () { return; };
/**
* 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
* @returns {Promise<any>} Returns a Promise
*/
Calendar.createCalendar = function (nameOrOptions) { return; };
/**
* Delete a calendar. (iOS only)
* @param {string} name Name of the calendar to delete.
* @returns {Promise<any>} Returns a Promise
*/
Calendar.deleteCalendar = function (name) { return; };
/**
* Returns the default calendar options.
*
* @return {CalendarOptions} Returns an object with the default calendar options
*/
Calendar.getCalendarOptions = function () { return; };
/**
* Silently create an event.
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @returns {Promise<any>} Returns a Promise
*/
Calendar.createEvent = function (title, location, notes, startDate, endDate) { return; };
/**
* Silently create an event with additional options.
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
* @returns {Promise<any>} Returns a Promise
*/
Calendar.createEventWithOptions = function (title, location, notes, startDate, endDate, options) { return; };
/**
* Interactively create an event.
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @returns {Promise<any>} Returns a Promise
*/
Calendar.createEventInteractively = function (title, location, notes, startDate, endDate) { return; };
/**
* Interactively create an event with additional options.
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
* @returns {Promise<any>}
*/
Calendar.createEventInteractivelyWithOptions = function (title, location, notes, startDate, endDate, options) { return; };
// deprecated
// @Cordova()
// static createEventInNamedCalendar(
// title?: string,
// location?: string,
// notes?: string,
// startDate?: Date,
// endDate?: Date,
// calendarName?: string
// ) {}
/**
* Find an event.
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @returns {Promise<any>}
*/
Calendar.findEvent = function (title, location, notes, startDate, endDate) { return; };
/**
* Find an event with additional options.
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @param {CalendarOptions} [options] Additional options, see `getCalendarOptions`
* @returns {Promise<any>} Returns a Promise that resolves with the event, or rejects with an error.
*/
Calendar.findEventWithOptions = function (title, location, notes, startDate, endDate, options) { return; };
/**
* Find a list of events within the specified date range. (Android only)
*
* @param {Date} [startDate] The start date
* @param {Date} [endDate] The end date
* @returns {Promise<any>} Returns a Promise that resolves with the list of events, or rejects with an error.
*/
Calendar.listEventsInRange = function (startDate, endDate) { return; };
/**
* Get a list of all calendars.
* @returns {Promise<any>} A Promise that resolves with the list of calendars, or rejects with an error.
*/
Calendar.listCalendars = function () { return; };
/**
* Get a list of all future events in the specified calendar. (iOS only)
* @returns {Promise<any>} Returns a Promise that resolves with the list of events, or rejects with an error.
*/
Calendar.findAllEventsInNamedCalendar = function (calendarName) { return; };
/**
* Modify an event. (iOS only)
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @param {string} [newTitle] The new event title
* @param {string} [newLocation] The new event location
* @param {string} [newNotes] The new event notes
* @param {Date} [newStartDate] The new event start date
* @param {Date} [newEndDate] The new event end date
* @return Returns a Promise
*/
Calendar.modifyEvent = function (title, location, notes, startDate, endDate, newTitle, newLocation, newNotes, newStartDate, newEndDate) { return; };
/**
* Modify an event with additional options. (iOS only)
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @param {string} [newTitle] The new event title
* @param {string} [newLocation] The new event location
* @param {string} [newNotes] The new event notes
* @param {Date} [newStartDate] The new event start date
* @param {Date} [newEndDate] The new event end date
* @param {CalendarOptions} [filterOptions] Event Options, see `getCalendarOptions`
* @param {CalendarOptions} [newOptions] New event options, see `getCalendarOptions`
* @return Returns a Promise
*/
Calendar.modifyEventWithOptions = function (title, location, notes, startDate, endDate, newTitle, newLocation, newNotes, newStartDate, newEndDate, filterOptions, newOptions) { return; };
/**
* Delete an event.
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @return Returns a Promise
*/
Calendar.deleteEvent = function (title, location, notes, startDate, endDate) { return; };
/**
* Delete an event from the specified Calendar. (iOS only)
*
* @param {string} [title] The event title
* @param {string} [location] The event location
* @param {string} [notes] The event notes
* @param {Date} [startDate] The event start date
* @param {Date} [endDate] The event end date
* @param {string} calendarName
* @return Returns a Promise
*/
Calendar.deleteEventFromNamedCalendar = function (title, location, notes, startDate, endDate, calendarName) { return; };
/**
* Open the calendar at the specified date.
* @param {Date} date The date you want to open the calendar on
* @return {Promise<any>} Promise returns a promise
*/
Calendar.openCalendar = function (date) { return; };
__decorate([
plugin_1.Cordova()
], Calendar, "hasReadWritePermission", null);
__decorate([
plugin_1.Cordova()
], Calendar, "hasReadPermission", null);
__decorate([
plugin_1.Cordova()
], Calendar, "hasWritePermission", null);
__decorate([
plugin_1.Cordova()
], Calendar, "requestWritePermission", null);
__decorate([
plugin_1.Cordova()
], Calendar, "requestReadPermission", null);
__decorate([
plugin_1.Cordova()
], Calendar, "requestReadWritePermission", null);
__decorate([
plugin_1.Cordova()
], Calendar, "createCalendar", null);
__decorate([
plugin_1.Cordova()
], Calendar, "deleteCalendar", null);
__decorate([
plugin_1.Cordova({
sync: true
})
], Calendar, "getCalendarOptions", null);
__decorate([
plugin_1.Cordova()
], Calendar, "createEvent", null);
__decorate([
plugin_1.Cordova()
], Calendar, "createEventWithOptions", null);
__decorate([
plugin_1.Cordova()
], Calendar, "createEventInteractively", null);
__decorate([
plugin_1.Cordova()
], Calendar, "createEventInteractivelyWithOptions", null);
__decorate([
plugin_1.Cordova()
], Calendar, "findEvent", null);
__decorate([
plugin_1.Cordova()
], Calendar, "findEventWithOptions", null);
__decorate([
plugin_1.Cordova({
platforms: ['Android']
})
], Calendar, "listEventsInRange", null);
__decorate([
plugin_1.Cordova()
], Calendar, "listCalendars", null);
__decorate([
plugin_1.Cordova({
platforms: ['iOS']
})
], Calendar, "findAllEventsInNamedCalendar", null);
__decorate([
plugin_1.Cordova({
platforms: ['iOS']
})
], Calendar, "modifyEvent", null);
__decorate([
plugin_1.Cordova({
platforms: ['iOS']
})
], Calendar, "modifyEventWithOptions", null);
__decorate([
plugin_1.Cordova()
], Calendar, "deleteEvent", null);
__decorate([
plugin_1.Cordova({
platforms: ['iOS']
})
], Calendar, "deleteEventFromNamedCalendar", null);
__decorate([
plugin_1.Cordova()
], Calendar, "openCalendar", null);
Calendar = __decorate([
plugin_1.Plugin({
pluginName: 'Calendar',
plugin: 'cordova-plugin-calendar',
pluginRef: 'plugins.calendar',
repo: 'https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin',
platforms: ['Android', 'iOS']
})
], Calendar);
return Calendar;
}());
exports.Calendar = Calendar;
//# sourceMappingURL=calendar.js.map
;