@fto-consult/expo-ui 7.5.35 → 7.5.36

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