Coder Social home page Coder Social logo

builttoroam / device_calendar Goto Github PK

View Code? Open in Web Editor NEW
257.0 12.0 254.0 1.28 MB

A cross platform plugin for modifying calendars on the user's device

Home Page: https://pub.dev/packages/device_calendar

License: BSD 3-Clause "New" or "Revised" License

Kotlin 26.31% Swift 16.01% Objective-C 0.14% Dart 56.39% Ruby 0.78% Shell 0.37%

device_calendar's Introduction

Device Calendar Plugin

pub package Pub Version (including pre-releases) build

A cross platform plugin for modifying calendars on the user's device.

Breaking changes at v4

  • If you're upgrading from previous versions, your code will need to be modified (slightly), otherwise it will not run after update. See Timezone support for more details.
  • There are some changes to event JSON formats at v4. Pay extra care if you handle event JSONs. Directly calling to and from device calendars should be unaffected.

Features

  • Request permissions to modify calendars on the user's device
  • Check if permissions to modify the calendars on the user's device have been granted
  • Add or retrieve calendars on the user's device
  • Retrieve events associated with a calendar
  • Add, update or delete events from a calendar
  • Set up, edit or delete recurring events
    • NOTE: Editing a recurring event will currently edit all instances of it
    • NOTE: Deleting multiple instances in Android takes time to update, you'll see the changes after a few seconds
  • Add, modify or remove attendees and receive if an attendee is an organiser for an event
  • Setup reminders for an event
  • Specify a time zone for event start and end date
    • NOTE: Due to a limitation of iOS API, single time zone property is used for iOS (event.startTimeZone)
    • NOTE: For the time zone list, please refer to the TZ database name column on Wikipedia

Timezone support with TZDateTime

Due to feedback we received, starting from 4.0.0 we will be using the timezone package to better handle all timezone data.

This is already included in this package. However, you need to add this line whenever the package is needed.

import 'package:timezone/timezone.dart';

If you don't need any timezone specific features in your app, you may use flutter_native_timezone to get your devices' current timezone, then convert your previous DateTime with it.

import 'package:flutter_native_timezone/flutter_native_timezone.dart';

initializeTimeZones();

// As an example, our default timezone is UTC.
Location _currentLocation = getLocation('Etc/UTC');

Future setCurentLocation() async {
  String timezone = 'Etc/UTC';
  try {
    timezone = await FlutterNativeTimezone.getLocalTimezone();
  } catch (e) {
    print('Could not get the local timezone');
  }
  _currentLocation = getLocation(timezone);
  setLocalLocation(_currentLocation);
}

...

event.start = TZDateTime.from(oldDateTime, _currentLocation);

For other use cases, feedback or future developments on the feature, feel free to open a discussion on GitHub.

Null-safety migration

From v3.9.0, device_calendar is null-safe. However, not all workflows have been checked and bugs from older versions still persist.

You are strongly advised to test your workflow with the new package before shipping. Better yet, please leave a note for what works and what doesn't, or contribute some bug fixes!

Android Integration

The following will need to be added to the AndroidManifest.xml file for your application to indicate permissions to modify calendars are needed

<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />

Proguard / R8 exceptions

NOTE: From v4.3.2 developers no longer need to add proguard rule in their app.

By default, all android apps go through R8 for file shrinking when building a release version. Currently, it interferes with some functions such as retrieveCalendars().

You may add the following setting to the ProGuard rules file proguard-rules.pro (thanks to Britannio Jarrett). Read more about the issue here

-keep class com.builttoroam.devicecalendar.** { *; }

See here for an example setup.

For more information, refer to the guide at Android Developer

AndroidX migration

Since v.1.0, this version has migrated to use AndroidX instead of the deprecated Android support libraries. When using 0.10.0 and onwards for this plugin, please ensure your application has been migrated following the guide here

iOS Integration

For iOS 10+ support, you'll need to modify the Info.plist to add the following key/value pair

<key>NSCalendarsUsageDescription</key>
<string>Access most functions for calendar viewing and editing.</string>

