ReviewOS

also looking at this

craft-native/craft

feat(android): getCalendarEvents and createCalendarEvent in Zig — ratchet 86 → 84

#158
Merged glennmichael123 wants to merge feat/android-calendar-events into main
7 files +1167 -20
packages/android/templates/CraftBridge.kt.templatemodified+8-0
Changes to packages/android/templates/CraftBridge.kt.template
@@ -2274,6 +2274,10 @@ class CraftBridge(
22742274
22752275 @JavascriptInterface
22762276 fun getCalendarEvents(startDateMs: Long, endDateMs: Long) {
2277 // Zig answers through the reply channel, so returning here is what
2278 // stops the promise being settled twice.
2279 if (CraftNative.getCalendarEvents(activity, startDateMs, endDateMs)) return
2280
22772281 if (ContextCompat.checkSelfPermission(activity, Manifest.permission.READ_CALENDAR)
22782282 != PackageManager.PERMISSION_GRANTED) {
22792283 ActivityCompat.requestPermissions(activity, arrayOf(Manifest.permission.READ_CALENDAR), REQUEST_CALENDAR)
@@ -2327,6 +2331,10 @@ class CraftBridge(
23272331
23282332 @JavascriptInterface
23292333 fun createCalendarEvent(eventJson: String) {
2334 // Zig answers through the reply channel, so returning here is what
2335 // stops the promise being settled twice.
2336 if (CraftNative.createCalendarEvent(activity, eventJson)) return
2337
23302338 if (ContextCompat.checkSelfPermission(activity, Manifest.permission.WRITE_CALENDAR)
23312339 != PackageManager.PERMISSION_GRANTED) {
23322340 ActivityCompat.requestPermissions(activity, arrayOf(Manifest.permission.WRITE_CALENDAR), REQUEST_CALENDAR)