Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): add missing “Calendar.Event.remove” method #14076

Merged
merged 2 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading