@@ -112,11 +112,21 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
112
112
setFilterMaxFileSize(it)
113
113
}
114
114
115
-
116
115
isDisplayCamera(config.camera != null )
117
116
118
117
config.camera?.let {
119
- setCameraInterceptListener(CameraEngine (appContext, it))
118
+ val cameraConfig = NitroCameraConfig (
119
+ mediaType = MediaType .ALL ,
120
+ presentation = Presentation .FULLSCREENMODAL ,
121
+ language = Language .SYSTEM ,
122
+ crop = null ,
123
+ isSaveSystemAlbum = false ,
124
+ color = config.primaryColor,
125
+ cameraDevice = it.cameraDevice,
126
+ videoMaximumDuration = it.videoMaximumDuration
127
+ )
128
+
129
+ setCameraInterceptListener(CameraEngine (appContext, cameraConfig))
120
130
}
121
131
}
122
132
.setImageSpanCount(config.numberOfColumn?.toInt() ? : 3 )
@@ -314,31 +324,44 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
314
324
resolved : (result: CameraResult ) -> Unit ,
315
325
rejected : (reject: Double ) -> Unit
316
326
) {
327
+ val activity = currentActivity
317
328
val chooseMode = getChooseMode(config.mediaType)
318
- val cameraConfig = PickerCameraConfig (
319
- cameraDevice = config.cameraDevice,
320
- videoMaximumDuration = config.videoMaximumDuration
321
- )
322
329
323
330
PictureSelector
324
- .create(currentActivity )
331
+ .create(activity )
325
332
.openCamera(chooseMode)
326
333
.setLanguage(getLanguage(config.language))
334
+ .setCameraInterceptListener(CameraEngine (appContext, config))
327
335
.isQuickCapture(true )
328
- .setCropEngine(CropEngine (cropOption))
329
- // .setOfAllCameraType(chooseMode)
330
- .setCameraInterceptListener(CameraEngine (appContext, cameraConfig))
331
- .forResult(object : OnResultCallbackListener <LocalMedia ?> {
332
- override fun onResult (result : java.util.ArrayList <LocalMedia ?>? ) {
333
- println (" camera: $result " )
336
+ .isOriginalControl(true )
337
+ .apply {
338
+ if (config.crop != null ) {
339
+ setCropEngine(CropEngine (cropOption))
340
+ }
341
+ }
342
+ .forResultActivity(object : OnResultCallbackListener <LocalMedia ?> {
343
+ override fun onResult (results : java.util.ArrayList <LocalMedia ?>? ) {
344
+ results?.first()?.let {
345
+ val result = getResult(it)
346
+
347
+ resolved(
348
+ CameraResult (
349
+ path = result.path,
350
+ type = result.type,
351
+ width = result.width,
352
+ height = result.height,
353
+ duration = result.duration,
354
+ thumbnail = result.thumbnail,
355
+ fileName = result.fileName
356
+ )
357
+ )
358
+ }
334
359
}
335
360
336
361
override fun onCancel () {
337
- TODO ( " Not yet implemented " )
362
+ // rejected(0.0 )
338
363
}
339
-
340
364
})
341
-
342
365
}
343
366
344
367
private fun getChooseMode (mediaType : MediaType ): Int {
@@ -558,7 +581,6 @@ class MultipleImagePickerImp(reactContext: ReactApplicationContext?) :
558
581
height = item.cropImageHeight.toDouble()
559
582
}
560
583
561
-
562
584
val media = Result (
563
585
localIdentifier = item.id.toString(),
564
586
width,
0 commit comments