From 0d5cfe216edb152b43d333d27725d6c67563c7d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans=20Kn=C3=B6chel?= Date: Sat, 6 Jul 2024 19:35:47 +0200 Subject: [PATCH 1/2] =?UTF-8?q?fix(android):=20add=20missing=20=E2=80=9CCa?= =?UTF-8?q?lendar.Event.remove=E2=80=9D=20method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ti/modules/titanium/calendar/EventProxy.java | 15 +++++++++++++++ apidoc/Titanium/Calendar/Event.yml | 11 ++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/android/modules/calendar/src/java/ti/modules/titanium/calendar/EventProxy.java b/android/modules/calendar/src/java/ti/modules/titanium/calendar/EventProxy.java index 7a8c8c9846c..e264d659cff 100644 --- a/android/modules/calendar/src/java/ti/modules/titanium/calendar/EventProxy.java +++ b/android/modules/calendar/src/java/ti/modules/titanium/calendar/EventProxy.java @@ -559,6 +559,21 @@ public void setExtendedProperty(String name, String value) contentResolver.insert(extPropsUri, values); } + @Kroll.method + public boolean remove(Object eventId) + { + ContentResolver contentResolver = TiApplication.getInstance().getContentResolver(); + + try { + Uri deleteUri = ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, TiConvert.toInt(eventId)); + contentResolver.delete(deleteUri, null, null); + } catch (IllegalArgumentException e) { + return false; + } + + return true; + } + @Override public String getApiName() { diff --git a/apidoc/Titanium/Calendar/Event.yml b/apidoc/Titanium/Calendar/Event.yml index 51d4831c44a..da4d8cbe140 100644 --- a/apidoc/Titanium/Calendar/Event.yml +++ b/apidoc/Titanium/Calendar/Event.yml @@ -72,7 +72,7 @@ methods: - name: save summary: Saves changes to an event permanently. description: | - This method raises an exception if it is passed an event from another event store. + This method raises an exception if it is passed an event from another calendar. When an event is saved, it is updated in the Calendar database. Any fields you did not modify are updated to reflect the most recent value in the database. If the @@ -94,20 +94,21 @@ methods: since: {android: "7.1.0", iphone: "3.1.0", ipad: "3.1.0"} - name: remove - summary: Removes an event from the event store. + summary: Removes an event from the calendar. description: | - This method raises an exception if it is passed an event from another event store. + This method raises an exception on iOS if an event from another calendar is used. returns: type: Boolean parameters: - name: span summary: | - The span to use. Indicates whether to remove future instances of the event in + iOS-only: The span to use. Indicates whether to remove future instances of the event in the case of a recurring event. type: Number constants: Titanium.Calendar.SPAN_* default: - platforms: [iphone, ipad, macos] + since: {android: "12.4.0", iphone: "3.1.0", ipad: "3.1.0", macos: "9.2.0"} + platforms: [android, iphone, ipad, macos] - name: refresh summary: Updates the event's data with the current information in the Calendar database. From 904597f29a95ad5a6945c759d102b7ad543055c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hans=20Kn=C3=B6chel?= Date: Sun, 7 Jul 2024 19:05:18 +0200 Subject: [PATCH 2/2] fix: remove eventId parameter, use inner ID --- .../src/java/ti/modules/titanium/calendar/EventProxy.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/modules/calendar/src/java/ti/modules/titanium/calendar/EventProxy.java b/android/modules/calendar/src/java/ti/modules/titanium/calendar/EventProxy.java index e264d659cff..9ad71100316 100644 --- a/android/modules/calendar/src/java/ti/modules/titanium/calendar/EventProxy.java +++ b/android/modules/calendar/src/java/ti/modules/titanium/calendar/EventProxy.java @@ -560,12 +560,12 @@ public void setExtendedProperty(String name, String value) } @Kroll.method - public boolean remove(Object eventId) + public boolean remove() { ContentResolver contentResolver = TiApplication.getInstance().getContentResolver(); try { - Uri deleteUri = ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, TiConvert.toInt(eventId)); + Uri deleteUri = ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, TiConvert.toInt(id)); contentResolver.delete(deleteUri, null, null); } catch (IllegalArgumentException e) { return false;