@ebarooni/capacitor-calendar 7.2.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/EbarooniCapacitorCalendar.podspec +2 -2
  2. package/Package.swift +4 -4
  3. package/README.md +176 -162
  4. package/android/build.gradle +20 -18
  5. package/android/src/main/java/dev/barooni/capacitor/calendar/implementation/CapacitorCalendar.kt +90 -61
  6. package/android/src/main/java/dev/barooni/capacitor/calendar/models/data/EventRecurrenceRule.kt +135 -0
  7. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/CreateEventInput.kt +1 -0
  8. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/CreateEventWithPromptInput.kt +5 -0
  9. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/ModifyEvent.kt +2 -0
  10. package/android/src/main/java/dev/barooni/capacitor/calendar/models/inputs/ModifyEventWithPromptInput.kt +3 -0
  11. package/android/src/main/java/dev/barooni/capacitor/calendar/utils/ImplementationHelper.kt +48 -4
  12. package/dist/docs.json +584 -324
  13. package/dist/esm/definitions.d.ts +5 -5
  14. package/dist/esm/definitions.js.map +1 -1
  15. package/dist/esm/index.d.ts +46 -46
  16. package/dist/esm/index.js +16 -17
  17. package/dist/esm/index.js.map +1 -1
  18. package/dist/esm/schemas/enums/attendee-role.js.map +1 -1
  19. package/dist/esm/schemas/enums/attendee-status.js.map +1 -1
  20. package/dist/esm/schemas/enums/attendee-type.js.map +1 -1
  21. package/dist/esm/schemas/enums/calendar-permission-scope.js.map +1 -1
  22. package/dist/esm/schemas/enums/event-status.js.map +1 -1
  23. package/dist/esm/schemas/interfaces/calendar-event.d.ts +7 -5
  24. package/dist/esm/schemas/interfaces/calendar-event.js.map +1 -1
  25. package/dist/esm/schemas/interfaces/calendar-source.d.ts +1 -1
  26. package/dist/esm/schemas/interfaces/calendar-source.js.map +1 -1
  27. package/dist/esm/schemas/interfaces/calendar.d.ts +2 -2
  28. package/dist/esm/schemas/interfaces/calendar.js.map +1 -1
  29. package/dist/esm/schemas/interfaces/create-event-options.d.ts +63 -46
  30. package/dist/esm/schemas/interfaces/create-event-options.js.map +1 -1
  31. package/dist/esm/schemas/interfaces/create-event-with-prompt-options.d.ts +42 -31
  32. package/dist/esm/schemas/interfaces/create-event-with-prompt-options.js.map +1 -1
  33. package/dist/esm/schemas/interfaces/create-reminder-options.d.ts +10 -1
  34. package/dist/esm/schemas/interfaces/create-reminder-options.js.map +1 -1
  35. package/dist/esm/schemas/interfaces/delete-event-options.d.ts +1 -1
  36. package/dist/esm/schemas/interfaces/delete-event-options.js.map +1 -1
  37. package/dist/esm/schemas/interfaces/delete-event-with-prompt-options.d.ts +1 -1
  38. package/dist/esm/schemas/interfaces/delete-event-with-prompt-options.js.map +1 -1
  39. package/dist/esm/schemas/interfaces/delete-events-by-id-options.d.ts +1 -1
  40. package/dist/esm/schemas/interfaces/delete-events-by-id-options.js.map +1 -1
  41. package/dist/esm/schemas/interfaces/event-recurrence-rule.d.ts +96 -0
  42. package/dist/esm/schemas/interfaces/event-recurrence-rule.js +2 -0
  43. package/dist/esm/schemas/interfaces/event-recurrence-rule.js.map +1 -0
  44. package/dist/esm/schemas/interfaces/modify-event-options.d.ts +61 -44
  45. package/dist/esm/schemas/interfaces/modify-event-options.js.map +1 -1
  46. package/dist/esm/schemas/interfaces/modify-event-with-prompt-options.d.ts +1 -1
  47. package/dist/esm/schemas/interfaces/modify-event-with-prompt-options.js.map +1 -1
  48. package/dist/esm/schemas/interfaces/modify-reminder-options.d.ts +12 -1
  49. package/dist/esm/schemas/interfaces/modify-reminder-options.js.map +1 -1
  50. package/dist/esm/schemas/interfaces/recurrence-rule.d.ts +1 -1
  51. package/dist/esm/schemas/interfaces/recurrence-rule.js.map +1 -1
  52. package/dist/esm/schemas/interfaces/reminder-recurrence-rule.d.ts +1 -1
  53. package/dist/esm/schemas/interfaces/reminder-recurrence-rule.js.map +1 -1
  54. package/dist/esm/schemas/interfaces/reminder.d.ts +1 -1
  55. package/dist/esm/schemas/interfaces/reminder.js.map +1 -1
  56. package/dist/esm/schemas/interfaces/reminders-list.d.ts +2 -2
  57. package/dist/esm/schemas/interfaces/reminders-list.js.map +1 -1
  58. package/dist/esm/schemas/interfaces/select-calendars-with-prompt-options.d.ts +1 -1
  59. package/dist/esm/schemas/interfaces/select-calendars-with-prompt-options.js.map +1 -1
  60. package/dist/esm/schemas/types/event-edit-action.d.ts +1 -1
  61. package/dist/esm/schemas/types/event-edit-action.js.map +1 -1
  62. package/dist/esm/schemas/types/recurrence-frequency.d.ts +4 -0
  63. package/dist/esm/schemas/types/recurrence-frequency.js +2 -0
  64. package/dist/esm/schemas/types/recurrence-frequency.js.map +1 -0
  65. package/dist/esm/sub-definitions/calendar-access.d.ts +4 -4
  66. package/dist/esm/sub-definitions/calendar-access.js.map +1 -1
  67. package/dist/esm/sub-definitions/calendar-operations.d.ts +7 -7
  68. package/dist/esm/sub-definitions/calendar-operations.js.map +1 -1
  69. package/dist/esm/sub-definitions/event-operations.d.ts +10 -10
  70. package/dist/esm/sub-definitions/event-operations.js.map +1 -1
  71. package/dist/esm/sub-definitions/reminders-access.d.ts +1 -1
  72. package/dist/esm/sub-definitions/reminders-access.js.map +1 -1
  73. package/dist/esm/sub-definitions/reminders-operations.d.ts +10 -10
  74. package/dist/esm/sub-definitions/reminders-operations.js.map +1 -1
  75. package/dist/esm/web.d.ts +33 -32
  76. package/dist/esm/web.js +1 -1
  77. package/dist/esm/web.js.map +1 -1
  78. package/dist/plugin.cjs.js +1 -24
  79. package/dist/plugin.cjs.js.map +1 -1
  80. package/dist/plugin.js +1 -24
  81. package/dist/plugin.js.map +1 -1
  82. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/CapacitorCalendarPlugin.swift +90 -71
  83. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Implementation/CapacitorCalendar.swift +45 -63
  84. package/ios/Plugin/Info.plist +24 -0
  85. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/CreateEventInput.swift +25 -21
  86. package/ios/Plugin/Models/Inputs/CreateEventWithPromptInput.swift +171 -0
  87. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/CreateReminderInput.swift +2 -2
  88. package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/ModifyEventInput.swift +63 -41
  89. package/ios/Plugin/Models/Structs/RecurrenceInput.swift +31 -0
  90. package/package.json +37 -45
  91. package/dist/esm/schemas/enums/recurrence-frequency.d.ts +0 -21
  92. package/dist/esm/schemas/enums/recurrence-frequency.js +0 -23
  93. package/dist/esm/schemas/enums/recurrence-frequency.js.map +0 -1
  94. package/ios/Sources/CapacitorCalendarPlugin/Models/Inputs/CreateEventWithPromptInput.swift +0 -89
  95. package/ios/Tests/CapacitorCalendarPluginTests/CapacitorCalendarPluginTests.swift +0 -15
  96. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Enums/CAPPermissionState.swift +0 -0
  97. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Enums/CalendarPermissionScope.swift +0 -0
  98. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Enums/EventEditAction.swift +0 -0
  99. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/CheckPermissionInput.swift +0 -0
  100. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/CreateCalendarInput.swift +0 -0
  101. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/DeleteCalendarInput.swift +0 -0
  102. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/DeleteEventInput.swift +0 -0
  103. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/DeleteEventWithPromptInput.swift +0 -0
  104. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/DeleteEventsByIdInput.swift +0 -0
  105. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/DeleteReminderInput.swift +0 -0
  106. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/DeleteReminderWithPromptInput.swift +0 -0
  107. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/DeleteRemindersByIdInput.swift +0 -0
  108. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/GetReminderByIdInput.swift +0 -0
  109. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/GetRemindersFromListsInput.swift +0 -0
  110. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/ListEventsInRangeInput.swift +0 -0
  111. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/ModifyCalendarInput.swift +0 -0
  112. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/ModifyEventWithPromptInput.swift +0 -0
  113. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/ModifyReminderInput.swift +0 -0
  114. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/OpenCalendarInput.swift +0 -0
  115. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/RequestPermissionInput.swift +0 -0
  116. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Inputs/SelectCalendarsWithPromptInput.swift +0 -0
  117. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/CheckAllPermissionsResult.swift +0 -0
  118. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/CheckPermissionResult.swift +0 -0
  119. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/CreateCalendarResult.swift +0 -0
  120. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/CreateEventResult.swift +0 -0
  121. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/CreateEventWithPromptResult.swift +0 -0
  122. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/CreateReminderResult.swift +0 -0
  123. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/DeleteEventWithPromptResult.swift +0 -0
  124. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/DeleteEventsByIdResult.swift +0 -0
  125. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/DeleteRemindersByIdResult.swift +0 -0
  126. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/FetchAllCalendarSourcesResult.swift +0 -0
  127. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/GetDefaultCalendarResult.swift +0 -0
  128. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/GetReminderByIdResult.swift +0 -0
  129. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/GetRemindersFromListsResult.swift +0 -0
  130. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/ListCalendarsResult.swift +0 -0
  131. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/ListEventsInRangeResult.swift +0 -0
  132. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/ModifyEventWithPromptResult.swift +0 -0
  133. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/RequestAllPermissionsResult.swift +0 -0
  134. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/RequestPermissionResult.swift +0 -0
  135. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Results/SelectCalendarsWithPromptResult.swift +0 -0
  136. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Models/Templates/JSResult.swift +0 -0
  137. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/PluginConfig.swift +0 -0
  138. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/PluginError.swift +0 -0
  139. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Utils/ImplementationHelper.swift +0 -0
  140. /package/ios/{Sources/CapacitorCalendarPlugin → Plugin}/Utils/UIColorFromHexExtension.swift +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebarooni/capacitor-calendar",
