mg-library 1.0.575 → 1.0.576

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.
Files changed (2) hide show
  1. package/blocks.js +19 -181
  2. package/package.json +1 -1
package/blocks.js CHANGED
@@ -189,21 +189,6 @@ export function MGLogin(props) {
189
189
 
190
190
  let cardFooter = (
191
191
  <View>
192
- {/* <Button
193
- accessoryRight={loginIcon}
194
- onPress={handleSubmit((data) => {
195
- props.setNavigator(undefined);
196
- mgLoginLib.onPressLogin(
197
- props.dispatch,
198
- props.actions,
199
- props.app,
200
- props.apiUrl,
201
- props.language,
202
- data);
203
- })}>
204
- {mgFunctionsLib.i18nString('login', props.language)}
205
- </Button> */}
206
-
207
192
  <NBButton
208
193
  py={4} colorScheme="primary"
209
194
  leftIcon={
@@ -223,7 +208,6 @@ export function MGLogin(props) {
223
208
  {mgFunctionsLib.i18nString('login', props.language)}
224
209
  </MGText>
225
210
  </NBButton>
226
-
227
211
  </View>
228
212
  );
229
213
 
@@ -377,170 +361,6 @@ function getHeightForCamera() {
377
361
  return Dimensions.get('window').height;
378
362
  }
379
363
 
380
- /* export function MGCamera(props) {
381
- let camera;
382
- let captureWidth = 0;
383
- let captureHeight = 0;
384
- try {
385
- captureWidth = Math.floor(getWidthForCamera() * 0.47);
386
- captureHeight = Math.floor(getHeightForCamera() * 0.31);
387
- } catch (error) {
388
- captureWidth = 205;
389
- captureHeight = 275;
390
- }
391
- const __takePicture = async () => {
392
- if (!camera)
393
- return;
394
- let photo = await camera.takePictureAsync({ quality: 1 });
395
- props.dispatch(props.actions.startProcessing());
396
- photo = await ImageManipulator.manipulateAsync(
397
- photo.uri,
398
- [{ resize: { width: captureWidth, height: captureHeight } }],
399
- { compress: 1, format: ImageManipulator.SaveFormat.JPEG }
400
- );
401
- photo = await ImageManipulator.manipulateAsync(
402
- photo.uri,
403
- [{ flip: 'horizontal' }],
404
- { compress: 1, format: ImageManipulator.SaveFormat.JPEG }
405
- );
406
- props.process.fileUri = photo.uri;
407
- props.process.goForward(props.nextStep);
408
- props.dispatch(props.actions.endProcessing());
409
- }
410
- const [facing, setFacing] = useState(mgConstantsLib.CAMERA_FACING_FRONT);
411
- const FlipIcon = () => (
412
- <MaterialCommunityIcons
413
- name='camera-flip-outline'
414
- size={30}
415
- style={{ color: 'white' }} />
416
- );
417
- const TakeIcon = () => (
418
- <MaterialCommunityIcons
419
- name='camera-outline'
420
- size={30}
421
- style={{ color: 'white' }} />
422
- );
423
- const cardHeader = (
424
- <View style={{ marginLeft: 15, marginTop: 10, marginBottom: 10 }}>
425
- <MGText category='h6'>{mgFunctionsLib.i18nString('photo', props.language)}</MGText>
426
- <MGText>{mgFunctionsLib.i18nString('takePhoto', props.language)}</MGText>
427
- </View>
428
- );
429
- const cardFooter = (
430
- <View>
431
- <View style={{ flexDirection: 'row' }}>
432
- <View style={{ flex: 1, alignItems: 'center' }}>
433
- <Button
434
- style={{ width: 150 }}
435
- status='primary'
436
- accessoryLeft={FlipIcon}
437
- onPress={() => {
438
- setFacing(
439
- facing === mgConstantsLib.CAMERA_FACING_BACK ? mgConstantsLib.CAMERA_FACING_FRONT : mgConstantsLib.CAMERA_FACING_BACK
440
- )
441
- }}>
442
- <MGText>{mgFunctionsLib.i18nString('doInvertCamera', props.language)}</MGText>
443
- </Button>
444
- </View>
445
- <View style={{ flex: 1, alignItems: 'center' }}>
446
- <Button
447
- style={{ width: 150 }}
448
- status='primary'
449
- accessoryLeft={TakeIcon}
450
- onPress={__takePicture}>
451
- <MGText>{mgFunctionsLib.i18nString('doTakePhoto', props.language)}</MGText>
452
- </Button>
453
- </View>
454
- </View>
455
- </View>
456
- );
457
- return (
458
- <View>
459
- <Card header={cardHeader} footer={cardFooter}>
460
- <View style={{ alignItems: 'center' }}>
461
- <CameraView
462
- style={{ width: captureWidth, height: captureHeight }}
463
- facing={facing}
464
- ref={(r) => {
465
- camera = r
466
- }}>
467
- </CameraView>
468
- </View>
469
- </Card>
470
- </View>
471
- )
472
- }
473
-
474
- export function MGCameraPreview(props) {
475
- let fileName = 'photo-' + Math.random().toString(36).substring(7) + '-' + Math.random().toString(36).substring(7);
476
- const __savePicture = async () => {
477
- const asset = {
478
- uri: props.process.fileUri,
479
- name: fileName,
480
- type: 'image/jpg'
481
- }
482
- uploadFile(asset, { publicKey: props.mediaAppPublicKey })
483
- .then((file) => {
484
- let fileUUID = file.uuid;
485
- let requestData = props.requestData;
486
- requestData.photoMediaAppId = fileUUID;
487
- requestData.photoMediaAppFileName = fileName;
488
- props.dispatch(props.actions.apiSuccess());
489
- props.dispatch(props.actions.apiRequest());
490
- axios.post(props.url, requestData, mgFunctionsLib.getRequestHeader())
491
- .then(response => {
492
- props.onSavePicture(response.data.photoUrl);
493
- props.dispatch(props.actions.apiSuccess());
494
- })
495
- .catch(error => {
496
- props.dispatch(props.actions.apiError());
497
- mgFunctionsLib.showToastError(error);
498
- })
499
- })
500
- .catch(error => {
501
- props.dispatch(props.actions.apiError());
502
- mgFunctionsLib.showToastError(error);
503
- })
504
- }
505
- const SaveIcon = () => (
506
- <MaterialCommunityIcons
507
- name='cloud-upload-outline'
508
- size={40}
509
- style={{ color: 'white' }} />
510
- );
511
- const cardHeader = (
512
- <View style={{ marginLeft: 15, marginTop: 10, marginBottom: 10 }}>
513
- <MGText category='h6'>{mgFunctionsLib.i18nString('photo', props.language)}</MGText>
514
- <MGText>{mgFunctionsLib.i18nString('previewPhoto', props.language)}</MGText>
515
- </View>
516
- );
517
- const cardFooter = (
518
- <View>
519
- <View style={{ flexDirection: 'row' }}>
520
- <View style={{ flex: 1, alignItems: 'center' }}>
521
- <Button
522
- style={{ width: 150 }}
523
- status='primary'
524
- accessoryLeft={SaveIcon}
525
- onPress={__savePicture}>
526
- <MGText>{mgFunctionsLib.i18nString('doSavePhoto', props.language)}</MGText>
527
- </Button>
528
- </View>
529
- </View>
530
- </View>
531
- );
532
- return (
533
- <View>
534
- <Card header={cardHeader} footer={cardFooter}>
535
- <View style={{ alignItems: 'center' }}>
536
- <Image source={{ uri: props.process.fileUri }} style={{ width: 200, height: 200 }} />
537
- </View>
538
- </Card>
539
- </View>
540
- )
541
- }
542
- */
543
-
544
364
  export function MGCamera(props) {
545
365
  let camera;
546
366
  let captureWidth = 0;
@@ -716,7 +536,7 @@ export function MGCameraPreview(props) {
716
536
  )
717
537
  }
718
538
 
719
- export function MGButton(props) {
539
+ /* export function MGButton(props) {
720
540
  const icon = () => (
721
541
  <MaterialCommunityIcons
722
542
  name={props.icon}
@@ -735,6 +555,24 @@ export function MGButton(props) {
735
555
  </Button>
736
556
  </>
737
557
  )
558
+ } */
559
+
560
+ export function MGButton(props) {
561
+ return (
562
+ <>
563
+ <NBButton py={4} colorScheme='primary'
564
+ leftIcon={
565
+ <NBIcon as={MaterialCommunityIcons} name={props.icon} size='lg' color='white' />
566
+ }
567
+ onPress={props.callback}>
568
+ {!mgFunctionsLib.isEmpty(props.title) &&
569
+ <MGText category="p1" color="white">
570
+ {props.title}
571
+ </MGText>
572
+ }
573
+ </NBButton>
574
+ </>
575
+ )
738
576
  }
739
577
 
740
578
  export function MGPopover(props) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mg-library",
3
- "version": "1.0.575",
3
+ "version": "1.0.576",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {