@ebarooni/capacitor-calendar 8.1.0 → 8.2.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 (35) hide show
  1. package/README.md +68 -1
  2. package/android/src/main/java/dev/barooni/capacitor/calendar/CapacitorCalendarPlugin.kt +10 -0
  3. package/dist/docs.json +237 -8
  4. package/dist/esm/index.d.ts +4 -1
  5. package/dist/esm/index.js.map +1 -1
  6. package/dist/esm/schemas/interfaces/create-reminders-list-options.d.ts +0 -1
  7. package/dist/esm/schemas/interfaces/create-reminders-list-options.js.map +1 -1
  8. package/dist/esm/schemas/interfaces/create-reminders-list-result.d.ts +0 -1
  9. package/dist/esm/schemas/interfaces/create-reminders-list-result.js.map +1 -1
  10. package/dist/esm/schemas/interfaces/delete-reminders-list-options.d.ts +23 -0
  11. package/dist/esm/schemas/interfaces/delete-reminders-list-options.js +2 -0
  12. package/dist/esm/schemas/interfaces/delete-reminders-list-options.js.map +1 -0
  13. package/dist/esm/schemas/interfaces/update-reminders-list-options.d.ts +40 -0
  14. package/dist/esm/schemas/interfaces/update-reminders-list-options.js +2 -0
  15. package/dist/esm/schemas/interfaces/update-reminders-list-options.js.map +1 -0
  16. package/dist/esm/schemas/interfaces/update-reminders-list-result.d.ts +12 -0
  17. package/dist/esm/schemas/interfaces/update-reminders-list-result.js +2 -0
  18. package/dist/esm/schemas/interfaces/update-reminders-list-result.js.map +1 -0
  19. package/dist/esm/sub-definitions/reminders-operations.d.ts +17 -0
  20. package/dist/esm/sub-definitions/reminders-operations.js.map +1 -1
  21. package/dist/esm/web.d.ts +5 -0
  22. package/dist/esm/web.js +6 -0
  23. package/dist/esm/web.js.map +1 -1
  24. package/dist/plugin.cjs.js +6 -0
  25. package/dist/plugin.cjs.js.map +1 -1
  26. package/dist/plugin.js +6 -0
  27. package/dist/plugin.js.map +1 -1
  28. package/ios/Plugin/CapacitorCalendarPlugin.swift +30 -0
  29. package/ios/Plugin/Implementation/CapacitorCalendar.swift +39 -0
  30. package/ios/Plugin/Models/Inputs/DeleteRemindersListInput.swift +22 -0
  31. package/ios/Plugin/Models/Inputs/UpdateRemindersListInput.swift +55 -0
  32. package/ios/Plugin/Models/Results/UpdateRemindersListResult.swift +15 -0
  33. package/ios/Plugin/PluginConfig.swift +3 -1
  34. package/ios/Plugin/PluginError.swift +3 -0
  35. package/package.json +1 -1