<key>NSContactsUsageDescription</key>
<string>Access contacts for event attendee editing.</string>

For iOS 17+ support, add the following key/value pair as well.

<key>NSCalendarsFullAccessUsageDescription</key>
<string>Access most functions for calendar viewing and editing.</string>

Note that on iOS, this is a Swift plugin. There is a known issue being tracked here by the Flutter team, where adding a plugin developed in Swift to an Objective-C project causes problems. If you run into such issues, please look at the suggested workarounds there.

device_calendar's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

device_calendar's Issues

"New events must specify a calendar id"

Trying to add events to a calendar (with calendar id specified) but it doesn't work.
Code:

final devCal = DeviceCalendarPlugin();
final cals = (await devCal.retrieveCalendars()).data;
final cal = Calendar(
    id: "calid",
    name: "Calendar Name",
    isReadOnly: false
);
cals.add(cal);

final event = Event("calid".
    eventId: "evid",
    // ...
);
final result = await devCal.createOrUpdateEvent(event);
final errors = result.errorMessages;
/* errors:
 * [599] Device calendar plugin ran into an issue. Platform specific exception 
 * [500], with message :"New events must specify a calendar id", has been thrown.
 */

Build error with the plgin

/flutter/.pub-cache/hosted/pub.dartlang.org/device_calendar-0.1.2/ios/Classes/D
eviceCalendarPlugin.m:2:9: fatal error: 'device_calendar/device_calendar-Swift.h' file not found
#import <device_calendar/device_calendar-Swift.h>

Android not coming back from _deviceCalendarPlugin.requestPermissions()

Hi, thanks for this awesome plugin!

I'm having a little permissions problem with Android.
When i open for the first time, the page that hosts the calendar, i'm prompted to allow access to the calendar, when i click accept tho, the app doesn't continue the execution, looks like the Future from the method channel is never returning anything at it just hangs there.
The permission is correctly set tho, as if i go back to the home page and click on the calendar page again, the calendar is loaded.

var permissionsGranted = await _deviceCalendarPlugin.hasPermissions();
      if (permissionsGranted.isSuccess && !permissionsGranted.data) {
        permissionsGranted = await _deviceCalendarPlugin.requestPermissions();

  // code dies here for Android     

   if (!permissionsGranted.isSuccess || !permissionsGranted.data) {
          return;
        }
      }
....

On IOS the execution is passed back to my code as expected.

Hope you have some clues about it.

Thanks!

David

How do I use this plugin

Is it possible to get some example on how to use this plugin. I would like send a calendar event to users and I am not sure how to do that with this plugin.

Thank you

Recurring Event

Hi

I've started working with your lib and it's working well +1
I'd like to add more advanced feature like recurring events or others specific events.

Is there so methods calls that will be available in coming release or should I manage it all from Flutter ?

Thanks.

Attendee details not showing in Calendar,Datetime also reflecting inncorrectly.

I am using the example app and testing it on Android. I see that when i create a calendar event and add a Attendee , the attendee isnt showing on the devices calendar but is showing in the example calendar,also i noticed that if i go into my devices calendar the event time date is incorrect but in the example it is correct.

How Can I Solve this

The user has not allowed this application to modify their calendar.
I added the two lines in Android Manifest

SWIFT_VERSION attribute set

device_calendar does not specify a Swift version and none of the targets (Runner) integrating it have the SWIFT_VERSION attribute set. Please contact the author or set the SWIFT_VERSION attribute in at least one of the targets that integrate this pod.

Build issue on Android with distributionUrl set to gradle-4.4-all.zip

I'm on master and updated Flutter to the latest release today and name am getting this error in building:

] * What went wrong:
[ ] [ ] A problem occurred evaluating root project 'device_calendar'.
[ ] [ ] > Failed to apply plugin [id 'com.android.library']
[ ] [ ] > Minimum supported Gradle version is 4.10.1. Current version is 4.4. If using the gradle
wrapper, try editing the distributionUrl in .... gradle\wrapper\gradlewrapper.properties to 4.10.1-all.zip

As a work around I've cloned the project and edited the above mentioned file to fix the issue.

