also looking at this
feat(android): getCalendarEvents and createCalendarEvent in Zig — ratchet 86 → 84
#158
7 files
+1167
-20
| @@ -2274,6 +2274,10 @@ class CraftBridge( | ||
| 2274 | 2274 | |
| 2275 | 2275 | @JavascriptInterface |
| 2276 | 2276 | 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 | ||
| 2277 | 2281 | if (ContextCompat.checkSelfPermission(activity, Manifest.permission.READ_CALENDAR) |
| 2278 | 2282 | != PackageManager.PERMISSION_GRANTED) { |
| 2279 | 2283 | ActivityCompat.requestPermissions(activity, arrayOf(Manifest.permission.READ_CALENDAR), REQUEST_CALENDAR) |
| @@ -2327,6 +2331,10 @@ class CraftBridge( | ||
| 2327 | 2331 | |
| 2328 | 2332 | @JavascriptInterface |
| 2329 | 2333 | 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 | ||
| 2330 | 2338 | if (ContextCompat.checkSelfPermission(activity, Manifest.permission.WRITE_CALENDAR) |
| 2331 | 2339 | != PackageManager.PERMISSION_GRANTED) { |
| 2332 | 2340 | ActivityCompat.requestPermissions(activity, arrayOf(Manifest.permission.WRITE_CALENDAR), REQUEST_CALENDAR) |