3
- "version": "7.2.0",
3
+ "version": "8.0.0",
4
4
  "description": "A capacitor plugin for managing calendar events on iOS and Android, with reminders support on iOS.",
5
5
  "author": "Ehsan Barooni",
6
6
  "license": "MIT",
@@ -21,9 +21,6 @@
21
21
  "eventkit",
22
22
  "ionic"
23
23
  ],
24
- "engines": {
25
- "node": ">=20.12.2"
26
- },
27
24
  "publishConfig": {
28
25
  "access": "public"
29
26
  },
@@ -35,72 +32,67 @@
35
32
  "dist/",
36
33
  "android/src/main/",
37
34
  "android/build.gradle",
38
- "ios/Sources",
39
- "ios/Tests",
35
+ "ios/Plugin",
40
36
  "Package.swift",
41
37
  "EbarooniCapacitorCalendar.podspec",
42
38
  "LICENSE"
43
39
  ],
44
40
  "scripts": {
41
+ "bootstrap:app": "npm run build && npm run install:app && npm run build:app && npm run sync:app",
45
42
  "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
46
43
  "build:app": "cd example-app && npm run build",
47
- "bootstrap:app": "npm run build && npm run install:app && npm run build:app && npm run sync:app",
48
44
  "clean": "rimraf ./dist",
45
+ "docgen": "docgen --api CapacitorCalendarPlugin --output-readme README.md --output-json dist/docs.json",
46
+ "eslint": "eslint . --ext ts",
47
+ "fmt": "npm run eslint -- --fix && npm run prettier:fix && npm run swiftlint -- --fix --format && npm run fmt:android",
48
+ "fmt:android": "npm run ktlint -- -F",
49
+ "install:app": "cd example-app && npm i",
50
+ "ktlint": "ktlint",
51
+ "lint": "npm run eslint && npm run prettier:check && npm run swiftlint -- lint && npm run lint:android",
52
+ "lint:android": "npm run ktlint",
53
+ "pod:install": "cd ios && pod install --repo-update",
54
+ "prepublishOnly": "npm run build",
49
55
  "prettier": "npx prettier",
50
56
  "prettier:check": "npm run prettier -- . --check",
51
57
  "prettier:fix": "npm run prettier -- . --write",
52
- "eslint": "npx eslint",
53
- "eslint:fix": "npm run eslint -- --fix",
54
- "fmt": "npm run fmt:web && npm run fmt:android && npm run fmt:ios",
55
- "fmt:android": "ktlint -F",
56
- "fmt:ios": "npx swiftlint --fix --format",
57
- "fmt:web": "npm run eslint:fix && npm run prettier:fix",
58
- "install:app": "cd example-app && npm i",
59
- "lint": "npm run lint:web && npm run lint:android && npm run lint:ios",
60
- "lint:android": "npx ktlint",
61
- "lint:ios": "npx swiftlint lint",
62
- "lint:web": "npm run eslint && npm run prettier:check",
63
58
  "spm:install": "swift package resolve",
59
+ "swiftlint": "node-swiftlint",
64
60
  "sync:app": "cd example-app && npx cap sync",
65
61
  "typedoc": "npx typedoc",
66
- "docgen": "docgen --api CapacitorCalendarPlugin --output-readme README.md --output-json dist/docs.json",
67
62
  "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
68
- "verify:ios": "xcodebuild build -scheme EbarooniCapacitorCalendar -destination generic/platform=iOS",
69
63
  "verify:android": "cd android && ./gradlew clean build test && cd ..",
64
+ "verify:ios": "xcodebuild build -scheme EbarooniCapacitorCalendar -destination generic/platform=iOS",
70
65
  "verify:web": "npm run build",
71
- "prepublishOnly": "npm run build",
72
- "version:patch": "npm version patch --git-tag-version false",
66
+ "version:major": "npm version major --git-tag-version false",
73
67
  "version:minor": "npm version minor --git-tag-version false",
74
- "version:major": "npm version major --git-tag-version false"
68
+ "version:patch": "npm version patch --git-tag-version false"
75
69
  },
