Skip to content

Commit

Permalink
fix(android): add missing “Calendar.Event.remove” method (#14076)
Browse files Browse the repository at this point in the history
* fix(android): add missing “Calendar.Event.remove” method

* fix: remove eventId parameter, use inner ID
  • Loading branch information
hansemannn authored Jul 10, 2024
1 parent 420ccdc commit d1bbe8a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,21 @@ public void setExtendedProperty(String name, String value)
contentResolver.insert(extPropsUri, values);
}

@Kroll.method
public boolean remove()
{
ContentResolver contentResolver = TiApplication.getInstance().getContentResolver();

try {
Uri deleteUri = ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, TiConvert.toInt(id));
contentResolver.delete(deleteUri, null, null);
} catch (IllegalArgumentException e) {
return false;
}

return true;
}

@Override
public String getApiName()
{
Expand Down
11 changes: 6 additions & 5 deletions apidoc/Titanium/Calendar/Event.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: <Titanium.Calendar.SPAN_THISEVENT>
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.
Expand Down

0 comments on commit d1bbe8a

Please sign in to comment.