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

New prerelease (4.1) #381

Merged
merged 49 commits into from
Dec 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
8f67a45
Merge pull request #204 from builttoroam/release
bhl09 Mar 25, 2020
9ec999a
Merge pull request #208 from builttoroam/release
bhl09 Mar 25, 2020
dcd53b9
Fix serialize inconsistency
cjohnson19 Jul 20, 2021
e6f4f0a
Add tests for event serialization and run in azure
cjohnson19 Jul 22, 2021
6ba1eba
Merge branch 'develop' into fromjson-start-fix
cjohnson19 Aug 3, 2021
d5951db
Update badges on readme
thomassth Nov 25, 2021
f7e48d3
General clarity improvements
thomassth Nov 25, 2021
6d12e8c
Update prerelease.yml
thomassth Nov 25, 2021
cb171ee
Update prerelease.yml
thomassth Nov 25, 2021
702b4ce
Update release.yml
thomassth Nov 25, 2021
0a9743f
Merge pull request #365 from thomassth/actions
thomassth Nov 25, 2021
b49d11d
Create prerelease.yml
thomassth Nov 26, 2021
20aef71
Update release.yml
thomassth Nov 26, 2021
a3f3ff2
Merge pull request #366 from thomassth/actions
sowens-csd Nov 26, 2021
46ffaf8
parallel testing
thomassth Nov 26, 2021
7623675
cherrypick workflows, changelog
thomassth Nov 26, 2021
564cda3
Merge pull request #361 from thomassth/v3.9
thomassth Nov 26, 2021
9faf81a
folder fix
thomassth Nov 26, 2021
ad9b31d
Merge pull request #369 from thomassth/v3.9
thomassth Nov 26, 2021
acdd3be
Minor updates to README text.
Nov 27, 2021
580e341
Merge pull request #367 from thomassth/actions
thomassth Nov 28, 2021
3551139
Merge pull request #364 from builttoroam/readme-badges
sowens-csd Nov 28, 2021
d8a62b3
V4.0.0 final prep (#370)
thomassth Nov 28, 2021
4ea90d8
merge branches
thomassth Nov 29, 2021
b5d5217
Merge pull request #372 from thomassth/develop
thomassth Nov 29, 2021
3f24216
renaming
thomassth Dec 3, 2021
69a84fa
Merge pull request #377 from thomassth/retrieve-fix
thomassth Dec 3, 2021
57f1750
Update device_calendar_test.dart
thomassth Dec 17, 2021
47bf9b0
Update event.dart
thomassth Dec 17, 2021
33c77e9
Merge branch
thomassth Dec 17, 2021
78877c8
using integration test
thomassth Nov 29, 2021
d0c8370
fix depreciated items
thomassth Nov 29, 2021
00f1f3b
Merge pull request #380 from thomassth/integration-test
thomassth Dec 18, 2021
4d2c31e
gradle update
thomassth Dec 18, 2021
4343477
more renaming
thomassth Dec 18, 2021
4ed6e5d
swift renaming
thomassth Dec 18, 2021
44eac7b
build with jvm 1.8
thomassth Dec 19, 2021
692bac2
Merge pull request #379 from thomassth/test-upgrade
thomassth Dec 19, 2021
712c55d
Merge pull request #382 from thomassth/rename
thomassth Dec 19, 2021
42dcf82
test success
thomassth Dec 19, 2021
eef5b70
feat: remove changes unrelated to intg. test
Dec 20, 2021
188b3f4
fix: not matching timezone from JSON
thomassth Dec 20, 2021
84f6605
Merge pull request #385 from thomassth/integration-test
thomassth Dec 20, 2021
a1783eb
Merge pull request #388 from thomassth/rename
thomassth Dec 20, 2021
df8fa90
Update pubspec.yaml
thomassth Dec 20, 2021
664a2b5
minor cleanup
thomassth Dec 20, 2021
c084302
changelog, readme updated
thomassth Dec 20, 2021
b4c6580
type in README fixed.
sowens-csd Dec 20, 2021
33f97e7
Merge pull request #390 from builttoroam/thomassth-patch-1
thomassth Dec 20, 2021
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
24 changes: 18 additions & 6 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@ on:
jobs:
test:
name: Build test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
with:
channel: "stable"
- run: dart --version
- run: flutter --version
- run: flutter test
- name: publish test
run: flutter pub publish --dry-run
- name: android build
run: |
cd example
flutter build appbundle
test-macos:
name: iOS build test
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -27,12 +44,7 @@ jobs:
channel: "stable"
- run: dart --version
- run: flutter --version
- run: flutter test
- name: iOS build
run: |
cd example
flutter build ios --release --no-codesign
- name: android build
run: |
cd example
flutter build appbundle
flutter build ios --release --no-codesign
13 changes: 7 additions & 6 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ jobs:
run: |
sed -i "0,/\#\# \[.*/s//## [${{steps.changelog_reader.outputs.version}}-$GITHUB_RUN_ID]/" CHANGELOG.md
cat CHANGELOG.md
- name: Setup credentials
run: |
cat <<EOF > $PUB_CACHE/credentials.json
${{ secrets.CREDENTIALS }}
EOF
- name: Publish package
uses: sakebook/[email protected]
with:
credential: ${{ secrets.CREDENTIALS }}
flutter_package: true
skip_test: false
run: flutter pub publish --force
- name: Add entry to Github release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.changelog_reader.outputs.version }}+${{ github.run_id }}
prerelease: true
prerelease: true
13 changes: 7 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@ jobs:
channel: "stable"
- run: dart --version
- run: flutter --version
- name: Setup credentials
run: |
cat <<EOF > $PUB_CACHE/credentials.json
${{ secrets.CREDENTIALS }}
EOF
- name: Publish package
uses: sakebook/[email protected]
with:
credential: ${{ secrets.CREDENTIALS }}
flutter_package: true
skip_test: false
run: flutter pub publish --force
- name: Get Changelog Entry
id: changelog_reader
uses: mindsers/[email protected]
- name: Add entry to Github release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.changelog_reader.outputs.version }}
body: ${{ steps.changelog_reader.outputs.changes }}
body: ${{ steps.changelog_reader.outputs.changes }}
33 changes: 22 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
# Changelog

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/).
<!-- 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]
## [4.1.0](https://github.com/builttoroam/device_calendar/releases/tag/4.1.0)

