diff --git a/src/plugins/calendar.ts b/src/plugins/calendar.ts index 705d789a61..ec199d5847 100644 --- a/src/plugins/calendar.ts +++ b/src/plugins/calendar.ts @@ -33,6 +33,26 @@ export interface Calendar { platforms: ['Android', 'iOS'] }) export class 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 `requestReadWritePermissions` function + */ + @Cordova() + static hasReadWritePermissions(): Promise { return; } + + /** + * Requests read/write permissions + */ + @Cordova({sync: true}) + static requestReadWritePermissions(): void {} + /** * Create a calendar. (iOS only) *