@fto-consult/expo-ui 8.38.0 → 8.39.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "8.38.0",
3
+ "version": "8.39.0",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "scripts": {
6
6
  "clear-npx-cache": "npx clear-npx-cache",
@@ -68,7 +68,7 @@
68
68
  "dependencies": {
69
69
  "@emotion/react": "^11.11.1",
70
70
  "@faker-js/faker": "^8.0.2",
71
- "@fto-consult/common": "^4.34.0",
71
+ "@fto-consult/common": "^4.35.9",
72
72
  "@fto-consult/node-utils": "^1.7.1",
73
73
  "apexcharts": "^3.47.0",
74
74
  "crypto-browserify": "^3.12.0",
@@ -1,6 +1,5 @@
1
1
  const FileSaver = require('file-saver');
2
- import {defaultNumber,postWebviewMessage} from "$cutils";
3
- import {isReactNativeWebview} from "$cplatform";
2
+ import {defaultNumber,postWebviewMessage,canPostWebviewMessage,logRNWebview,WEBVIEW_SAVE_FILE_EVENT} from "$cutils";
4
3
 
5
4
  /***
6
5
  sauvegarde par défaut un fichier blob
@@ -8,16 +7,18 @@ import {isReactNativeWebview} from "$cplatform";
8
7
  export const save = ({content,fileName,mimeType,contentType,isBase64,timeout,delay})=>{
9
8
  return new Promise((resolve,reject)=>{
10
9
  try {
11
- if(isReactNativeWebview()){
12
- postWebviewMessage("FILE_SAVER_SAVE_FILE",{
10
+ if(canPostWebviewMessage()){
11
+ logRNWebview("SAVE RN FILE FROM WEBVIEWddd ",fileName,mimeType,contentType);
12
+ postWebviewMessage(WEBVIEW_SAVE_FILE_EVENT,{
13
13
  content,
14
14
  fileName,
15
15
  contentType,
16
16
  mimeType,
17
17
  isBase64,
18
18
  });
19
+ } else {
20
+ FileSaver.saveAs(content, fileName);
19
21
  }
20
- FileSaver.saveAs(content, fileName);
21
22
  setTimeout(() => {
22
23
  resolve({path:fileName,isWeb : true});
23
24
  }, defaultNumber(timeout,delay,3000));
@@ -1,7 +1,7 @@
1
1
  // Copyright 2022 @fto-consult/Boris Fouomene. All rights reserved.
2
2
  // Use of this source code is governed by a BSD-style
3
3
  // license that can be found in the LICENSE file.
4
- import {defaultStr,base64toBlob,dataURLToBlob,getTypeFromDataURL,isNonNullString,getFileName,getFileExtension,defaultNumber,defaultBool,dataURLToBase64,isBlob,isBase64,isDataURL} from "$cutils";
4
+ import {defaultStr,base64toBlob,dataURLToBlob,getTypeFromDataURL,isNonNullString,getFileName,getFileExtension,defaultNumber,defaultBool,dataURLToBase64,isBlob,isBase64,isDataURL,canPostWebviewMessage} from "$cutils";
5
5
  const mime = require('react-native-mime-types')
6
6
  const XLSX = require("xlsx");
7
7
  import Preloader from "$preloader";
@@ -70,7 +70,7 @@ export const writeExcel = ({workbook,content,contentType,fileName,...rest})=>{
70
70
  if(isBlob(content)){
71
71
  return write({...rest,content,fileName,contentType}).finally(Preloader.close)
72
72
  }
73
- if(isNative){
73
+ if(isNative || canPostWebviewMessage()){
74
74
  return FileSaver.save({...rest,content:XLSX.write(workbook, {type:'base64', bookType:ext}),fileName}).finally(Preloader.close).finally(Preloader.close);
75
75
  }
76
76
  return new Promise((resolve,reject)=>{
@@ -1,7 +1,7 @@
1
1
  import {isElectron} from "$cplatform";
2
2
  import electronPrint from "./print.electron";
3
3
  import {isTouchDevice} from "$cplatform";
4
- import {canPostWebviewMessage,postWebviewMessage} from "$cutils/webview";
4
+ import {canPostWebviewMessage,postWebviewMessage,logRNWebview,WEBVIEW_SAVE_FILE_EVENT} from "$cutils/rn-webview";
5
5
  import {defaultStr,getFileExtension} from "$cutils";
6
6
  import DateLib from "$clib/date";
7
7
  export default function print(pdfMakeInstance,options,...rest){
@@ -18,7 +18,8 @@ export default function print(pdfMakeInstance,options,...rest){
18
18
  if(!ext || ext.toLowerCase() !=="pdf"){
19
19
  fileName+=".pdf";
20
20
  }
21
- return postWebviewMessage("FILE_SAVER_SAVE_FILE",{
21
+ logRNWebview("printing pdf file",options?.fileName);
22
+ return postWebviewMessage(WEBVIEW_SAVE_FILE_EVENT,{
22
23
  content,
23
24
  contentType : 'application/pdf',
24
25
  fileName,
@@ -1,7 +1,7 @@
1
1
  module.exports = {
2
2
  "@fto-consult/expo-ui": {
3
3
  "name": "@fto-consult/expo-ui",
4
- "version": "8.37.0",
4
+ "version": "8.38.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/borispipo/expo-ui.git"
@@ -34,7 +34,7 @@ module.exports = {
34
34
  "license": "MIT"
35
35
  },
36
36
  "@fto-consult/common": {
37
- "version": "4.34.0",
37
+ "version": "4.35.0",
38
38
  "url": "https://github.com/borispipo/common#readme",
39
39
  "license": "ISC"
40
40
  },