@fto-consult/expo-ui 7.5.35 → 7.5.37

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/bin/index.js CHANGED
@@ -53,13 +53,13 @@ program.command('electron')
53
53
  .option('-b, --build [boolean]', 'si ce flag est spécfifié alors l\'application sera compilée; combinée avec la commande start|package pour indiquer que l\'application sera à nouveau exportée ou pas.')
54
54
  .option('-a, --arch [architecture]', 'l\'architecture de la plateforme; Commande package')
55
55
  .option('-p, --platform [platform]', 'la plateforme à utiliser pour la compilation; commande package')
56
- .option('-l, --logo [logoPath]', 'le chemin vers le logo de l\'application : (.ico pour window, .incs pour mac et .png pour linux)')
56
+ .option('-l, --icon [iconPath]', 'le chemin vers l\'icon de l\'application : (.ico pour window, .incs pour mac et .png pour linux)')
57
57
  .option('-i, --import [boolean]', 'la commande d\'initialisation du package electron forge, utile pour le packaging de l\'application. Elle permet d\'exécuter le cli electron package, pour l\'import d\'un projet existant. Commande package. exemple : expo-ui electron package --import')
58
58
 
59
59
  .action((script, options) => {
60
60
  const electronProjectRoot = path.resolve(projectRoot,"electron");
61
61
  const opts = Object.assign({},typeof options.opts =='function'? options.opts() : options);
62
- let {out,arch,url,build,platform,import:packageImport,logo} = opts;
62
+ let {out,arch,url,build,platform,import:packageImport,icon} = opts;
63
63
  //let {projectRoot} = opts;
64
64
  if(projectRoot == dir){
65
65
  throwError(`Invalid project root ${projectRoot}; project root must be different to ${dir}`);
@@ -78,8 +78,8 @@ program.command('electron')
78
78
  const packageObj = require(`${packagePath}`);
79
79
  const homepage = packageObj.homepage;
80
80
  let cmd = undefined;
81
- logo = logo && typeof logo =="string" && fs.existsSync(path.resolve(logo)) && logo || undefined;
82
- require("../electron/create-index-file")({electronProjectRoot,appName:packageObj.name,logo});
81
+ icon = icon && typeof icon =="string" && fs.existsSync(path.resolve(icon)) && icon || undefined;
82
+ require("../electron/create-index-file")({electronProjectRoot,appName:packageObj.name,icon});
83
83
  if(!isElectionInitialized || script =='init'){
84
84
  if(script !=='init'){
85
85
  console.log("initializing electron application before ....");
@@ -96,7 +96,7 @@ program.command('electron')
96
96
  }
97
97
  const start = x=>{
98
98
  return new Promise((resolve,reject)=>{
99
- cmd = `electron "${electronProjectRoot}" ${isValidUrl(url)? ` --url ${url}`:''}`;
99
+ cmd = `electron "${electronProjectRoot}" --root ${electronProjectRoot} ${isValidUrl(url)? ` --url ${url}`:''} ${icon ? `--icon ${path.resolve(icon)}`:""}`;
100
100
  exec({
101
101
  cmd,
102
102
  projectRoot : electronProjectRoot,
package/electron/index.js CHANGED
@@ -1,5 +1,7 @@
1
1
  const { program } = require('commander');
2
- const mainApp = require("./main-app");
2
+ const path = require("path");
3
+ const fs = require("fs");
4
+ const isValidUrl = require("./utils/isValidUrl");
3
5
 
4
6
  const debounce = require("./utils/debounce");
5
7
  const {app, BrowserWindow,Tray,Menu,MenuItem,globalShortcut,systemPreferences,powerMonitor,ipcMain,dialog, nativeTheme} = require('electron')
@@ -8,18 +10,19 @@ const {isJSON} = require("./utils/json");
8
10
 
9
11
  const isObj = x => x && typeof x =='object';
10
12
 
13
+ let appIsReady = false;
14
+
11
15
  program
12
16
  .option('-u, --url <url>', 'L\'adresse url à ouvrir au lancement de l\'application')
13
17
  .option('-r, --root <projectRoot>', 'le chemin du project root de l\'application')
18
+ .option('-l, --icon [iconPath]', 'le chemin vers le icon de l\'application : (.ico pour window, .incs pour mac et .png pour linux)')
14
19
  .parse();
15
20
 
16
21
  const programOptions = program.opts();
17
- const {url:pUrl,root:mainProjectRoot} = programOptions;
22
+ const {url:pUrl,root:mainProjectRoot,icon} = programOptions;
23
+ const iconPath = icon && typeof icon =="string" && fs.existsSync(path.resolve(icon)) && path.resolve(icon) || undefined;
18
24
 
19
25
  const isAsar = (typeof require.main =="string" && require.main ||"").indexOf('app.asar') !== -1;
20
- const path = require("path");
21
- const fs = require("fs");
22
- const isValidUrl = require("./utils/isValidUrl");
23
26
  const distPath = path.join("dist",'index.html');
24
27
 
25
28
  const processCWD = process.cwd();
@@ -31,7 +34,7 @@ const packageJSON = fs.existsSync(packageJSONPath) ? Object.assign({},require(`$
31
34
  const appName = typeof packageJSON.realAppName =='string' && packageJSON.realAppName || typeof packageJSON.name =="string" && packageJSON.name || "";
32
35
 
33
36
  // fermee automatiquement quand l'objet JavaScript sera garbage collected.
34
- let win = undefined;
37
+ let mainWindow = undefined;
35
38
 
36
39
  Menu.setApplicationMenu(null);
37
40
 
@@ -42,15 +45,7 @@ const mainProcessRequired = mainProcessIndex && require(`${mainProcessIndex}`);
42
45
  //pour étendre les fonctionnalités au niveau du main proceess, bien vouloir écrire dans le fichier projectRoot/electron/main/index.js
43
46
  const mainProcess = mainProcessRequired && typeof mainProcessRequired =='object'? mainProcessRequired : {};
44
47
 
45
- // Gardez une reference globale de l'objet window, si vous ne le faites pas, la fenetre sera
46
- if(!isValidUrl(pUrl) && !fs.existsSync(indexFilePath)){
47
- throw {message:`Unable to start the application: index file located at [${indexFilePath}] does not exists : projectRoot = [${projectRoot}], isAsar:[${require.main}]`}
48
- }
49
-
50
- const ipcMainHandleEvent = (event,callback)=>{
51
- ipcMain.removeHandler(event,callback);
52
- return ipcMain.handle(event,callback);
53
- }
48
+
54
49
  const quit = ()=>{
55
50
  try {
56
51
  app.quit();
@@ -59,6 +54,11 @@ const quit = ()=>{
59
54
  }
60
55
  }
61
56
 
57
+ // Gardez une reference globale de l'objet window, si vous ne le faites pas, la fenetre sera
58
+ if(!isValidUrl(pUrl) && !fs.existsSync(indexFilePath)){
59
+ throw {message:`Unable to start the application: index file located at [${indexFilePath}] does not exists : projectRoot = [${projectRoot}], isAsar:[${require.main}]`}
60
+ }
61
+
62
62
  //app.disableHardwareAcceleration();
63
63
 
64
64
  function createBrowserWindow (options){
@@ -85,8 +85,8 @@ function createBrowserWindow (options){
85
85
  nodeIntegration: false,
86
86
  preload: options.preload ? options.preload : null,
87
87
  }
88
- if(options.modal && !options.parent && win){
89
- options.parent = win;
88
+ if(options.modal && !options.parent && mainWindow){
89
+ options.parent = mainWindow;
90
90
  }
91
91
  if(typeof options.show ==='undefined'){
92
92
  options.show = false;
@@ -99,38 +99,54 @@ function createBrowserWindow (options){
99
99
  const opts = Object.assign({},mainProcess.beforeCreateWindow(options));
100
100
  options = {...options,...opts};
101
101
  }
102
- let _win = new BrowserWindow(options);
102
+ options.icon = options.icon || iconPath;
103
+ let window = new BrowserWindow(options);
103
104
  if(!menu){
104
- _win.setMenu(null);
105
- _win.removeMenu();
106
- _win.setMenuBarVisibility(false)
107
- _win.setAutoHideMenuBar(true)
105
+ window.setMenu(null);
106
+ window.removeMenu();
107
+ window.setMenuBarVisibility(false)
108
+ window.setAutoHideMenuBar(true)
108
109
  }
109
- const url = isValidUrl(options.loadURL) || typeof options.loadURL ==='string' && options.loadURL.trim().startsWith("file://") ? options.loadURL : undefined;
110
- if(url){
111
- _win.loadURL(url);
112
- } else if(options.file && fs.existsSync(path.resolve(options.file))){
113
- _win.loadFile(path.resolve(options.file));
114
- }
115
110
  if(showOnLoad){
116
- _win.once('ready-to-show', () => {
117
- _win.show();
118
- _win.webContents.send("window-ready-to-show",JSON.stringify(options.readyToShowOptions));
111
+ window.once('ready-to-show', () => {
112
+ window.show();
113
+ window.webContents.send("window-ready-to-show",JSON.stringify(options.readyToShowOptions));
119
114
  });
120
115
  }
121
- _win.on('closed', function() {
116
+ window.on('closed', function() {
122
117
  if(isMainWindow && typeof mainProcess?.onMainWindowClosed == "function"){
123
- mainProcess.onMainWindowClosed(_win);
118
+ mainProcess.onMainWindowClosed(window);
124
119
  }
125
- _win = null;
120
+ window = null;
126
121
  });
127
- _win.webContents.on('context-menu',clipboadContextMenu);
128
- return _win;
122
+ window.webContents.on('context-menu',clipboadContextMenu);
123
+ const url = isValidUrl(options.loadURL) || typeof options.loadURL ==='string' && options.loadURL.trim().startsWith("file://") ? options.loadURL : undefined;
124
+ if(url){
125
+ window.loadURL(url);
126
+ } else if(options.file && fs.existsSync(path.resolve(options.file))){
127
+ window.loadFile(path.resolve(options.file));
128
+ }
129
+ return window;
129
130
  }
131
+
132
+ app.whenReady().then(() => {
133
+ createWindow();
134
+ const readOpts = {toggleDevTools,browserWindow:mainWindow,mainWindow:mainWindow};
135
+ if(typeof mainProcess.whenAppReady =='function'){
136
+ mainProcess.whenAppReady(readOpts);
137
+ }
138
+ globalShortcut.register('CommandOrControl+F12', () => {
139
+ return toggleDevTools();
140
+ });
141
+ app.on('activate', function () {
142
+ if (mainWindow == null || (BrowserWindow.getAllWindows().length === 0)) createWindow()
143
+ });
144
+ appIsReady = true;
145
+ });
130
146
 
131
147
  function createWindow () {
132
148
  // Créer le browser window
133
- win = createBrowserWindow({
149
+ mainWindow = createBrowserWindow({
134
150
  showOnLoad : false,
135
151
  loadURL : undefined,
136
152
  isMainWindow : true,
@@ -149,54 +165,54 @@ function createWindow () {
149
165
  || (mainProcess.splashScreen instanceof BrowserWindow) && mainProcess.splashScreen;
150
166
  null;
151
167
  let hasInitWindows = false;
152
- win.on('show', () => {
153
- //win.blur();
168
+ mainWindow.on('show', () => {
169
+ //mainWindow.blur();
154
170
  setTimeout(() => {
155
- win.focus();
156
- win.moveTop();
157
- win.webContents.focus();
171
+ mainWindow.focus();
172
+ mainWindow.moveTop();
173
+ mainWindow.webContents.focus();
158
174
  if(!hasInitWindows){
159
175
  hasInitWindows = true;
160
- win.webContents.send('appReady');
176
+ mainWindow.webContents.send('appReady');
161
177
  }
162
178
  }, 200);
163
179
  });
164
180
 
165
- win.on("focus",()=>{
166
- if(win && hasInitWindows){
167
- win.webContents.send("main-window-focus");
181
+ mainWindow.on("focus",()=>{
182
+ if(mainWindow && hasInitWindows){
183
+ mainWindow.webContents.send("main-window-focus");
168
184
  }
169
185
  });
170
- win.on("blur",()=>{
171
- if(win && hasInitWindows){
172
- win.webContents.send("main-window-blur");
186
+ mainWindow.on("blur",()=>{
187
+ if(mainWindow && hasInitWindows){
188
+ mainWindow.webContents.send("main-window-blur");
173
189
  }
174
190
  });
175
- win.once("ready-to-show",function(){
191
+ mainWindow.once("ready-to-show",function(){
176
192
  if(typeof mainProcess.onMainWindowReadyToShow ==='function'){
177
- mainProcess.onMainWindowReadyToShow(win);
193
+ mainProcess.onMainWindowReadyToShow(mainWindow);
178
194
  }
179
- win.minimize()
195
+ mainWindow.minimize()
180
196
  try {
181
197
  if(splash && splash instanceof BrowserWindow){
182
198
  splash.destroy();
183
199
  }
184
200
  } catch{ }
185
- win.restore();
186
- win.show();
201
+ mainWindow.restore();
202
+ mainWindow.show();
187
203
  })
188
204
 
189
- win.on('close', (e) => {
190
- if (win) {
205
+ mainWindow.on('close', (e) => {
206
+ if (mainWindow) {
191
207
  if(typeof mainProcess.onMainWindowClose == "function"){
192
- mainProcess.onMainWindowClose(win);
208
+ mainProcess.onMainWindowClose(mainWindow);
193
209
  }
194
210
  e.preventDefault();
195
- win.webContents.send('before-app-exit');
211
+ mainWindow.webContents.send('before-app-exit');
196
212
  }
197
213
  });
198
214
 
199
- win.on('unresponsive', async () => {
215
+ mainWindow.on('unresponsive', async () => {
200
216
  const { response } = await dialog.showMessageBox({
201
217
  title: "L'application a cessé de répondre",
202
218
  message : 'Voulez vous relancer l\'application?',
@@ -204,19 +220,19 @@ function createWindow () {
204
220
  cancelId: 1
205
221
  });
206
222
  if (response === 0) {
207
- win.forcefullyCrashRenderer()
208
- win.reload()
223
+ mainWindow.forcefullyCrashRenderer()
224
+ mainWindow.reload()
209
225
  } else {
210
- win.forcefullyCrashRenderer()
226
+ mainWindow.forcefullyCrashRenderer()
211
227
  app.exit();
212
228
  }
213
229
  });
214
230
 
215
231
  // Émit lorsque la fenêtre est fermée.
216
- win.on('closed', () => {
217
- win = null
232
+ mainWindow.on('closed', () => {
233
+ mainWindow = null
218
234
  })
219
- win.setMenu(null);
235
+ mainWindow.setMenu(null);
220
236
 
221
237
  /*** les dimenssions de la fenêtre principale */
222
238
  let mWindowSessinName = "mainWindowSizes";
@@ -231,45 +247,45 @@ function createWindow () {
231
247
  }
232
248
  let isNumber = x => typeof x =="number";
233
249
  if(isNumber(sizeW.width) && isNumber(sizeW.height)){
234
- win.setSize(sizeW.width,sizeW.height);
250
+ mainWindow.setSize(sizeW.width,sizeW.height);
235
251
  if(isNumber(sPositions.x) && isNumber(sPositions.y)){
236
- win.setPosition(sPositions.x,sPositions.y);
252
+ mainWindow.setPosition(sPositions.x,sPositions.y);
237
253
  }
238
254
  }
239
255
  const onWinResizeEv = debounce(function () {
240
- if(win){
241
- let wSize = win.getSize();
256
+ if(mainWindow){
257
+ let wSize = mainWindow.getSize();
242
258
  if(Array.isArray(wSize) && wSize.length == 2){
243
259
  let [width,height] = wSize;
244
260
  if(width && height){
245
261
  session.set(mWindowSessinName,{width,height});
246
262
  }
247
- let [x,y] = win.getPosition();
263
+ let [x,y] = mainWindow.getPosition();
248
264
  session.set(mWindowPositionSName,{x,y});
249
265
  }
250
266
  }
251
267
  }, 100);
252
- win.off('resize',onWinResizeEv);
253
- win.on('resize',onWinResizeEv);
254
- win.off('move',onWinResizeEv);
255
- win.on('move',onWinResizeEv);
268
+ mainWindow.off('resize',onWinResizeEv);
269
+ mainWindow.on('resize',onWinResizeEv);
270
+ mainWindow.off('move',onWinResizeEv);
271
+ mainWindow.on('move',onWinResizeEv);
256
272
  if(typeof mainProcess.onCreateMainWindow =='function'){
257
- mainProcess.onCreateMainWindow(win);
273
+ mainProcess.onCreateMainWindow(mainWindow);
258
274
  }
259
- return win;
260
- }
275
+ return mainWindow;
276
+ }
261
277
 
262
278
  const toggleDevTools = (value)=>{
263
- if(win !==null && win.webContents){
264
- const isOpen= win.webContents.isDevToolsOpened();
279
+ if(mainWindow !==null && mainWindow.webContents){
280
+ const isOpen= mainWindow.webContents.isDevToolsOpened();
265
281
  value = value === undefined ? !isOpen : value;
266
282
  if(value && !isOpen){
267
- win.webContents.openDevTools();
268
- return win.webContents.isDevToolsOpened();
283
+ mainWindow.webContents.openDevTools();
284
+ return mainWindow.webContents.isDevToolsOpened();
269
285
  } else {
270
- if(isOpen) win.webContents.closeDevTools();
286
+ if(isOpen) mainWindow.webContents.closeDevTools();
271
287
  }
272
- return win.webContents.isDevToolsOpened();
288
+ return mainWindow.webContents.isDevToolsOpened();
273
289
  }
274
290
  return false;
275
291
  }
@@ -311,7 +327,7 @@ function createWindow () {
311
327
  contextMenu.map((m,index)=>{
312
328
  if(!m || typeof m !=='object') return;
313
329
  m.click = (e)=>{
314
- if(win && win.webContents) win.webContents.send("click-on-system-tray-menu-item",{
330
+ if(mainWindow && mainWindow.webContents) mainWindow.webContents.send("click-on-system-tray-menu-item",{
315
331
  action : m.action && typeof m.action =='string'? m.action : undefined,
316
332
  index,
317
333
  menuItem : JSON.stringify(m),
@@ -359,11 +375,11 @@ function createWindow () {
359
375
  });
360
376
 
361
377
  ipcMain.on("get-app-icon",(event)=>{
362
- event.returnValue = win != win && win.getIcon && win.getIcon();
378
+ event.returnValue = mainWindow != mainWindow && mainWindow.getIcon && mainWindow.getIcon();
363
379
  });
364
380
  ipcMain.on("set-app-icon",(event,iconPath)=>{
365
- if(iconPath && win != null){
366
- win.setIcon(iconPath);
381
+ if(iconPath && mainWindow != null){
382
+ mainWindow.setIcon(iconPath);
367
383
  event.returnValue = iconPath;
368
384
  } else {
369
385
  event.returnValue = null;
@@ -371,27 +387,27 @@ function createWindow () {
371
387
  });
372
388
 
373
389
  ipcMain.on('minimize-main-window', () => {
374
- if(win !== null && win){
375
- win.blur();
376
- win.minimize();
390
+ if(mainWindow !== null && mainWindow){
391
+ mainWindow.blur();
392
+ mainWindow.minimize();
377
393
  }
378
394
  })
379
395
  ipcMain.on('restore-main-window', () => {
380
- if(win && win !== null){
381
- win.restore()
382
- win.blur();
396
+ if(mainWindow && mainWindow !== null){
397
+ mainWindow.restore()
398
+ mainWindow.blur();
383
399
  setTimeout(() => {
384
- win.focus();
385
- win.moveTop();
386
- win.webContents.focus();
400
+ mainWindow.focus();
401
+ mainWindow.moveTop();
402
+ mainWindow.webContents.focus();
387
403
  }, 200);
388
404
  }
389
405
  })
390
406
  ipcMain.on('close-main-render-process', _ => {
391
- if(win){
392
- win.destroy();
407
+ if(mainWindow){
408
+ mainWindow.destroy();
393
409
  }
394
- win = null;
410
+ mainWindow = null;
395
411
  if(typeof gc =="function"){
396
412
  gc();
397
413
  }
@@ -399,13 +415,13 @@ function createWindow () {
399
415
  });
400
416
 
401
417
  const powerMonitorCallbackEvent = (action)=>{
402
- if(!win || !win.webContents) return;
418
+ if(!mainWindow || !mainWindow.webContents) return;
403
419
  if(action =="suspend" || action =="lock-screen"){
404
- win.webContents.send("main-app-suspended",action);
420
+ mainWindow.webContents.send("main-app-suspended",action);
405
421
  return;
406
422
  }
407
- win.webContents.send("main-app-restaured",action);
408
- win.webContents.focus();
423
+ mainWindow.webContents.send("main-app-restaured",action);
424
+ mainWindow.webContents.focus();
409
425
  return null;
410
426
  }
411
427
  if(powerMonitor){
@@ -416,8 +432,8 @@ function createWindow () {
416
432
  })
417
433
  }
418
434
  ipcMain.on("set-main-window-title",(event,title)=>{
419
- if(win !== null){
420
- win.setTitle(title);
435
+ if(mainWindow !== null){
436
+ mainWindow.setTitle(title);
421
437
  }
422
438
  });
423
439
 
@@ -431,19 +447,19 @@ function createWindow () {
431
447
  if(!isObj(options)){
432
448
  options = {};
433
449
  }
434
- return dialog.showOpenDialog(win,options)
450
+ return dialog.showOpenDialog(mainWindow,options)
435
451
  })
436
452
 
437
453
  ipcMain.handle("show-save-dialog",function(event,options){
438
454
  if(!isObj(options)){
439
455
  options = {};
440
456
  }
441
- return dialog.showSaveDialog(win,options)
457
+ return dialog.showSaveDialog(mainWindow,options)
442
458
  });
443
459
 
444
460
  ipcMain.on("is-dev-tools-open",function(event,value) {
445
- if(win !==null && win.webContents){
446
- return win.webContents.isDevToolsOpened();
461
+ if(mainWindow !==null && mainWindow.webContents){
462
+ return mainWindow.webContents.isDevToolsOpened();
447
463
  }
448
464
  return false;
449
465
  });
@@ -451,12 +467,13 @@ function createWindow () {
451
467
  ipcMain.on("window-set-progressbar",(event,interval)=>{
452
468
  if(typeof interval !="number" || interval <0) interval = 0;
453
469
  interval = Math.floor(interval);
454
- if(win){
455
- win.setProgressBar(interval);
470
+ if(mainWindow){
471
+ mainWindow.setProgressBar(interval);
456
472
  }
457
- })
473
+ });
458
474
 
459
- const setOSTheme = (theme) => {
475
+ /**** customisation des thèmes de l'application */
476
+ ipcMain.handle('set-system-theme:toggle', (event,theme) => {
460
477
  theme = theme && typeof theme == "string"? theme : "light";
461
478
  theme = theme.toLowerCase().trim();
462
479
  if(theme !== 'system' && theme !=='dark'){
@@ -465,11 +482,6 @@ function createWindow () {
465
482
  nativeTheme.themeSource = theme;
466
483
  session.set("os-theme",theme);
467
484
  return nativeTheme.shouldUseDarkColors
468
- }
469
-
470
- /**** customisation des thèmes de l'application */
471
- ipcMain.handle('set-system-theme:toggle', (event,theme) => {
472
- return setOSTheme(theme);
473
485
  });
474
486
 
475
487
  ipcMain.handle('set-system-theme:dark-mode', (event) => {
@@ -519,31 +531,19 @@ app.on('window-all-closed', () => {
519
531
  quit();
520
532
  }
521
533
  });
522
-
523
- const gotTheLock = app.requestSingleInstanceLock()
524
- if (!gotTheLock) {
525
- quit()
526
- } else {
527
- app.on('second-instance', (event, commandLine, workingDirectory) => {
528
- // Someone tried to run a second instance, we should focus our window.
529
- //pour plus tard il sera possible d'afficher la gestion multi fenêtre en environnement electron
530
- if (win) {
531
- if (win.isMinimized()) win.restore()
532
- win.focus()
533
- }
534
- })
535
- }
536
-
537
- app.whenReady().then(() => {
538
- createWindow();
539
- const readOpts = {toggleDevTools,browserWindow:win,mainWindow:win};
540
- if(typeof mainProcess.whenAppReady =='function'){
541
- mainProcess.whenAppReady(readOpts);
534
+
535
+ if(mainProcess.enableSingleInstance !== false){
536
+ const gotTheLock = app.requestSingleInstanceLock()
537
+ if (appIsReady && !gotTheLock) {
538
+ quit();
539
+ } else {
540
+ app.on('second-instance', (event, commandLine, workingDirectory) => {
541
+ // Someone tried to run a second instance, we should focus our window.
542
+ //pour plus tard il sera possible d'afficher la gestion multi fenêtre en environnement electron
543
+ if (mainWindow) {
544
+ if (mainWindow.isMinimized()) mainWindow.restore()
545
+ mainWindow.focus()
546
+ }
547
+ })
542
548
  }
543
- globalShortcut.register('CommandOrControl+F12', () => {
544
- return toggleDevTools();
545
- });
546
- app.on('activate', function () {
547
- if (win == null || (BrowserWindow.getAllWindows().length === 0)) createWindow()
548
- });
549
- });
549
+ }
@@ -8,6 +8,7 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
+ enableSingleInstance: true, // si l'application n'autorise qu'une seule instance active. ça sous entend qu'à l'instant t, une seule instance de l'application ne peut être exécutée sur le profil de l'utilisateur lambda
11
12
  /**** cette fonction est appelée à chaque fois que l'on désire créer une instance du BrowserWindow
12
13
  @param {object} BrowserWindowOptions
13
14
  Lors de la création de la fenêtre principal, BrowserWindowOptions continent la propriété isMainWindow à true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fto-consult/expo-ui",
3
- "version": "7.5.35",
3
+ "version": "7.5.37",
4
4
  "description": "Bibliothèque de composants UI Expo,react-native",
5
5
  "scripts": {
6
6
  "clear-npx-cache": "npx clear-npx-cache",