76
70
  "devDependencies": {
77
- "@capacitor/android": "^7.0.0",
78
- "@capacitor/core": "^7.0.0",
79
- "@capacitor/ios": "^7.0.0",
80
- "@ebarooni/capacitor-docgen": "^0.0.2",
81
- "@ebarooni/eslint-config": "^1.3.0",
82
- "@ebarooni/prettier-config": "^1.4.0",
83
- "@ebarooni/swiftlint-config": "^1.2.1",
84
- "@eslint/js": "^9.19.0",
85
- "@eslint/json": "^0.10.0",
86
- "@eslint/markdown": "^6.2.2",
87
- "angular-eslint": "^19.0.2",
88
- "eslint": "^9.19.0",
89
- "eslint-config-prettier": "^10.0.1",
90
- "eslint-plugin-promise": "^7.2.1",
71
+ "@capacitor/android": "^8.0.0",
72
+ "@capacitor/core": "^8.0.0",
73
+ "@capacitor/ios": "^8.0.0",
74
+ "@ebarooni/capacitor-docgen": "^0.1.0",
75
+ "@ionic/eslint-config": "0.4.0",
76
+ "@ionic/prettier-config": "^4.0.0",
77
+ "@ionic/swiftlint-config": "2.0.0",
78
+ "@types/node": "^25.0.3",
79
+ "eslint": "8.57.0",
91
80
  "prettier": "^3.3.2",
92
- "rimraf": "^6.0.1",
93
- "rollup": "^4.30.1",
81
+ "prettier-plugin-java": "^2.7.7",
82
+ "rimraf": "^6.1.0",
83
+ "rollup": "^4.53.3",
94
84
  "swiftlint": "^2.0.0",
95
- "typedoc": "^0.26.5",
96
- "typescript": "~4.8.4",
97
- "typescript-eslint": "^8.22.0"
85
+ "typedoc": "^0.28.15",
86
+ "typescript": "^5.9.3"
98
87
  },