Plugin does not work headless (fix included)

Hi,

This plugin has issues when launching in headless mode using background_fetch plugin.

Here is the fix for the issue

All plugin developers need to guard themselves against the case where an App can launch Headless, where registrar.activity() == null.

Relevant error logs:
07-04 14:56:31.110 10430 10430 E AndroidRuntime: FATAL EXCEPTION: main 07-04 14:56:31.110 10430 10430 E AndroidRuntime: Process: com.noaimgames.shadowweather, PID: 10430 07-04 14:56:31.110 10430 10430 E AndroidRuntime: java.lang.RuntimeException: java.lang.IllegalStateException: registrar.activity() must not be null 07-04 14:56:31.110 10430 10430 E AndroidRuntime: at android.app.job.JobServiceEngine$JobHandler.handleMessage(JobServiceEngine.java:112) 07-04 14:56:31.110 10430 10430 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106) 07-04 14:56:31.110 10430 10430 E AndroidRuntime: at android.os.Looper.loop(Looper.java:214) 07-04 14:56:31.110 10430 10430 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7032) 07-04 14:56:31.110 10430 10430 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 07-04 14:56:31.110 10430 10430 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) 07-04 14:56:31.110 10430 10430 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965) 07-04 14:56:31.110 10430 10430 E AndroidRuntime: Caused by: java.lang.IllegalStateException: registrar.activity() must not be null 07-04 14:56:31.110 10430 10430 E AndroidRuntime: at com.builttoroam.devicecalendar.DeviceCalendarPlugin$Companion.registerWith(DeviceCalendarPlugin.kt:50) 07-04 14:56:31.110 10430 10430 E AndroidRuntime: at com.builttoroam.devicecalendar.DeviceCalendarPlugin.registerWith(Unknown Source:2) 07-04 14:56:31.110 10430 10430 E AndroidRuntime: at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:35) 07-04 14:56:31.110 10430 10430 E AndroidRuntime: at com.noaimgames.shadowweather.Application.registerWith(Application.java:17) 07-04 14:56:31.110 10430 10430 E AndroidRuntime: at com.transistorsoft.flutter.backgroundfetch.HeadlessTask.initFlutterView(HeadlessTask.java:133) 07-04 14:56:31.110 10430 10430 E AndroidRuntime: at com.transistorsoft.flutter.backgroundfetch.HeadlessTask.<init>(HeadlessTask.java:47) 07-04 14:56:31.110 10430 10430 E AndroidRuntime: at com.transistorsoft.flutter.backgroundfetch.HeadlessJobService.onStartJob(HeadlessJobService.java:38) 07-04 14:56:31.110 10430 10430 E AndroidRuntime: at android.app.job.JobService$1.onStartJob(JobService.java:62) 07-04 14:56:31.110 10430 10430 E AndroidRuntime: at android.app.job.JobServiceEngine$JobHandler.handleMessage(JobServiceEngine.java:108) 07-04 14:56:31.110 10430 10430 E AndroidRuntime: ... 6 more 07-04 14:57:20.079 17712 17712 E AndroidRuntime: FATAL EXCEPTION: main 07-04 14:57:20.079 17712 17712 E AndroidRuntime: Process: com.noaimgames.shadowweather, PID: 17712 07-04 14:57:20.079 17712 17712 E AndroidRuntime: java.lang.RuntimeException: java.lang.IllegalStateException: registrar.activity() must not be null 07-04 14:57:20.079 17712 17712 E AndroidRuntime: at android.app.job.JobServiceEngine$JobHandler.handleMessage(JobServiceEngine.java:112) 07-04 14:57:20.079 17712 17712 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106) 07-04 14:57:20.079 17712 17712 E AndroidRuntime: at android.os.Looper.loop(Looper.java:214) 07-04 14:57:20.079 17712 17712 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7032) 07-04 14:57:20.079 17712 17712 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 07-04 14:57:20.079 17712 17712 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) 07-04 14:57:20.079 17712 17712 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965) 07-04 14:57:20.079 17712 17712 E AndroidRuntime: Caused by: java.lang.IllegalStateException: registrar.activity() must not be null 07-04 14:57:20.079 17712 17712 E AndroidRuntime: at com.builttoroam.devicecalendar.DeviceCalendarPlugin$Companion.registerWith(DeviceCalendarPlugin.kt:50) 07-04 14:57:20.079 17712 17712 E AndroidRuntime: at com.builttoroam.devicecalendar.DeviceCalendarPlugin.registerWith(Unknown Source:2) 07-04 14:57:20.079 17712 17712 E AndroidRuntime: at io.flutter.plugins.GeneratedPluginRegistrant.registerWith(GeneratedPluginRegistrant.java:35) 07-04 14:57:20.079 17712 17712 E AndroidRuntime: at com.noaimgames.shadowweather.Application.registerWith(Application.java:17) 07-04 14:57:20.079 17712 17712 E AndroidRuntime: at com.transistorsoft.flutter.backgroundfetch.HeadlessTask.initFlutterView(HeadlessTask.java:133) 07-04 14:57:20.079 17712 17712 E AndroidRuntime: at com.transistorsoft.flutter.backgroundfetch.HeadlessTask.<init>(HeadlessTask.java:47) 07-04 14:57:20.079 17712 17712 E AndroidRuntime: at com.transistorsoft.flutter.backgroundfetch.HeadlessJobService.onStartJob(HeadlessJobService.java:38) 07-04 14:57:20.079 17712 17712 E AndroidRuntime: at android.app.job.JobService$1.onStartJob(JobService.java:62) 07-04 14:57:20.079 17712 17712 E AndroidRuntime: at android.app.job.JobServiceEngine$JobHandler.handleMessage(JobServiceEngine.java:108) 07-04 14:57:20.079 17712 17712 E AndroidRuntime: ... 6 more

