@blotch/angular-lynx-native 22.3.1 → 22.3.3
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/README.md +47 -15
- package/dist/android/project.d.ts +114 -1
- package/dist/android/project.d.ts.map +1 -1
- package/dist/android/project.js +440 -5
- package/dist/eject.d.ts +15 -1
- package/dist/eject.d.ts.map +1 -1
- package/dist/eject.js +14 -2
- package/dist/features.d.ts +70 -0
- package/dist/features.d.ts.map +1 -0
- package/dist/features.js +115 -0
- package/dist/files.d.ts +24 -0
- package/dist/files.d.ts.map +1 -0
- package/dist/files.js +41 -0
- package/dist/generate.d.ts +34 -3
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +78 -19
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -2
- package/dist/ios/build.d.ts.map +1 -1
- package/dist/ios/build.js +8 -2
- package/dist/ios/frameworks.d.ts +6 -5
- package/dist/ios/frameworks.d.ts.map +1 -1
- package/dist/ios/frameworks.js +46 -15
- package/dist/ios/project.d.ts +192 -11
- package/dist/ios/project.d.ts.map +1 -1
- package/dist/ios/project.js +823 -33
- package/dist/options.d.ts +208 -1
- package/dist/options.d.ts.map +1 -1
- package/dist/options.js +154 -0
- package/dist/permissions.d.ts +18 -1
- package/dist/permissions.d.ts.map +1 -1
- package/dist/permissions.js +79 -4
- package/dist/plugins.d.ts +245 -0
- package/dist/plugins.d.ts.map +1 -0
- package/dist/plugins.js +1244 -0
- package/package.json +1 -1
- package/templates/android/README.md +46 -5
- package/templates/android/angular-lynx.properties +2 -0
- package/templates/android/app/build.gradle.kts +78 -11
- package/templates/android/app/src/main/AndroidManifest.xml +19 -3
- package/templates/android/app/src/main/java/dev/angularlynx/shell/AngularLynxPlugins.kt +13 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/AudioRecorderModule.kt +520 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/BarcodeScannerModule.kt +144 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/BiometricsModule.kt +433 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/BitmapPresenter.kt +98 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/BitmapRendererContext.kt +175 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/BluetoothModule.kt +1288 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/CalendarModule.kt +127 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/Canvas2DContext.kt +1557 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/Canvas2DOps.kt +63 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/CanvasFilter.kt +357 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/CanvasUI.kt +4 -3
- package/templates/android/app/src/main/java/dev/angularlynx/shell/EdgeToEdgeOverlay.kt +24 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/EngineThreadHint.kt +156 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/FilePickerModule.kt +263 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/GeolocationModule.kt +557 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/HapticsModule.kt +82 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/HostElementUI.kt +331 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/ImagePickerModule.kt +143 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/ImagePipeline.kt +83 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/MainActivity.kt +523 -9
- package/templates/android/app/src/main/java/dev/angularlynx/shell/ModuleBytes.kt +58 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/MotionModule.kt +332 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/NetworkStatus.kt +121 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/NfcModule.kt +274 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/PermissionRequests.kt +35 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/PhotoLibraryModule.kt +355 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/ShareTargetModule.kt +234 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/ShellApplication.kt +7 -8
- package/templates/android/app/src/main/java/dev/angularlynx/shell/ShellModule.kt +58 -4
- package/templates/android/app/src/main/java/dev/angularlynx/shell/StoreReviewModule.kt +66 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/SystemFontFamilies.kt +68 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/TrackingModule.kt +74 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/VideoFrameTarget.kt +429 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/VideoUI.kt +676 -0
- package/templates/android/app/src/main/java/dev/angularlynx/shell/WebGLContext.kt +128 -13
- package/templates/android/app/src/main/java/dev/angularlynx/shell/WebGLModule.kt +493 -65
- package/templates/android/app/src/main/java/dev/angularlynx/shell/WifiModule.kt +429 -0
- package/templates/android/app/src/main/res/values/biometrics.xml +9 -0
- package/templates/android/app/src/main/res/values/share_target.xml +11 -0
- package/templates/android/app/src/main/res/xml/backup_rules.xml +5 -3
- package/templates/android/app/src/main/res/xml/data_extraction_rules.xml +6 -3
- package/templates/android/app/src/main/res/xml/share_paths.xml +7 -2
- package/templates/android/build.gradle.kts +1 -1
- package/templates/android/gradle/wrapper/gradle-wrapper.properties +2 -2
- package/templates/ios/App/AngularLynxBitmapRendererContext.m +188 -0
- package/templates/ios/App/AngularLynxCanvas2DContext.m +2467 -0
- package/templates/ios/App/AngularLynxCanvas2DOps.h +61 -0
- package/templates/ios/App/AngularLynxPlugins.swift +22 -0
- package/templates/ios/App/AngularLynxVideo.h +37 -0
- package/templates/ios/App/AngularLynxVideo.m +435 -0
- package/templates/ios/App/AngularLynxWebGL.h +69 -7
- package/templates/ios/App/AngularLynxWebGL.m +538 -29
- package/templates/ios/App/AngularLynxWebGLContext.m +148 -46
- package/templates/ios/App/AnimationFrameRate.swift +66 -0
- package/templates/ios/App/AppDelegate.swift +37 -3
- package/templates/ios/App/AppleSignInButton.swift +106 -0
- package/templates/ios/App/AppleSignInModule.swift +222 -0
- package/templates/ios/App/AudioRecorderModule.swift +433 -0
- package/templates/ios/App/BarcodeScannerModule.swift +284 -0
- package/templates/ios/App/BiometricsModule.swift +256 -0
- package/templates/ios/App/BluetoothModule.swift +1086 -0
- package/templates/ios/App/CalendarModule.swift +158 -0
- package/templates/ios/App/FilePickerModule.swift +240 -0
- package/templates/ios/App/GeolocationModule.swift +455 -0
- package/templates/ios/App/HapticsModule.swift +90 -0
- package/templates/ios/App/HostElementUI.swift +270 -0
- package/templates/ios/App/ImagePickerModule.swift +160 -1
- package/templates/ios/App/Info.plist +2 -0
- package/templates/ios/App/LynxViewController.swift +274 -9
- package/templates/ios/App/MotionModule.swift +430 -0
- package/templates/ios/App/NetworkStatus.swift +41 -0
- package/templates/ios/App/NfcModule.swift +346 -0
- package/templates/ios/App/PhotoLibraryModule.swift +169 -0
- package/templates/ios/App/ShareTargetModule.swift +150 -0
- package/templates/ios/App/ShellModule.swift +17 -0
- package/templates/ios/App/StoreReviewModule.swift +61 -0
- package/templates/ios/App/TrackingModule.swift +121 -0
- package/templates/ios/App/WifiModule.swift +237 -0
- package/templates/ios/App/XElementRegistry.swift +13 -3
- package/templates/ios/ShareExtension/Info.plist +42 -0
- package/templates/ios/ShareExtension/ShareViewController.swift +387 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
package dev.angularlynx.shell
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import android.content.Context
|
|
5
|
+
import android.content.Intent
|
|
6
|
+
import android.net.Uri
|
|
7
|
+
import android.os.Handler
|
|
8
|
+
import android.os.Looper
|
|
9
|
+
import android.provider.OpenableColumns
|
|
10
|
+
import android.util.Base64
|
|
11
|
+
import android.webkit.MimeTypeMap
|
|
12
|
+
import com.lynx.jsbridge.LynxMethod
|
|
13
|
+
import com.lynx.jsbridge.LynxModule
|
|
14
|
+
import com.lynx.react.bridge.Callback
|
|
15
|
+
import com.lynx.react.bridge.JavaOnlyArray
|
|
16
|
+
import com.lynx.react.bridge.JavaOnlyMap
|
|
17
|
+
import com.lynx.react.bridge.ReadableMap
|
|
18
|
+
import com.lynx.react.bridge.ReadableType
|
|
19
|
+
import java.io.ByteArrayOutputStream
|
|
20
|
+
import java.io.IOException
|
|
21
|
+
import java.io.InputStream
|
|
22
|
+
import java.util.concurrent.Executors
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The native module behind the runtime's `LynxFilePicker`, which calls it as
|
|
26
|
+
* `NativeModules.AngularLynxFilePicker` (from the background thread, where
|
|
27
|
+
* NativeModules lives).
|
|
28
|
+
*
|
|
29
|
+
* Lynx has no `<input type="file">` and no downloads. The activity opens the
|
|
30
|
+
* system's document picker (`ACTION_OPEN_DOCUMENT`) and its save screen
|
|
31
|
+
* (`ACTION_CREATE_DOCUMENT`) instead: Downloads, Drive and the other apps'
|
|
32
|
+
* document providers. Neither needs a permission, since the app reads or
|
|
33
|
+
* writes only the document the person chose.
|
|
34
|
+
*
|
|
35
|
+
* The bytes go back and forth as base64, since the module's callback and the
|
|
36
|
+
* runtime's relay to the main thread carry only what JSON can.
|
|
37
|
+
*
|
|
38
|
+
* The generator leaves this file, and the lines in MainActivity that launch
|
|
39
|
+
* the pickers and register it, out of an app whose angular.json doesn't set
|
|
40
|
+
* `filePicker`.
|
|
41
|
+
*/
|
|
42
|
+
class FilePickerModule(context: Context, param: Any?) : LynxModule(context, param) {
|
|
43
|
+
private val host = param as Host
|
|
44
|
+
private val main = Handler(Looper.getMainLooper())
|
|
45
|
+
|
|
46
|
+
interface Host {
|
|
47
|
+
/**
|
|
48
|
+
* Starts [intent] for its result, and calls [done] once with the
|
|
49
|
+
* result code and data. Returns false, without starting it, while
|
|
50
|
+
* another is open.
|
|
51
|
+
*/
|
|
52
|
+
fun startDocumentActivity(intent: Intent, done: (Int, Intent?) -> Unit): Boolean
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Opens the document picker and calls back once with `{ files: [{ base64,
|
|
57
|
+
* name, type }] }`, `{ canceled: true }` when the person closes it, or
|
|
58
|
+
* `{ error: "too-large" | "failed", message }`, as the iOS module does.
|
|
59
|
+
*/
|
|
60
|
+
@LynxMethod
|
|
61
|
+
fun pick(options: ReadableMap, callback: Callback) {
|
|
62
|
+
val mimeTypes = mimeTypes(options)
|
|
63
|
+
val multiple = options.hasKey("multiple") && options.getBoolean("multiple")
|
|
64
|
+
// JavaScript numbers can arrive as either, so it's read as a double.
|
|
65
|
+
val maxBytes = if (options.hasKey("maxBytes")) options.getDouble("maxBytes").toLong() else Long.MAX_VALUE
|
|
66
|
+
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
|
|
67
|
+
// Only documents the app can open as a stream of bytes.
|
|
68
|
+
addCategory(Intent.CATEGORY_OPENABLE)
|
|
69
|
+
type = mimeTypes.singleOrNull() ?: "*/*"
|
|
70
|
+
if (mimeTypes.size > 1) putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes.toTypedArray())
|
|
71
|
+
putExtra(Intent.EXTRA_ALLOW_MULTIPLE, multiple)
|
|
72
|
+
}
|
|
73
|
+
start(intent, callback) { resultCode, data ->
|
|
74
|
+
val uris = if (resultCode == Activity.RESULT_OK) picked(data) else emptyList()
|
|
75
|
+
if (uris.isEmpty()) {
|
|
76
|
+
callback.invoke(JavaOnlyMap.from(mapOf("canceled" to true)))
|
|
77
|
+
} else {
|
|
78
|
+
// Reading a large document takes a moment: off the main thread.
|
|
79
|
+
worker.execute { callback.invoke(read(uris, maxBytes)) }
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Lets the person choose where to save `{ base64, name, type }`, writes it
|
|
86
|
+
* there, and calls back once with `{ saved: true }`, `{ saved: false }`
|
|
87
|
+
* when they close the screen, or `{ error: "failed", message }`.
|
|
88
|
+
*/
|
|
89
|
+
@LynxMethod
|
|
90
|
+
fun save(file: ReadableMap, callback: Callback) {
|
|
91
|
+
val base64 = file.optString("base64")
|
|
92
|
+
val bytes = try {
|
|
93
|
+
base64?.let { Base64.decode(it, Base64.DEFAULT) }
|
|
94
|
+
} catch (_: IllegalArgumentException) {
|
|
95
|
+
null
|
|
96
|
+
}
|
|
97
|
+
if (bytes == null) {
|
|
98
|
+
callback.invoke(failed("The file to save had no bytes."))
|
|
99
|
+
return
|
|
100
|
+
}
|
|
101
|
+
val intent = Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
|
|
102
|
+
addCategory(Intent.CATEGORY_OPENABLE)
|
|
103
|
+
type = file.optString("type") ?: "application/octet-stream"
|
|
104
|
+
putExtra(Intent.EXTRA_TITLE, file.optString("name") ?: "file")
|
|
105
|
+
}
|
|
106
|
+
start(intent, callback) { resultCode, data ->
|
|
107
|
+
val uri = data?.data
|
|
108
|
+
if (resultCode != Activity.RESULT_OK || uri == null) {
|
|
109
|
+
callback.invoke(JavaOnlyMap.from(mapOf("saved" to false)))
|
|
110
|
+
} else {
|
|
111
|
+
worker.execute { callback.invoke(write(uri, bytes)) }
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Starts [intent] from the activity, on the main thread: Lynx calls
|
|
118
|
+
* modules off it.
|
|
119
|
+
*/
|
|
120
|
+
private fun start(intent: Intent, callback: Callback, done: (Int, Intent?) -> Unit) {
|
|
121
|
+
main.post {
|
|
122
|
+
val opened = try {
|
|
123
|
+
host.startDocumentActivity(intent, done)
|
|
124
|
+
} catch (_: android.content.ActivityNotFoundException) {
|
|
125
|
+
callback.invoke(failed("This phone has no document picker."))
|
|
126
|
+
return@post
|
|
127
|
+
}
|
|
128
|
+
if (!opened) callback.invoke(failed("A picker is already open."))
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* The MIME types for `LynxFilePicker`'s `types`, which are given as an
|
|
134
|
+
* `<input type="file">`'s `accept`: MIME types, a family such as
|
|
135
|
+
* image's (`image/` and a star: written out, it would open a comment
|
|
136
|
+
* inside this one, since Kotlin nests them), or extensions such as
|
|
137
|
+
* `.docx`, which Android's picker
|
|
138
|
+
* doesn't take, so they're looked up. Any document when none is given or
|
|
139
|
+
* known.
|
|
140
|
+
*/
|
|
141
|
+
private fun mimeTypes(options: ReadableMap): List<String> {
|
|
142
|
+
if (!options.hasKey("types") || options.getType("types") != ReadableType.Array) return emptyList()
|
|
143
|
+
val types = options.getArray("types")
|
|
144
|
+
return (0 until types.size()).mapNotNull { index ->
|
|
145
|
+
val type = types.getString(index)
|
|
146
|
+
if (type.startsWith(".")) {
|
|
147
|
+
MimeTypeMap.getSingleton().getMimeTypeFromExtension(type.substring(1).lowercase())
|
|
148
|
+
} else {
|
|
149
|
+
type
|
|
150
|
+
}
|
|
151
|
+
}.distinct()
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** The documents picked: one in the data, or several in its ClipData. */
|
|
155
|
+
private fun picked(data: Intent?): List<Uri> {
|
|
156
|
+
val clip = data?.clipData
|
|
157
|
+
if (clip != null) return (0 until clip.itemCount).mapNotNull { clip.getItemAt(it).uri }
|
|
158
|
+
return listOfNotNull(data?.data)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* The callback's answer for the picked documents: their bytes, names and
|
|
163
|
+
* types, or too-large when they hold more than the runtime can carry,
|
|
164
|
+
* checked from the sizes their providers give before anything is read,
|
|
165
|
+
* and again as each is read.
|
|
166
|
+
*/
|
|
167
|
+
private fun read(uris: List<Uri>, maxBytes: Long): JavaOnlyMap {
|
|
168
|
+
val resolver = mContext.contentResolver
|
|
169
|
+
val documents = uris.map { uri -> Triple(uri, displayName(uri) ?: "file", size(uri)) }
|
|
170
|
+
if (documents.sumOf { it.third ?: 0L } > maxBytes) return tooLarge()
|
|
171
|
+
val files = JavaOnlyArray()
|
|
172
|
+
var remaining = maxBytes
|
|
173
|
+
for ((uri, name, _) in documents) {
|
|
174
|
+
val bytes = try {
|
|
175
|
+
resolver.openInputStream(uri)?.use { readAtMost(it, remaining) }
|
|
176
|
+
} catch (_: IOException) {
|
|
177
|
+
null
|
|
178
|
+
} catch (_: SecurityException) {
|
|
179
|
+
null
|
|
180
|
+
} ?: return failed("$name couldn't be read.")
|
|
181
|
+
// A provider needn't say a document's size, so the check above
|
|
182
|
+
// can pass one of any size: the read stops past what's left of
|
|
183
|
+
// the limit instead of holding the whole document first.
|
|
184
|
+
if (bytes.size > remaining) return tooLarge()
|
|
185
|
+
remaining -= bytes.size
|
|
186
|
+
files.pushMap(
|
|
187
|
+
JavaOnlyMap.from(
|
|
188
|
+
mapOf(
|
|
189
|
+
"base64" to Base64.encodeToString(bytes, Base64.NO_WRAP),
|
|
190
|
+
"name" to name,
|
|
191
|
+
"type" to (resolver.getType(uri) ?: "application/octet-stream"),
|
|
192
|
+
),
|
|
193
|
+
),
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
return JavaOnlyMap.from(mapOf("files" to files))
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* The stream's bytes, up to [limit] and one more: a result longer than
|
|
201
|
+
* [limit] says the document is over it, without reading the rest.
|
|
202
|
+
*/
|
|
203
|
+
private fun readAtMost(input: InputStream, limit: Long): ByteArray {
|
|
204
|
+
val output = ByteArrayOutputStream()
|
|
205
|
+
val buffer = ByteArray(64 * 1024)
|
|
206
|
+
while (output.size() <= limit) {
|
|
207
|
+
// Written so a limit of Long.MAX_VALUE can't overflow.
|
|
208
|
+
val left = limit - output.size()
|
|
209
|
+
val wanted = if (left >= buffer.size) buffer.size else (left + 1).toInt()
|
|
210
|
+
val read = input.read(buffer, 0, wanted)
|
|
211
|
+
if (read < 0) break
|
|
212
|
+
output.write(buffer, 0, read)
|
|
213
|
+
}
|
|
214
|
+
return output.toByteArray()
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
private fun tooLarge() =
|
|
218
|
+
JavaOnlyMap.from(mapOf("error" to "too-large", "message" to "The files picked are too large."))
|
|
219
|
+
|
|
220
|
+
private fun write(uri: Uri, bytes: ByteArray): JavaOnlyMap =
|
|
221
|
+
try {
|
|
222
|
+
// "wt" truncates a document the person chose to replace. A
|
|
223
|
+
// provider that can't open it gives no stream.
|
|
224
|
+
val stream = mContext.contentResolver.openOutputStream(uri, "wt")
|
|
225
|
+
if (stream == null) {
|
|
226
|
+
failed("The file couldn't be written.")
|
|
227
|
+
} else {
|
|
228
|
+
stream.use { it.write(bytes) }
|
|
229
|
+
JavaOnlyMap.from(mapOf("saved" to true))
|
|
230
|
+
}
|
|
231
|
+
} catch (error: IOException) {
|
|
232
|
+
failed(error.message ?: "The file couldn't be written.")
|
|
233
|
+
} catch (error: SecurityException) {
|
|
234
|
+
failed(error.message ?: "The file couldn't be written.")
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/** The document's name, such as `receipt.pdf`. */
|
|
238
|
+
private fun displayName(uri: Uri): String? = column(uri, OpenableColumns.DISPLAY_NAME) { getString(it) }
|
|
239
|
+
|
|
240
|
+
/** The document's size, or null when its provider doesn't say. */
|
|
241
|
+
private fun size(uri: Uri): Long? = column(uri, OpenableColumns.SIZE) { if (isNull(it)) null else getLong(it) }
|
|
242
|
+
|
|
243
|
+
private fun <T> column(uri: Uri, name: String, value: android.database.Cursor.(Int) -> T?): T? =
|
|
244
|
+
try {
|
|
245
|
+
mContext.contentResolver.query(uri, arrayOf(name), null, null, null)
|
|
246
|
+
?.use { cursor -> if (cursor.moveToFirst()) cursor.value(0) else null }
|
|
247
|
+
} catch (_: RuntimeException) {
|
|
248
|
+
null
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
private fun failed(message: String) =
|
|
252
|
+
JavaOnlyMap.from(mapOf("error" to "failed", "message" to message))
|
|
253
|
+
|
|
254
|
+
private fun ReadableMap.optString(key: String): String? =
|
|
255
|
+
if (hasKey(key) && getType(key) == ReadableType.String) getString(key) else null
|
|
256
|
+
|
|
257
|
+
companion object {
|
|
258
|
+
const val NAME = "AngularLynxFilePicker"
|
|
259
|
+
|
|
260
|
+
/** One thread for reading and writing, so two documents aren't held at once. */
|
|
261
|
+
private val worker = Executors.newSingleThreadExecutor()
|
|
262
|
+
}
|
|
263
|
+
}
|