99
88
  "peerDependencies": {
100
- "@capacitor/core": ">=7.0.0"
89
+ "@capacitor/core": ">=8.0.0"
90
+ },
91
+ "eslintConfig": {
92
+ "extends": "@ionic/eslint-config/recommended"
101
93
  },
102
- "prettier": "@ebarooni/prettier-config",
103
- "swiftlint": "@ebarooni/swiftlint-config",
94
+ "prettier": "@ionic/prettier-config",
95
+ "swiftlint": "@ionic/swiftlint-config",
104
96
  "capacitor": {
105
97
  "ios": {
106
98
  "src": "ios"
@@ -1,21 +0,0 @@
1
- /**
2
- * @since 7.1.0
3
- */
4
- export declare enum RecurrenceFrequency {
5
- /**
6
- * @since 7.1.0
7
- */
8
- DAILY = 0,
9
- /**
10
- * @since 7.1.0
11
- */
12
- WEEKLY = 1,
13
- /**
14
- * @since 7.1.0
15
- */
16
- MONTHLY = 2,
17
- /**
18
- * @since 7.1.0
19
- */
20
- YEARLY = 3
21
- }
@@ -1,23 +0,0 @@
1
- /**
2
- * @since 7.1.0
3
- */
4
- export var RecurrenceFrequency;
5
- (function (RecurrenceFrequency) {
6
- /**
7
- * @since 7.1.0
8
- */
9
- RecurrenceFrequency[RecurrenceFrequency["DAILY"] = 0] = "DAILY";
10
- /**
11
- * @since 7.1.0
12
- */
13
- RecurrenceFrequency[RecurrenceFrequency["WEEKLY"] = 1] = "WEEKLY";
14
- /**
15
- * @since 7.1.0
16
- */
17
- RecurrenceFrequency[RecurrenceFrequency["MONTHLY"] = 2] = "MONTHLY";
18
- /**
19
- * @since 7.1.0
20
- */
21
- RecurrenceFrequency[RecurrenceFrequency["YEARLY"] = 3] = "YEARLY";
22
- })(RecurrenceFrequency || (RecurrenceFrequency = {}));
23
- //# sourceMappingURL=recurrence-frequency.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"recurrence-frequency.js","sourceRoot":"","sources":["../../../../src/schemas/enums/recurrence-frequency.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,mBAiBX;AAjBD,WAAY,mBAAmB;IAC7B;;OAEG;IACH,+DAAK,CAAA;IACL;;OAEG;IACH,iEAAM,CAAA;IACN;;OAEG;IACH,mEAAO,CAAA;IACP;;OAEG;IACH,iEAAM,CAAA;AACR,CAAC,EAjBW,mBAAmB,KAAnB,mBAAmB,QAiB9B","sourcesContent":["/**\n * @since 7.1.0\n */\nexport enum RecurrenceFrequency {\n /**\n * @since 7.1.0\n */\n DAILY,\n /**\n * @since 7.1.0\n */\n WEEKLY,\n /**\n * @since 7.1.0\n */\n MONTHLY,\n /**\n * @since 7.1.0\n */\n YEARLY,\n}\n"]}
@@ -1,89 +0,0 @@
1
- import Capacitor
2
- import EventKit
3
-
4
- struct CreateEventWithPromptInput {
5
- private let title: String
6
- private let isAllDay: Bool
7
- private var alerts: [Double]
8
- private var calendarId: String?
9
- private var location: String?
10
- private var startDate: Double?
11
- private var endDate: Double?
12
- private var url: String?
13
- private var description: String?
14
- private var availability: EKEventAvailability?
15
-
16
- init(call: CAPPluginCall) {
17
- self.title = call.getString("title", "")
18
- if let calendarId = call.getString("calendarId") {
19
- self.calendarId = calendarId
20
- }
21
- if let location = call.getString("location") {
22
- self.location = location
23
- }
24
- if let startDate = call.getDouble("startDate") as Double? {
25
- self.startDate = startDate
26
- }
27
- if let endDate = call.getDouble("endDate") as Double? {
28
- self.endDate = endDate
29
- }
30
- self.isAllDay = call.getBool("isAllDay", false)
31
- if let alerts = call.getArray("alerts", []) as? [Double] {
32
- self.alerts = alerts
33
- } else {
34
- self.alerts = []
35
- }
36
- if let url = call.getString("url") {
37
- self.url = url
38
- }
39
- if let description = call.getString("description") {
40
- self.description = description
41
- }
42
- if let availability = call.getInt("availability") {
43
- self.availability = EKEventAvailability(rawValue: availability)
44
- }
45
- }
46
-
47
- func getTitle() -> String {
48
- return title
49
- }
50
-
51
- func getIsAllDay() -> Bool {
52
- return isAllDay
53
- }
54
-
55
- func getAlerts() -> [EKAlarm] {
56
- return alerts.map { EKAlarm(relativeOffset: $0 * 60) }
57
- }
58
-
59
- func getCalendar(from eventStore: EKEventStore) -> EKCalendar? {
60
- return ImplementationHelper.getCalendarFromId(eventStore: eventStore, calendarId: calendarId, fallback: true)
61
- }
62
-
63
- func getLocation() -> String? {
64
- return location
65
- }
66
-
67
- func getStartDate() -> Date? {
68
- guard let startDate = startDate else { return nil }
69
- return ImplementationHelper.dateFromTimestamp(startDate)
70
- }
71
-
72
- func getEndDate() -> Date? {
73
- guard let endDate = endDate else { return nil }
74
- return ImplementationHelper.dateFromTimestamp(endDate)
75
- }
76
-
77
- func getUrl() -> URL? {
78
- guard let url = url else { return nil }
79
- return URL(string: url)
80
- }
81
-
82
- func getDescription() -> String? {
83
- return description
84
- }
85
-
86
- func getAvailability() -> EKEventAvailability? {
87
- return availability
88
- }
89
- }
@@ -1,15 +0,0 @@
1
- import XCTest
2
- @testable import CapacitorCalendarPlugin
3
-
4
- class CapacitorCalendarTests: XCTestCase {
5
- func testEcho() {
6
- // This is an example of a functional test case for a plugin.
7
- // Use XCTAssert and related functions to verify your tests produce the correct results.
8
-
9
- let implementation = CapacitorCalendar()
10
- let value = "Hello, World!"
11
- let result = implementation.echo(value)
12
-
13
- XCTAssertEqual(value, result)
14
- }
15
- }