@@ -0,0 +1,22 @@
1
+ import Capacitor
2
+
3
+ struct DeleteRemindersListInput {
4
+ private let commit: Bool
5
+ private let id: String
6
+
7
+ init(call: CAPPluginCall) throws {
8
+ self.commit = call.getBool("commit", true)
9
+ guard let id = call.getString("id") else {
10
+ throw PluginError.idMissing
11
+ }
12
+ self.id = id
13
+ }
14
+
15
+ func getCommit() -> Bool {
16
+ return commit
17
+ }
18
+
19
+ func getId() -> String {
20
+ return id
21
+ }
22
+ }
@@ -0,0 +1,55 @@
1
+ import Capacitor
2
+
3
+ struct UpdateRemindersListInput {
4
+ private let color: CGColor?
5
+ private let commit: Bool
6
+ private let id: String
7
+ private let title: String?
8
+
9
+ init(call: CAPPluginCall) throws {
10
+ guard let id = call.getString("id") else {
11
+ throw PluginError.idMissing
12
+ }
13
+ self.id = id
14
+ self.title = call.getString("title")
15
+ self.color = UpdateRemindersListInput.getListColorFromCall(call)
16
+ self.commit = call.getBool("commit", true)
17
+ }
18
+
19
+ func getColor() -> CGColor? {
20
+ return color
21
+ }
22
+
23
+ func getCommit() -> Bool {
24
+ return commit
25
+ }
26
+
27
+ func getId() -> String {
28
+ return id
29
+ }
30
+
31
+ func getTitle() -> String? {
32
+ return title
33
+ }
34
+
35
+ private static func getListColorFromCall(_ call: CAPPluginCall) -> CGColor? {
36
+ guard let colorName = call.getString("color") else {
37
+ return nil
38
+ }
39
+
40
+ switch colorName.lowercased() {
41
+ case "blue": return UIColor.systemBlue.cgColor
42
+ case "brown": return UIColor.systemBrown.cgColor
43
+ case "gray": return UIColor.systemGray.cgColor
44
+ case "green": return UIColor.systemGreen.cgColor
45
+ case "indigo": return UIColor.systemIndigo.cgColor
46
+ case "orange": return UIColor.systemOrange.cgColor
47
+ case "pink": return UIColor.systemPink.cgColor
48
+ case "purple": return UIColor.systemPurple.cgColor
49
+ case "red": return UIColor.systemRed.cgColor
50
+ case "teal": return UIColor.systemTeal.cgColor
51
+ case "yellow": return UIColor.systemYellow.cgColor
52
+ default: return nil
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,15 @@
1
+ import Capacitor
2
+
3
+ struct UpdateRemindersListResult: JSResult {
4
+ private let id: String
5
+
6
+ init(id: String) {
7
+ self.id = id
8
+ }
9
+
10
+ func toJSON() -> JSObject {
11
+ var result = JSObject()
12
+ result["id"] = id
13
+ return result
14
+ }
15
+ }
@@ -17,6 +17,7 @@ struct PluginConfig {
17
17
  CAPPluginMethod(name: "deleteEventWithPrompt", returnType: CAPPluginReturnPromise),
18
18
  CAPPluginMethod(name: "deleteEventsById", returnType: CAPPluginReturnPromise),
19
19
  CAPPluginMethod(name: "deleteReminder", returnType: CAPPluginReturnPromise),
20
+ CAPPluginMethod(name: "deleteRemindersList", returnType: CAPPluginReturnPromise),
20
21
  CAPPluginMethod(name: "deleteReminderWithPrompt", returnType: CAPPluginReturnPromise),
21
22
  CAPPluginMethod(name: "deleteRemindersById", returnType: CAPPluginReturnPromise),
22
23
  CAPPluginMethod(name: "fetchAllCalendarSources", returnType: CAPPluginReturnPromise),
@@ -40,6 +41,7 @@ struct PluginConfig {
40
41
  CAPPluginMethod(name: "requestPermission", returnType: CAPPluginReturnPromise),
41
42
  CAPPluginMethod(name: "requestReadOnlyCalendarAccess", returnType: CAPPluginReturnPromise),
42
43
  CAPPluginMethod(name: "requestWriteOnlyCalendarAccess", returnType: CAPPluginReturnPromise),
43
- CAPPluginMethod(name: "selectCalendarsWithPrompt", returnType: CAPPluginReturnPromise)
44
+ CAPPluginMethod(name: "selectCalendarsWithPrompt", returnType: CAPPluginReturnPromise),
45
+ CAPPluginMethod(name: "updateRemindersList", returnType: CAPPluginReturnPromise)
44
46
  ]
45
47
  }
@@ -21,6 +21,7 @@ enum PluginError: LocalizedError {
21
21
  case invalidColor
22
22
  case calendarNotFound
23
23
  case listNotFound
24
+ case listNotModifiable
24
25
  case missingFrequency
25
26
  case missingInterval
26
27
  case fromDateMissing
@@ -58,6 +59,8 @@ enum PluginError: LocalizedError {
58
59
  return NSLocalizedString("Calendar not found.", comment: "Calendar not found error")
59
60
  case .listNotFound:
60
61
  return NSLocalizedString("List not found.", comment: "List not found error")
62
+ case .listNotModifiable:
63
+ return NSLocalizedString("List is not modifiable.", comment: "List not modifiable error")
61
64
  case .invalidUrl:
62
65
  return NSLocalizedString("Invalid URL.", comment: "Invalid URL error")
63
66
  case .unableToOpenUrl:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebarooni/capacitor-calendar",
3
- "version": "8.1.0",
3
+ "version": "8.2.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",