also looking at this
feat(android): the shared-item trio in Zig — ratchet 82 → 79
#161
6 files
+463
-3
| @@ -3333,6 +3333,10 @@ class CraftBridge( | ||
| 3333 | 3333 | |
| 3334 | 3334 | @JavascriptInterface |
| 3335 | 3335 | fun setSharedItem(key: String, value: String, group: String) { |
| 3336 | // Zig answers through the reply channel, so returning here is what | |
| 3337 | // stops the promise being settled twice. | |
| 3338 | if (CraftNative.setSharedItem(activity, key, value, group)) return | |
| 3339 | ||
| 3336 | 3340 | try { |
| 3337 | 3341 | val prefsName = if (group.isNotEmpty()) "craft_shared_$group" else "craft_shared" |
| 3338 | 3342 | val prefs = activity.getSharedPreferences(prefsName, Context.MODE_PRIVATE) |
| @@ -3356,6 +3360,10 @@ class CraftBridge( | ||
| 3356 | 3360 | |
| 3357 | 3361 | @JavascriptInterface |
| 3358 | 3362 | fun getSharedItem(key: String, group: String) { |
| 3363 | // Zig answers through the reply channel, so returning here is what | |
| 3364 | // stops the promise being settled twice. | |
| 3365 | if (CraftNative.getSharedItem(activity, key, group)) return | |
| 3366 | ||
| 3359 | 3367 | try { |
| 3360 | 3368 | val prefsName = if (group.isNotEmpty()) "craft_shared_$group" else "craft_shared" |
| 3361 | 3369 | val prefs = activity.getSharedPreferences(prefsName, Context.MODE_PRIVATE) |
| @@ -3386,6 +3394,10 @@ class CraftBridge( | ||
| 3386 | 3394 | |
| 3387 | 3395 | @JavascriptInterface |
| 3388 | 3396 | fun removeSharedItem(key: String, group: String) { |
| 3397 | // Zig answers through the reply channel, so returning here is what | |
| 3398 | // stops the promise being settled twice. | |
| 3399 | if (CraftNative.removeSharedItem(activity, key, group)) return | |
| 3400 | ||
| 3389 | 3401 | try { |
| 3390 | 3402 | val prefsName = if (group.isNotEmpty()) "craft_shared_$group" else "craft_shared" |
| 3391 | 3403 | val prefs = activity.getSharedPreferences(prefsName, Context.MODE_PRIVATE) |