patch: prevent disabling screensaver on non pro install

This commit is contained in:
JOASSART Edwin 2023-03-24 09:29:33 +01:00
parent 6fae328f1f
commit 7502b0356c
2 changed files with 13 additions and 9 deletions

View File

@ -46,7 +46,8 @@ const translation = {
drive: '磁碟', drive: '磁碟',
missingPartitionTable: missingPartitionTable:
'看起來這不是一個可啟動的{{type}}。\n\n這個{{type}}似乎不包含分割表,因此您的設備可能無法識別或無法正確啟動。', '看起來這不是一個可啟動的{{type}}。\n\n這個{{type}}似乎不包含分割表,因此您的設備可能無法識別或無法正確啟動。',
largeDriveSize: '這是個很大容量的磁碟!請檢查並確認它不包含對您來說存放很重要的資料', largeDriveSize:
'這是個很大容量的磁碟!請檢查並確認它不包含對您來說存放很重要的資料',
systemDrive: '選擇系統分割區很危險,因為這將會刪除你的系統', systemDrive: '選擇系統分割區很危險,因為這將會刪除你的系統',
sourceDrive: '來源映像檔位於這個分割區中', sourceDrive: '來源映像檔位於這個分割區中',
noSpace: '磁碟空間不足。請插入另一個較大的磁碟並重試。', noSpace: '磁碟空間不足。請插入另一個較大的磁碟並重試。',
@ -130,8 +131,7 @@ const translation = {
autoUpdate: '自動更新', autoUpdate: '自動更新',
settings: '軟體設定', settings: '軟體設定',
systemInformation: '系統資訊', systemInformation: '系統資訊',
trimExtPartitions: trimExtPartitions: '修改原始映像檔上未分配的空間(在 ext 類型分割區中)',
'修改原始映像檔上未分配的空間(在 ext 類型分割區中)',
}, },
menu: { menu: {
edit: '編輯', edit: '編輯',

View File

@ -20,6 +20,7 @@ import * as _ from 'lodash';
import { DrivelistDrive } from '../../../shared/drive-constraints'; import { DrivelistDrive } from '../../../shared/drive-constraints';
import { bytesToMegabytes } from '../../../shared/units'; import { bytesToMegabytes } from '../../../shared/units';
import { Actions, store } from './store'; import { Actions, store } from './store';
import { etcherProInfo } from '../utils/etcher-pro-specific';
/** /**
* @summary Reset flash state * @summary Reset flash state
@ -47,12 +48,15 @@ export function isFlashing(): boolean {
*/ */
export function setFlashingFlag() { export function setFlashingFlag() {
// see https://github.com/balenablocks/balena-electron-env/blob/4fce9c461f294d4a768db8f247eea6f75d7b08b0/README.md#remote-methods // see https://github.com/balenablocks/balena-electron-env/blob/4fce9c461f294d4a768db8f247eea6f75d7b08b0/README.md#remote-methods
try { if (etcherProInfo()?.uuid) {
electron.ipcRenderer.invoke('disable-screensaver'); try {
} catch (error) { console.log(etcherProInfo()?.uuid);
console.log( electron.ipcRenderer.invoke('disable-screensaver');
"Can't disable-screensaver, we're probably not running on a balena-electron env", } catch (error) {
); console.log(
"Can't disable-screensaver, we're probably not running on a balena-electron env",
);
}
} }
store.dispatch({ store.dispatch({
type: Actions.SET_FLASHING_FLAG, type: Actions.SET_FLASHING_FLAG,