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

Emergency fix: not getting times from events #377

Merged
merged 1 commit into from
Dec 3, 2021
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

<!-- To benefit from the current changelog reader in CI/CD, please follow the changelog format from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -->

## [4.0.1](https://github.com/builttoroam/device_calendar/releases/tag/4.1.0)

- Fixes event time retrieved

## [4.0.0](https://github.com/builttoroam/device_calendar/releases/tag/4.0.0)

- Timezone plugin and logic implemented. All issues related to timezone shoulde be fixed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ class CalendarDelegate : PluginRegistry.RequestPermissionsResultListener {

if (event.allDay) {
val calendar = java.util.Calendar.getInstance()
calendar.timeInMillis = event.start!!
calendar.timeInMillis = event.eventStartDate!!
calendar.set(java.util.Calendar.HOUR, 0)
calendar.set(java.util.Calendar.MINUTE, 0)
calendar.set(java.util.Calendar.SECOND, 0)
Expand All @@ -481,10 +481,10 @@ class CalendarDelegate : PluginRegistry.RequestPermissionsResultListener {
values.put(Events.DTEND, calendar.timeInMillis)
values.put(Events.EVENT_TIMEZONE, getTimeZone(event.startTimeZone).id)
} else {
values.put(Events.DTSTART, event.start!!)
values.put(Events.DTSTART, event.eventStartDate!!)
values.put(Events.EVENT_TIMEZONE, getTimeZone(event.startTimeZone).id)

values.put(Events.DTEND, event.end!!)
values.put(Events.DTEND, event.eventEndDate!!)
values.put(Events.EVENT_END_TIMEZONE, getTimeZone(event.endTimeZone).id)
}
values.put(Events.TITLE, event.title)
Expand Down Expand Up @@ -717,8 +717,8 @@ class CalendarDelegate : PluginRegistry.RequestPermissionsResultListener {
event.eventId = eventId.toString()
event.calendarId = calendarId
event.description = description
event.start = begin
event.end = end
event.eventStartDate = begin
event.eventEndDate = end
event.allDay = allDay
event.location = location
event.url = url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ class DeviceCalendarPlugin() : FlutterPlugin, MethodCallHandler, ActivityAware {
event.eventId = call.argument<String>(EVENT_ID_ARGUMENT)
event.description = call.argument<String>(EVENT_DESCRIPTION_ARGUMENT)
event.allDay = call.argument<Boolean>(EVENT_ALL_DAY_ARGUMENT) ?: false
event.start = call.argument<Long>(EVENT_START_DATE_ARGUMENT)!!
event.end = call.argument<Long>(EVENT_END_DATE_ARGUMENT)!!
event.eventStartDate = call.argument<Long>(EVENT_START_DATE_ARGUMENT)!!
event.eventEndDate = call.argument<Long>(EVENT_END_DATE_ARGUMENT)!!
event.startTimeZone = call.argument<String>(EVENT_START_TIMEZONE_ARGUMENT)
event.endTimeZone = call.argument<String>(EVENT_END_TIMEZONE_ARGUMENT)
event.location = call.argument<String>(EVENT_LOCATION_ARGUMENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ class Event {
var eventId: String? = null
var calendarId: String? = null
var description: String? = null
var start: Long? = null
var end: Long? = null
var eventStartDate: Long? = null
var eventEndDate: Long? = null
var startTimeZone: String? = null
var endTimeZone: String? = null
var allDay: Boolean = false
Expand Down
8 changes: 4 additions & 4 deletions ios/Classes/SwiftDeviceCalendarPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public class SwiftDeviceCalendarPlugin: NSObject, FlutterPlugin {
let calendarId: String
let title: String
let description: String?
let start: Int64
let end: Int64
let eventStartDate: Int64
let eventEndDate: Int64
let startTimeZone: String?
let allDay: Bool
let attendees: [Attendee]
Expand Down Expand Up @@ -352,8 +352,8 @@ public class SwiftDeviceCalendarPlugin: NSObject, FlutterPlugin {
calendarId: calendarId,
title: ekEvent.title ?? "New Event",
description: ekEvent.notes,
start: Int64(ekEvent.startDate.millisecondsSinceEpoch),
end: Int64(ekEvent.endDate.millisecondsSinceEpoch),
eventStartDate: Int64(ekEvent.startDate.millisecondsSinceEpoch),
eventEndDate: Int64(ekEvent.endDate.millisecondsSinceEpoch),
startTimeZone: ekEvent.timeZone?.identifier,
allDay: ekEvent.isAllDay,
attendees: attendees,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: device_calendar
description: A cross platform plugin for modifying calendars on the user's device.
version: 4.0.0
version: 4.0.1
homepage: https://github.com/builttoroam/device_calendar/tree/master

dependencies:
Expand Down