expo-calendar 9.2.2 → 10.0.0
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 +16 -4
- package/android/build.gradle +9 -12
- package/android/src/main/java/expo/modules/calendar/AttendeeBuilder.kt +38 -0
- package/android/src/main/java/expo/modules/calendar/CalendarEventBuilder.kt +91 -0
- package/android/src/main/java/expo/modules/calendar/CalendarModule.kt +878 -0
- package/android/src/main/java/expo/modules/calendar/CalendarPackage.kt +8 -0
- package/android/src/main/java/expo/modules/calendar/Constants.kt +91 -0
- package/android/src/main/java/expo/modules/calendar/JsValuesMappers.kt +173 -0
- package/android/src/main/java/expo/modules/calendar/ModuleDestroyedException.kt +5 -0
- package/build/Calendar.d.ts +22 -2
- package/build/Calendar.js +33 -6
- package/build/Calendar.js.map +1 -1
- package/build/ExpoCalendar.d.ts +1 -1
- package/build/ExpoCalendar.js +1 -1
- package/build/ExpoCalendar.js.map +1 -1
- package/ios/EXCalendar/EXCalendar.h +3 -3
- package/ios/EXCalendar/EXCalendar.m +79 -79
- package/ios/EXCalendar/EXCalendarConverter.m +10 -10
- package/ios/EXCalendar/EXCalendarPermissionRequester.m +5 -5
- package/ios/EXCalendar/EXRemindersPermissionRequester.m +4 -4
- package/ios/EXCalendar.podspec +2 -2
- package/package.json +5 -5
- package/src/Calendar.ts +38 -3
- package/src/ExpoCalendar.ts +1 -1
- package/android/src/main/java/expo/modules/calendar/CalendarModule.java +0 -1416
- package/android/src/main/java/expo/modules/calendar/CalendarPackage.java +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -10,13 +10,25 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## 10.0.0 — 2021-09-28
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
### 🛠 Breaking changes
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
- Dropped support for iOS 11.0 ([#14383](https://github.com/expo/expo/pull/14383) by [@cruzach](https://github.com/cruzach))
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
### 🎉 New features
|
|
20
|
+
|
|
21
|
+
- Add useCalendarPermissions and useRemindersPermissions hooks from modules factory. ([#13854](https://github.com/expo/expo/pull/13854) by [@bycedric](https://github.com/bycedric))
|
|
22
|
+
|
|
23
|
+
### 🐛 Bug fixes
|
|
24
|
+
|
|
25
|
+
- Fix building errors from use_frameworks! in Podfile. ([#14523](https://github.com/expo/expo/pull/14523) by [@kudo](https://github.com/kudo))
|
|
26
|
+
|
|
27
|
+
### 💡 Others
|
|
28
|
+
|
|
29
|
+
- 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))
|
|
30
|
+
- Migrated from `@unimodules/core` to `expo-modules-core`. ([#13756](https://github.com/expo/expo/pull/13756) by [@tsapeta](https://github.com/tsapeta))
|
|
31
|
+
- Updated `@expo/config-plugins` ([#14443](https://github.com/expo/expo/pull/14443) by [@EvanBacon](https://github.com/EvanBacon))
|
|
20
32
|
|
|
21
33
|
## 9.2.0 — 2021-06-16
|
|
22
34
|
|
package/android/build.gradle
CHANGED
|
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
|
|
|
3
3
|
apply plugin: 'maven'
|
|
4
4
|
|
|
5
5
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '
|
|
6
|
+
version = '10.0.0'
|
|
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 '
|
|
64
|
+
versionName '10.0.0'
|
|
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
|
-
|
|
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
|
+
}
|