flutter doctor -v
[√] Flutter (Channel stable, v1.5.4-hotfix.2, on Microsoft Windows [Version 10.0.18362.175], locale en-US)
• Flutter version 1.5.4-hotfix.2 at C:\flutter\sdk\flutter
• Framework revision 7a4c33425d (10 weeks ago), 2019-04-29 11:05:24 -0700
• Engine revision 52c7a1e849
• Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at C:\Users\Spencer\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
• All Android licenses accepted.

[√] Android Studio (version 3.3)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 32.0.1
• Dart plugin version 182.5124
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[√] Connected device (1 available)
• SM G973U • RF8M13837GY • android-arm64 • Android 9 (API 28)

• No issues found!

updating an event info does not propagate to retrieveEvents() until app restart

Repro:

  • create an event in device's calendar
  • build a flutter app using device_calendar: 1.0.0+2
  • retrieve the calendar information
Future<void> getDeviceEvents() async {
  try {
    final permitted = await deviceCal.requestPermissions();
    if (!permitted.data)
      throw 'user denied calendar permissions!';
    final calendars = await deviceCal.retrieveCalendars();
    if (calendars.data == null || calendars.data.length == 0)
      throw 'no device calendars to parse!';
    calendars.data.forEach((calendar) async {
      final events = await DeviceCalendarPlugin().retrieveEvents(calendar.id, RetrieveEventsParams(
        startDate: DateTime.now().subtract(Duration(days: 3)),
        endDate: DateTime.now().add(Duration(days: 3)),
      ));
      if (events.data != null && events.data.length > 0) {
        _parseDeviceEvents(events.data.toList(), calendar);
      }
    });
  } catch (err) {
    print('[CalendarService][getDeviceEvents] ERROR = $err');
  }
}
  • see the event I created with the start time at the date I created it with
  • go into device calendar, change the date to a different day
  • flutter clean & flutter run -d all
  • retrieve the calendar information again, see the start time for the event is not updated (it is still the start that I originally created it with)

Environment:

  • Android 10 (API 29)
  • Google calendar
[✓] Flutter (Channel stable, v1.9.1+hotfix.5, on Mac OS X 10.14.6 18G95, locale en-US)
    • Flutter version 1.9.1+hotfix.5 at /Users/corey/flutter
    • Framework revision 1aedbb1835 (2 weeks ago), 2019-10-17 08:37:27 -0700
    • Engine revision b863200c37
    • Dart version 2.5.0


