From 7502b0356c15675ffee4256359b7d978c8dcc368 Mon Sep 17 00:00:00 2001 From: JOASSART Edwin Date: Fri, 24 Mar 2023 09:29:33 +0100 Subject: [PATCH] patch: prevent disabling screensaver on non pro install --- lib/gui/app/i18n/zh-TW.ts | 6 +++--- lib/gui/app/models/flash-state.ts | 16 ++++++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/gui/app/i18n/zh-TW.ts b/lib/gui/app/i18n/zh-TW.ts index 98b63a44..d1a16201 100644 --- a/lib/gui/app/i18n/zh-TW.ts +++ b/lib/gui/app/i18n/zh-TW.ts @@ -46,7 +46,8 @@ const translation = { drive: '磁碟', missingPartitionTable: '看起來這不是一個可啟動的{{type}}。\n\n這個{{type}}似乎不包含分割表,因此您的設備可能無法識別或無法正確啟動。', - largeDriveSize: '這是個很大容量的磁碟!請檢查並確認它不包含對您來說存放很重要的資料', + largeDriveSize: + '這是個很大容量的磁碟!請檢查並確認它不包含對您來說存放很重要的資料', systemDrive: '選擇系統分割區很危險,因為這將會刪除你的系統', sourceDrive: '來源映像檔位於這個分割區中', noSpace: '磁碟空間不足。請插入另一個較大的磁碟並重試。', @@ -130,8 +131,7 @@ const translation = { autoUpdate: '自動更新', settings: '軟體設定', systemInformation: '系統資訊', - trimExtPartitions: - '修改原始映像檔上未分配的空間(在 ext 類型分割區中)', + trimExtPartitions: '修改原始映像檔上未分配的空間(在 ext 類型分割區中)', }, menu: { edit: '編輯', diff --git a/lib/gui/app/models/flash-state.ts b/lib/gui/app/models/flash-state.ts index faa1a4a1..75500619 100644 --- a/lib/gui/app/models/flash-state.ts +++ b/lib/gui/app/models/flash-state.ts @@ -20,6 +20,7 @@ import * as _ from 'lodash'; import { DrivelistDrive } from '../../../shared/drive-constraints'; import { bytesToMegabytes } from '../../../shared/units'; import { Actions, store } from './store'; +import { etcherProInfo } from '../utils/etcher-pro-specific'; /** * @summary Reset flash state @@ -47,12 +48,15 @@ export function isFlashing(): boolean { */ export function setFlashingFlag() { // see https://github.com/balenablocks/balena-electron-env/blob/4fce9c461f294d4a768db8f247eea6f75d7b08b0/README.md#remote-methods - try { - electron.ipcRenderer.invoke('disable-screensaver'); - } catch (error) { - console.log( - "Can't disable-screensaver, we're probably not running on a balena-electron env", - ); + if (etcherProInfo()?.uuid) { + try { + console.log(etcherProInfo()?.uuid); + electron.ipcRenderer.invoke('disable-screensaver'); + } catch (error) { + console.log( + "Can't disable-screensaver, we're probably not running on a balena-electron env", + ); + } } store.dispatch({ type: Actions.SET_FLASHING_FLAG,