also looking at this
feat(android): the contacts pair in Zig — ratchet 79 → 77
#166
7 files
+974
-3
| @@ -2141,6 +2141,10 @@ class CraftBridge( | ||
| 2141 | 2141 | |
| 2142 | 2142 | @JavascriptInterface |
| 2143 | 2143 | fun getContacts() { |
| 2144 | // Zig answers through the reply channel, so returning here is what | |
| 2145 | // stops the promise being settled twice. | |
| 2146 | if (CraftNative.getContacts(activity)) return | |
| 2147 | ||
| 2144 | 2148 | if (ContextCompat.checkSelfPermission(activity, Manifest.permission.READ_CONTACTS) |
| 2145 | 2149 | != PackageManager.PERMISSION_GRANTED) { |
| 2146 | 2150 | ActivityCompat.requestPermissions(activity, arrayOf(Manifest.permission.READ_CONTACTS), REQUEST_CONTACTS) |
| @@ -2212,6 +2216,10 @@ class CraftBridge( | ||
| 2212 | 2216 | |
| 2213 | 2217 | @JavascriptInterface |
| 2214 | 2218 | fun addContact(contactJson: String) { |
| 2219 | // Zig answers through the reply channel, so returning here is what | |
| 2220 | // stops the promise being settled twice. | |
| 2221 | if (CraftNative.addContact(activity, contactJson)) return | |
| 2222 | ||
| 2215 | 2223 | if (ContextCompat.checkSelfPermission(activity, Manifest.permission.WRITE_CONTACTS) |
| 2216 | 2224 | != PackageManager.PERMISSION_GRANTED) { |
| 2217 | 2225 | ActivityCompat.requestPermissions(activity, arrayOf(Manifest.permission.WRITE_CONTACTS), REQUEST_CONTACTS) |