[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/corey/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = /Users/corey/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/corey/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.1, Build version 11A1027
    • CocoaPods version 1.7.5

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 40.2.2
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.39.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.5.1

[✓] Connected device (1 available)
    • ONEPLUS A6000 • 4241cff9 • android-arm64 • Android 10 (API 29)

• No issues found!

On Android there is a list of guests even though there were no attendees

When I create an Event using the Event.fromJson method and I do not specify any attendee. When I createOrUpdateEvent the event is added to Android calendar, however in the calendar states:
"The full guest list has been hidden because the number of guests is too large."

If I do not specify any attendees there should be no guest on the guest list.

Flutter build api --release issue

I have been gotten issue with retrieveCalendars when build release.

If I build project by code, device_calendar work well. But if I build release apk and then install by generated apk. this method cannot retrieveCalendars on device.

Please help me about this.

Thanks

Calendar ID is not a number for DeleteEvent

Whenever I execute deviceCalendarPlugin.deleteEvent, I get the following error

[599] Device calendar plugin ran into an issue. Platform specific exception [400], with message :"Calendar ID is not a number", has been thrown.

The code I execute is below.

var permissionsGranted = await _requestCalendarPermissions();

if (!permissionsGranted) {
   return null;
}

//Attempt to delete the event
var result = await _deviceCalendarPlugin.deleteEvent('4', 'eventId');

Having trouble with Location

Not sure whats going on, but I can't seem to make an event in the Google Calendar with the location filled out. Everything else is fine though.

Android version is 6.0.1
Google Calendar version is 6.0.4

Event _event = new Event(currentCalendar.id);
    _event.title = "Title";
    _event.description = "text";
    _event.location = "The United States";
    _event.start = DateTime.fromMillisecondsSinceEpoch(
        int.tryParse(currentEvent.date) // This is valid in my source
    );

    _event.end = DateTime.fromMillisecondsSinceEpoch(
        int.tryParse(currentEvent.date)  // This is valid in my source
    ).add(new Duration(hours:1));

    calendar.createOrUpdateEvent(_event).then((res){
      print(res.isSuccess.toString());
      print(res.errorMessages.toString());
    });

Any ideas what could be wrong?

Allow to use our own eventId

Hello,
It would be very usefull to allow us to use our own eventId. In my case, the events come from the network, so there have an id. But if I want to add them in the calendar, I must memorize in my app the eventId returned by the plugin and associate them to the event fetched from the network, and it's not very simple.

If you can do something, it would be great !

No implementation found for method

Exception given when trying to run just the example in a clean flutter create project. It appears both are implemented, so I am confused by the message.

flutter: MissingPluginException(No implementation found for method retrieveCalendars on channel plugins.builttoroam.com/device_calendar)```

```yaml
name: calendar_demo
description: A new Flutter project.

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# Read more about versioning at semver.org.
version: 1.0.0+1

environment:
  sdk: ">=2.0.0-dev.68.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2

  device_calendar: ^0.0.6

New Pixel without device calendar

Hi,
The issue is more android related:
The plugin works very well on a device that has a built in calendar and usually that calendar is sync with email calendars of the user, but i can't make it work with a google pixel 2 because my guess is there is no built in calendar, i was wondering how would it be possible to make it work with a phone that has only google calendar and if it was possible or a way around.

Thanks a lot

Returning NULL on released version

I implemented the device_callendar 0.2.2 and everything works great on debug but when I release the app on android, the device asks for the permission to access the calendar just fine but the list of calendars come back null. The amount of calendars retrieved from the release version come back the same as in debug but the .id and the .name come back null for each calendar. On iOS released version everything works great as in debug. Am I missing something?

I trippled checked my android manifest and the permisions are there:

<uses-permission android:name="android.permission.READ_CALENDAR"/>
<uses-permission android:name="android.permission.WRITE_CALENDAR"/>
<uses-permission android:name="android.permission.INTERNET"/>

Kotlin Gradle plugin version 1.2.51 and higher

FAILURE: Build failed with an exception.

  • What went wrong:
    The Android Gradle plugin supports only Kotlin Gradle plugin version 1.2.51 and higher. Project 'device_calendar' is using version
    1.1.51.

Adding attendees when creating an event

Hello there,

I have a problem with attendees. I'm creating calendar events for a flutter app I'm building. The user can select a person that he wants to schedule a meeting with, the app creates an event in the users calendar. Now I'm at the point that I want to add the selected person as an attendee so that the calendar event will be send to this person, and the selected person can accept/deny the invitation.

My problem is the following: I can't add attendees based on their e-mail address. The Attendee class only has a name property and (as far as I have tested) doesn't add anything to the actual event when I check the android calendar. Are there any plans to support this? Or am I doing something wrong?
This functionality sort of "makes or breaks" the plugin for me.

Creating an event with an `eventId` being a String of just numbers.

What

It appears that when creating an event and trying to add it to the calendar with an eventId of just numbers (i.e. '93861039') fails to actually add the event to the calendar.

Environment

Testing on a physical Pixel 3, running Android 10. Selecting a calendar from Google Calendars.

I could not reproduce this on iOS due to a different issue (#121). This might be related to that.

Steps to Reproduce

Take a successful Event that you are able to add, and change the eventId to "93861039". Try to add the event to a calendar. You should get a successful result from the plugin, however it should never get added to your calendar.

Miscellaneous

I'm wondering if it's parsing to an int or something in plugin code, or if Google Calendars doesn't allow an eventId with a String of just numbers.

Custom url for calendar events

It would be great to have an url property at the event level to be able to identify (update for example) an event.

The property seems to be available on both platform :

Cannot create a new event when passing in an `eventId`.

What

When trying to create a new event (createOrUpdateEvent) and specifying an eventId, I'm receiving the following error:

[599] Device calendar plugin ran into an issue. Platform specific exception [404], with message :"The event with the ID 93861039 could not be found", has been thrown.

Environment

Testing on a physical iPhone X running 13.2 and an iOS Simulator (iPhone 11 Pro Max - 13.0).

I could not reproduce this issue on Android.

Steps to Reproduce

Try to create a new event on iOS and specify an eventId.

Miscellaneous

I am guessing that we should not be allowed to create an event with an eventId and instead that's used to query for one on each platform. However, if that's the case, we need to update the documentation to avoid confusion on that.

IllegalStateException: Reply already submitted" error

Hi - I have an app, where I retrieve events for a given date. It works for all days except the current date. You can see in the below logs, it works for Jan 5 and Jan 3, but for Jan 4 I get the "IllegalStateException: Reply already submitted" error. I tried messing with the dates, and it appears like the issue occurs when the date overlaps with current date, and retrieveEvents is called. Could you please shed some light on what's going on. Thanks.

Flutter version: 1.0.0+1
device_calendar: ^0.0.7
Device: Android 7.0 (API 27)

Stacktrace:
D/ViewRootImpl@7f9cfc6MainActivity: ViewPostImeInputStage processPointer 1
I/flutter (18333): Sat, Jan 5, 2019
I/flutter (18333): startDate: 2019-01-05 00:00:00.000, endDate: 2019-01-06 00:00:00.000

D/ViewRootImpl@7f9cfc6MainActivity: ViewPostImeInputStage processPointer 0
D/ViewRootImpl@7f9cfc6MainActivity: ViewPostImeInputStage processPointer 1
I/flutter (18333): Fri, Jan 4, 2019
I/flutter (18333): startDate: 2019-01-04 00:00:00.000, endDate: 2019-01-05 00:00:00.000
I/System.out(18333): title must not be null
E/MethodChannel#plugins.builttoroam.com/device_calendar(18333): Failed to handle method call
E/MethodChannel#plugins.builttoroam.com/device_calendar(18333): java.lang.IllegalStateException: Reply already submitted

E/MethodChannel#plugins.builttoroam.com/device_calendar(18333): at io.flutter.view.FlutterNativeView$1.reply(FlutterNativeView.java:174)
E/MethodChannel#plugins.builttoroam.com/device_calendar(18333): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:203)
E/MethodChannel#plugins.builttoroam.com/device_calendar(18333): at com.builttoroam.devicecalendar.CalendarDelegate.finishWithSuccess(CalendarDelegate.kt:571)
E/MethodChannel#plugins.builttoroam.com/device_calendar(18333): at com.builttoroam.devicecalendar.CalendarDelegate.retrieveEvents(CalendarDelegate.kt:305)
E/MethodChannel#plugins.builttoroam.com/device_calendar(18333): at com.builttoroam.devicecalendar.DeviceCalendarPlugin.onMethodCall(DeviceCalendarPlugin.kt:82)
E/MethodChannel#plugins.builttoroam.com/device_calendar(18333): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:200)
E/MethodChannel#plugins.builttoroam.com/device_calendar(18333): at io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:163)
E/MethodChannel#plugins.builttoroam.com/device_calendar(18333): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#plugins.builttoroam.com/device_calendar(18333): at android.os.MessageQueue.next(MessageQueue.java:323)
E/MethodChannel#plugins.builttoroam.com/device_calendar(18333): at android.os.Looper.loop(Looper.java:136)
E/MethodChannel#plugins.builttoroam.com/device_calendar(18333): at android.app.ActivityThread.main(ActivityThread.java:6780)
E/MethodChannel#plugins.builttoroam.com/device_calendar(18333): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#plugins.builttoroam.com/device_calendar(18333): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1500)
E/MethodChannel#plugins.builttoroam.com/device_calendar(18333): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1390)
E/FlutterNativeView(18333): Uncaught exception in binary message listener
E/FlutterNativeView(18333): java.lang.IllegalStateException: Reply already submitted
E/FlutterNativeView(18333): at io.flutter.view.FlutterNativeView$1.reply(FlutterNativeView.java:174)
E/FlutterNativeView(18333): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:218)
E/FlutterNativeView(18333): at io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:163)
E/FlutterNativeView(18333): at android.os.MessageQueue.nativePollOnce(Native Method)
E/FlutterNativeView(18333): at android.os.MessageQueue.next(MessageQueue.java:323)
E/FlutterNativeView(18333): at android.os.Looper.loop(Looper.java:136)
E/FlutterNativeView(18333): at android.app.ActivityThread.main(ActivityThread.java:6780)
E/FlutterNativeView(18333): at java.lang.reflect.Method.invoke(Native Method)
E/FlutterNativeView(18333): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1500)
E/FlutterNativeView(18333): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1390)
I/flutter (18333): PlatformException(500, title must not be null, null)
Reloaded 1 of 429 libraries in 1,227ms.
D/ViewRootImpl@7f9cfc6MainActivity: ViewPostImeInputStage processPointer 0
D/ViewRootImpl@7f9cfc6MainActivity: ViewPostImeInputStage processPointer 1
I/flutter (18333): Thu, Jan 3, 2019
I/flutter (18333): startDate: 2019-01-03 00:00:00.000, endDate: 2019-01-04 00:00:00.000

