From ddbd64d19a3bb1ae475157c936fb9399e6e7ac19 Mon Sep 17 00:00:00 2001 From: Ibrahim Hadeed Date: Thu, 12 May 2016 21:54:52 -0400 Subject: [PATCH] fix(calendar): add new permissions functions for Android 6 (M) devices closes #156 --- src/plugins/calendar.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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) *