expo-calendar 9.2.2 → 10.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,14 +10,38 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
- ## 9.2.2 — 2021-06-24
13
+ ## 10.0.3 — 2021-10-21
14
14
 
15
15
  _This version does not introduce any user-facing changes._
16
16
 
17
- ## 9.2.1 — 2021-06-22
17
+ ## 10.0.2 — 2021-10-15
18
18
 
19
19
  _This version does not introduce any user-facing changes._
20
20
 
21
+ ## 10.0.1 — 2021-10-01
22
+
23
+ _This version does not introduce any user-facing changes._
24
+
25
+ ## 10.0.0 — 2021-09-28
26
+
27
+ ### 🛠 Breaking changes
28
+
29
+ - Dropped support for iOS 11.0 ([#14383](https://github.com/expo/expo/pull/14383) by [@cruzach](https://github.com/cruzach))
30
+
31
+ ### 🎉 New features
32
+
33
+ - Add useCalendarPermissions and useRemindersPermissions hooks from modules factory. ([#13854](https://github.com/expo/expo/pull/13854) by [@bycedric](https://github.com/bycedric))
34
+
35
+ ### 🐛 Bug fixes
36
+
37
+ - Fix building errors from use_frameworks! in Podfile. ([#14523](https://github.com/expo/expo/pull/14523) by [@kudo](https://github.com/kudo))
38
+
39
+ ### 💡 Others
40
+
41
+ - Rewrote from Java to Kotlin, migrated from `AsyncTask` to `kotlinx.coroutines`. ([#13527](https://github.com/expo/expo/pull/13527) by [@M1ST4KE](https://github.com/M1ST4KE))
42
+ - Migrated from `@unimodules/core` to `expo-modules-core`. ([#13756](https://github.com/expo/expo/pull/13756) by [@tsapeta](https://github.com/tsapeta))
43
+ - Updated `@expo/config-plugins` ([#14443](https://github.com/expo/expo/pull/14443) by [@EvanBacon](https://github.com/EvanBacon))
44
+
21
45
  ## 9.2.0 — 2021-06-16
22
46
 
23
47
  ### 🐛 Bug fixes
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '9.2.2'
6
+ version = '10.0.3'
7
7
 
8
8
  buildscript {
9
9
  // Simple helper that allows the root project to override versions declared by this library.
@@ -53,28 +53,25 @@ android {
53
53
  targetCompatibility JavaVersion.VERSION_1_8
54
54
  }
55
55
 
56
+ kotlinOptions {
57
+ jvmTarget = JavaVersion.VERSION_1_8
58
+ }
59
+
56
60
  defaultConfig {
57
61
  minSdkVersion safeExtGet("minSdkVersion", 21)
58
62
  targetSdkVersion safeExtGet("targetSdkVersion", 30)
59
63
  versionCode 17
60
- versionName '9.2.2'
64
+ versionName '10.0.3'
61
65
  }
62
66
  lintOptions {
63
67
  abortOnError false
64
68
  }
65
69
  }
66
70
 
67
- if (new File(rootProject.projectDir.parentFile, 'package.json').exists()) {
68
- apply from: project(':unimodules-core').file('../unimodules-core.gradle')
69
- } else {
70
- throw new GradleException(
71
- '\'unimodules-core.gradle\' was not found in the usual React Native dependency location. ' +
72
- 'This package can only be used in such projects. Are you sure you\'ve installed the dependencies properly?')
73
- }
74
-
75
71
  dependencies {
76
- unimodule 'unimodules-core'
77
- unimodule 'expo-modules-core'
72
+ implementation project(':expo-modules-core')
78
73
 
79
74
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${safeExtGet('kotlinVersion', '1.4.21')}"
75
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3")
76
+ implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1")
80
77
  }
@@ -0,0 +1,38 @@
1
+ package expo.modules.calendar
2
+
3
+ import android.content.ContentValues
4
+ import expo.modules.core.arguments.ReadableArguments
5
+
6
+ class AttendeeBuilder(
7
+ private val attendeeDetails: ReadableArguments
8
+ ) {
9
+ private val attendeeValues = ContentValues()
10
+
11
+ fun put(key: String, value: Int?) = apply {
12
+ attendeeValues.put(key, value)
13
+ }
14
+
15
+ fun putString(detailsKey: String, detailsString: String) = apply {
16
+ if (attendeeDetails.containsKey(detailsKey)) {
17
+ attendeeValues.put(detailsString, attendeeDetails.getString(detailsKey))
18
+ }
19
+ }
20
+
21
+ fun putString(detailsKey: String, detailsString: String, isRequired: Boolean) = apply {
22
+ if (attendeeDetails.containsKey(detailsKey)) {
23
+ attendeeValues.put(detailsString, attendeeDetails.getString(detailsKey))
24
+ } else if (isRequired) {
25
+ throw Exception("new attendees require `$detailsKey`")
26
+ }
27
+ }
28
+
29
+ fun putString(detailsKey: String, detailsString: String, isRequired: Boolean?, mapper: (String) -> Int) = apply {
30
+ if (attendeeDetails.containsKey(detailsKey)) {
31
+ attendeeValues.put(detailsString, mapper(attendeeDetails.getString(detailsKey)))
32
+ } else if (isRequired == true) {
33
+ throw Exception("new attendees require `$detailsKey`")
34
+ }
35
+ }
36
+
37
+ fun build() = attendeeValues
38
+ }
@@ -0,0 +1,91 @@
1
+ package expo.modules.calendar
2
+
3
+ import android.content.ContentValues
4
+ import android.text.TextUtils
5
+ import expo.modules.core.arguments.ReadableArguments
6
+ import java.util.*
7
+
8
+ class CalendarEventBuilder(
9
+ private val eventDetails: ReadableArguments
10
+ ) {
11
+ private val eventValues = ContentValues()
12
+
13
+ fun getAsLong(key: String): Long = eventValues.getAsLong(key)
14
+
15
+ fun put(key: String, value: String) = apply {
16
+ eventValues.put(key, value)
17
+ }
18
+
19
+ fun put(key: String, value: Int) = apply {
20
+ eventValues.put(key, value)
21
+ }
22
+
23
+ fun put(key: String, value: Long) = apply {
24
+ eventValues.put(key, value)
25
+ }
26
+
27
+ fun put(key: String, value: Boolean) = apply {
28
+ eventValues.put(key, value)
29
+ }
30
+
31
+ fun putNull(key: String) = apply {
32
+ eventValues.putNull(key)
33
+ }
34
+
35
+ fun checkIfContainsRequiredKeys(vararg keys: String) = apply {
36
+ keys.forEach { checkDetailsContainsRequiredKey(it) }
37
+ }
38
+
39
+ fun putEventString(eventKey: String, detailsKey: String) = apply {
40
+ if (eventDetails.containsKey(detailsKey)) {
41
+ eventValues.put(eventKey, eventDetails.getString(detailsKey))
42
+ }
43
+ }
44
+
45
+ fun putEventString(eventKey: String, detailsKey: String, mapper: (String) -> Int) = apply {
46
+ if (eventDetails.containsKey(detailsKey)) {
47
+ eventValues.put(eventKey, mapper(eventDetails.getString(detailsKey)))
48
+ }
49
+ }
50
+
51
+ fun putEventBoolean(eventKey: String, detailsKey: String) = apply {
52
+ if (eventDetails.containsKey(detailsKey)) {
53
+ eventValues.put(eventKey, if (eventDetails.getBoolean(detailsKey)) 1 else 0)
54
+ }
55
+ }
56
+
57
+ fun putEventBoolean(eventKey: String, detailsKey: String, value: Boolean) = apply {
58
+ if (eventDetails.containsKey(detailsKey)) {
59
+ eventValues.put(eventKey, value)
60
+ }
61
+ }
62
+
63
+ fun putEventTimeZone(eventKey: String, detailsKey: String) = apply {
64
+ eventValues.put(
65
+ eventKey,
66
+ if (eventDetails.containsKey(detailsKey)) {
67
+ eventDetails.getString(detailsKey)
68
+ } else {
69
+ TimeZone.getDefault().id
70
+ }
71
+ )
72
+ }
73
+
74
+ fun <OutputListItemType> putEventDetailsList(eventKey: String, detailsKey: String, mappingMethod: (Any?) -> OutputListItemType) = apply {
75
+ if (eventDetails.containsKey(eventKey)) {
76
+ val array = eventDetails.getList(eventKey)
77
+ val values = array.map {
78
+ mappingMethod(it)
79
+ }
80
+ eventValues.put(detailsKey, TextUtils.join(",", values))
81
+ }
82
+ }
83
+
84
+ private fun checkDetailsContainsRequiredKey(key: String) = apply {
85
+ if (!eventDetails.containsKey(key)) {
86
+ throw Exception("new calendars require $key")
87
+ }
88
+ }
89
+
90
+ fun build() = eventValues
91
+ }