Enhancement - organizer info to CalendarEvent

Providing organizer (email) info along with title, description, attendees, etc in Calendar retrieveEvents would be very useful as action like sending an email to organizer may be required by apps. Hope this could be added. Thx

Can't compile device_calendar on iOS

Hi - device_calendar is great on Android, but fails to compile on iOS with the following error:

/Users/nicford/Applications/flutter/.pub-cache/hosted/pub.dartlang.org/device_calendar-0.0.6/ios/Classes/DeviceCalendarPlugin.m:2:9: 'device_calendar/device_calendar-Swift.h' file not found

I've trawled Google and found many references to similar problems; but none of which have solved the problem for me. Is this something you've come across before? And if so, do you have a fix?

Many thanks

Nic Ford

Cannot compile device_calendar on Android with last version 0.10.2 of flutter

Hi,

I cannot run my program with Flutter v0.10.2. I get :

D:\dev\tools\flutter\.pub-cache\hosted\pub.dartlang.org\device_calendar-0.0.6\android\src\main\kotlin\com\builttoroam\devicecalendar\DeviceCalendarPlugin.kt: (82, 50): Type mismatch: inferred type is String? but String was expected
e: D:\dev\tools\flutter\.pub-cache\hosted\pub.dartlang.org\device_calendar-0.0.6\android\src\main\kotlin\com\builttoroam\devicecalendar\DeviceCalendarPlugin.kt: (92, 35): Type mismatch: inferred type is String? but String was expected
e: D:\dev\tools\flutter\.pub-cache\hosted\pub.dartlang.org\device_calendar-0.0.6\android\src\main\kotlin\com\builttoroam\devicecalendar\DeviceCalendarPlugin.kt: (96, 31): Type mismatch: inferred type is Long? but Long was expected
e: D:\dev\tools\flutter\.pub-cache\hosted\pub.dartlang.org\device_calendar-0.0.6\android\src\main\kotlin\com\builttoroam\devicecalendar\DeviceCalendarPlugin.kt: (97, 29): Type mismatch: inferred type is Long? but Long was expected
e: D:\dev\tools\flutter\.pub-cache\hosted\pub.dartlang.org\device_calendar-0.0.6\android\src\main\kotlin\com\builttoroam\devicecalendar\DeviceCalendarPlugin.kt: (99, 55): Type mismatch: inferred type is String? but String was expected
e: D:\dev\tools\flutter\.pub-cache\hosted\pub.dartlang.org\device_calendar-0.0.6\android\src\main\kotlin\com\builttoroam\devicecalendar\DeviceCalendarPlugin.kt: (105, 47): Type mismatch: inferred type is String? but String was expected
e: D:\dev\tools\flutter\.pub-cache\hosted\pub.dartlang.org\device_calendar-0.0.6\android\src\main\kotlin\com\builttoroam\devicecalendar\DeviceCalendarPlugin.kt: (105, 59): Type mismatch: inferred type is String? but String was expected
> flutter doctor -v
[√] Flutter (Channel beta, v0.10.2, on Microsoft Windows [version 10.0.16299.726], locale fr-FR)
    • Flutter version 0.10.2 at D:\dev\tools\flutter
    • Framework revision d8cbb80206 (12 days ago), 2018-10-26 01:30:21 -0400
    • Engine revision 6c2ade9fa2
    • Dart version 2.1.0-dev.8.0.flutter-bf26f760b1

