Skip to content

Commit

Permalink
fix(calendar): add new permissions functions for Android 6 (M) devices
Browse files Browse the repository at this point in the history
closes #156
  • Loading branch information
ihadeed committed May 13, 2016
1 parent aa034a2 commit ddbd64d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/plugins/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean> { return; }

/**
* Requests read/write permissions
*/
@Cordova({sync: true})
static requestReadWritePermissions(): void {}

/**
* Create a calendar. (iOS only)
*
Expand Down

0 comments on commit ddbd64d

Please sign in to comment.