- Timezone plugin and logic implemented. Fixed all issues related to timezone.
- Fix: Event JSONs created are now readable.
- Fix: Compilable for Flutter 2.9+
- Fix: removed depreceated plugins from Example.
- Fix: Integration tests are now working. Android instructions are ready.
- Gradle plug-ins are updated.

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

- 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.
- Events.availability defaults to busy when not specified [354](https://github.com/builttoroam/device_calendar/pull/354)
- Events parameter now includes location and url. [319](https://github.com/builttoroam/device_calendar/pull/319)
- Android: Fixed bug where platform exception appeared, when Events.availability was null on Event [241](https://github.com/builttoroam/device_calendar/issues/241)
- Fixed example app issues [270](https://github.com/builttoroam/device_calendar/issues/270), [268](https://github.com/builttoroam/device_calendar/issues/268)
- Android code variable order fix for issue [258](https://github.com/builttoroam/device_calendar/issues/258)
- Fixed various issues in example [270](https://github.com/builttoroam/device_calendar/issues/270), [268](https://github.com/builttoroam/device_calendar/issues/268)
- Android: deleteEvent code aligned with flutter [258](https://github.com/builttoroam/device_calendar/issues/258)
- Android: Updated to V2 embeddding [326](https://github.com/builttoroam/device_calendar/issues/326)
- iOS: Updated swift versions, possibly improved compability with Obj-C [flutter/flutter#16049 (comment)](https://github.com/flutter/flutter/issues/16049#issuecomment-611192738)

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

- Migrated to null safety
- Updated multiple underlying dependencies
- Rebuilt iOS podfile
- Upgraded to new Android plugins APIs for flutter

## 3.2.0

- Added time zone support
- Project hierarchy update and clean up

## 3.1.0 25th March 2020 - Bug fixes and new features

- Boolean variable `isDefault` added for issue [145](https://github.com/builttoroam/device_calendar/issues/145) (**NOTE**: This is not supported Android API 16 or lower, `isDefault` will always be false)
Expand Down
29 changes: 17 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Device Calendar Plugin
**Your previous code will need to be modified (slightly) otherwise it will not run after update. See Timezone support for more details.**

[![pub package](https://img.shields.io/pub/v/device_calendar.svg)](https://pub.dartlang.org/packages/device_calendar) [![Build Status](https://dev.azure.com/builttoroam/Flutter%20Plugins/_apis/build/status/Device%20Calendar)](https://dev.azure.com/builttoroam/Flutter%20Plugins/_build/latest?definitionId=111)
**If you're upgrading to v4, your previous code will need to be modified (slightly) otherwise it will not run after update. See [Timezone support](https://github.com/builttoroam/device_calendar#timezone-support-with-tzdatetime) for more details.**
**There are some changes to event JSON formats at v4. Pay extra care if handld event JSONs. Directly calling to and from device calendars should be unaffected.**

[![pub package](https://img.shields.io/pub/v/device_calendar.svg)](https://pub.dartlang.org/packages/device_calendar) ![Pub Version (including pre-releases)](https://img.shields.io/pub/v/device_calendar?include_prereleases&label=Prerelease) [![build](https://github.com/builttoroam/device_calendar/actions/workflows/dart.yml/badge.svg?branch=develop)](https://github.com/builttoroam/device_calendar/actions/workflows/dart.yml)

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

Expand All @@ -23,7 +25,7 @@ A cross platform plugin for modifying calendars on the user's device.

## Timezone support with TZDateTime

Due to feedback we received, we will be utilizing `timezone` package to better handle all the timezone data.
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.

Expand All @@ -33,10 +35,10 @@ 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.

```dart
```dart
import 'package:flutter_native_timezone/flutter_native_timezone.dart';

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

Future setCurentLocation() async {
Expand All @@ -57,25 +59,27 @@ 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 migration
## Null-safety migration

From v4.0.0, device_calendar fits null safety. However, not all workflow had been checked and bugs from 3.2 still presists.
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.
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 manifest file for your application to indicate permissions to modify calendars a needed
The following will need to be added to the `AndroidManifest.xml` file for your application to indicate permissions to modify calendars are needed

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

### Proguard / R8 exceptions

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 (thanks to [Britannio Jarrett](https://github.com/britannio)). Read more about the issue [here](https://github.com/builttoroam/device_calendar/issues/99)
You may add the following setting to the ProGuard rules file `proguard-rules.pro` (thanks to [Britannio Jarrett](https://github.com/britannio)). Read more about the issue [here](https://github.com/builttoroam/device_calendar/issues/99)

```
-keep class com.builttoroam.devicecalendar.** { *; }
Expand All @@ -86,11 +90,12 @@ See [here](https://github.com/builttoroam/device_calendar/issues/99#issuecomment
For more information, refer to the guide at [Android Developer](https://developer.android.com/studio/build/shrink-code#keep-code)

### AndroidX migration
**IMPORTANT**: Since version 0.1.0, this version has migrated to use AndroidX instead of the deprecated Android support libraries. When using version 0.10.0 and onwards for this plugin, please ensure your application has been migrated following the guide [here](https://developer.android.com/jetpack/androidx/migrate)

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](https://developer.android.com/jetpack/androidx/migrate)

## iOS Integration

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

```xml
<key>NSCalendarsUsageDescription</key>
Expand Down
22 changes: 15 additions & 7 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ group 'com.builttoroam.devicecalendar'
version '1.0-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.6.0'
repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:4.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

rootProject.allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand All @@ -37,12 +37,20 @@ android {
lintOptions {
disable 'InvalidPackage'
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.code.gson:gson:2.8.5'
api 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.google.code.gson:gson:2.8.8'
api 'androidx.appcompat:appcompat:1.4.0'
implementation 'org.dmfs:lib-recur:0.11.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.5'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0'
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.builttoroam.devicecalendar
package com.builttoroam.devicecalendar

import android.Manifest
import android.annotation.SuppressLint
Expand Down Expand Up @@ -467,30 +467,30 @@ class CalendarDelegate : PluginRegistry.RequestPermissionsResultListener {
private fun buildEventContentValues(event: Event, calendarId: String): ContentValues {
val values = ContentValues()
val duration: String? = null
values.put(Events.ALL_DAY, event.allDay)
values.put(Events.ALL_DAY, event.eventAllDay)

if (event.allDay) {
if (event.eventAllDay) {
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)
calendar.set(java.util.Calendar.MILLISECOND, 0)

values.put(Events.DTSTART, calendar.timeInMillis)
values.put(Events.DTEND, calendar.timeInMillis)
values.put(Events.EVENT_TIMEZONE, getTimeZone(event.startTimeZone).id)
values.put(Events.EVENT_TIMEZONE, getTimeZone(event.eventStartTimeZone).id)
} else {
values.put(Events.DTSTART, event.start!!)
values.put(Events.EVENT_TIMEZONE, getTimeZone(event.startTimeZone).id)
values.put(Events.DTSTART, event.eventStartDate!!)
values.put(Events.EVENT_TIMEZONE, getTimeZone(event.eventStartTimeZone).id)

values.put(Events.DTEND, event.end!!)
values.put(Events.EVENT_END_TIMEZONE, getTimeZone(event.endTimeZone).id)
values.put(Events.DTEND, event.eventEndDate!!)
values.put(Events.EVENT_END_TIMEZONE, getTimeZone(event.eventEndTimeZone).id)
}
values.put(Events.TITLE, event.title)
values.put(Events.DESCRIPTION, event.description)
values.put(Events.EVENT_LOCATION, event.location)
values.put(Events.CUSTOM_APP_URI, event.url)
values.put(Events.TITLE, event.eventTitle)
values.put(Events.DESCRIPTION, event.eventDescription)
values.put(Events.EVENT_LOCATION, event.eventLocation)
values.put(Events.CUSTOM_APP_URI, event.eventURL)
values.put(Events.CALENDAR_ID, calendarId)
values.put(Events.DURATION, duration)
values.put(Events.AVAILABILITY, getAvailability(event.availability))
Expand Down Expand Up @@ -713,18 +713,18 @@ class CalendarDelegate : PluginRegistry.RequestPermissionsResultListener {
val availability = parseAvailability(cursor.getInt(EVENT_PROJECTION_AVAILABILITY_INDEX))

val event = Event()
event.title = title ?: "New Event"
event.eventTitle = title ?: "New Event"
event.eventId = eventId.toString()
event.calendarId = calendarId
event.description = description
event.start = begin
event.end = end
event.allDay = allDay
event.location = location
event.url = url
event.eventDescription = description
event.eventStartDate = begin
event.eventEndDate = end
event.eventAllDay = allDay
event.eventLocation = location
event.eventURL = url
event.recurrenceRule = parseRecurrenceRuleString(recurringRule)
event.startTimeZone = startTimeZone
event.endTimeZone = endTimeZone
event.eventStartTimeZone = startTimeZone
event.eventEndTimeZone = endTimeZone
event.availability = availability

return event
Expand Down Expand Up @@ -863,7 +863,7 @@ class CalendarDelegate : PluginRegistry.RequestPermissionsResultListener {
@Synchronized
private fun generateUniqueRequestCodeAndCacheParameters(parameters: CalendarMethodsParametersCacheModel): Int {
// TODO we can ran out of Int's at some point so this probably should re-use some of the freed ones
val uniqueRequestCode: Int = (_cachedParametersMap.keys.max() ?: 0) + 1
val uniqueRequestCode: Int = (_cachedParametersMap.keys.maxOrNull() ?: 0) + 1
parameters.ownCacheKey = uniqueRequestCode
_cachedParametersMap[uniqueRequestCode] = parameters

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,17 +164,17 @@ class DeviceCalendarPlugin() : FlutterPlugin, MethodCallHandler, ActivityAware {

private fun parseEventArgs(call: MethodCall, calendarId: String?): Event {
val event = Event()
event.title = call.argument<String>(EVENT_TITLE_ARGUMENT)
event.eventTitle = call.argument<String>(EVENT_TITLE_ARGUMENT)
event.calendarId = calendarId
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.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)
event.url = call.argument<String>(EVENT_URL_ARGUMENT)
event.eventDescription = call.argument<String>(EVENT_DESCRIPTION_ARGUMENT)
event.eventAllDay = call.argument<Boolean>(EVENT_ALL_DAY_ARGUMENT) ?: false
event.eventStartDate = call.argument<Long>(EVENT_START_DATE_ARGUMENT)!!
event.eventEndDate = call.argument<Long>(EVENT_END_DATE_ARGUMENT)!!
event.eventStartTimeZone = call.argument<String>(EVENT_START_TIMEZONE_ARGUMENT)
event.eventEndTimeZone = call.argument<String>(EVENT_END_TIMEZONE_ARGUMENT)
event.eventLocation = call.argument<String>(EVENT_LOCATION_ARGUMENT)
event.eventURL = call.argument<String>(EVENT_URL_ARGUMENT)
event.availability = parseAvailability(call.argument<String>(EVENT_AVAILABILITY_ARGUMENT))

if (call.hasArgument(RECURRENCE_RULE_ARGUMENT) && call.argument<Map<String, Any>>(RECURRENCE_RULE_ARGUMENT) != null) {
Expand Down
Loading