[√] Android toolchain - develop for Android devices (Android SDK 28.0.2)
    • Android SDK at C:\Users\...\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.2
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
    • All Android licenses accepted.

[√] Android Studio (version 3.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 28.0.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[√] VS Code, 64-bit edition (version 1.28.2)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 2.20.0

[√] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)

Thanks for your help

Retrieve Event based on Url (or other attributes)

(see #132 for background on this request from @aloisdeniel)

A great addition would be to be able to retrieve an event from its url too! :)

Because with current APIs we need to load all events to check if it already exists.

final events = await systemCalendar.retrieveEvents(calendarId, RetrieveEventsParams(
eventUrls : ["custom://events/563"],
));

EKCADErrorDomain 1014

Getting this exception every time on iPhone 4S with this code
final existingEventsRes = await deviceCalendar.retrieveEvents(calendar.id, filter);
deviceCalendar is regular (non-readonly)

Error getting shared calendar invitations for entity types 3 from daemon: Error Domain=EKCADErrorDomain Code=1014 "(null)"

Quick search in the internet hints a bug in iOS with a workaround described here

Create Event with specific ID

Current implementation assume that a provided ID is for update but
I'd like to manage events by forging it. Is it possible ?
These would help a lot manage complex operations.
Thank you.

The number of events that can be obtained on Android and iOS is different.

Thanks for the useful plug-in.
I have the following problems.
There are two events on the same day of the same calendar.
Executes retrieveEvents.
The number of events that can be obtained on Android and iOS is different.

*device _ calendar: ^ 0.2 .1 + 1
Android: 2 events
iOS: 1 event

*device _ calendar: ^ 0.1 .3
Android: 2 events
iOS: 2 events

Are there any measures?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.