mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-25 07:47:18 +00:00
Add successBannerURL setting
Change-type: patch
This commit is contained in:
parent
1c52379ee3
commit
e58cfd89c5
@ -20,6 +20,7 @@ import { v4 as uuidV4 } from 'uuid';
|
|||||||
|
|
||||||
import * as flashState from '../../models/flash-state';
|
import * as flashState from '../../models/flash-state';
|
||||||
import * as selectionState from '../../models/selection-state';
|
import * as selectionState from '../../models/selection-state';
|
||||||
|
import * as settings from '../../models/settings';
|
||||||
import { Actions, store } from '../../models/store';
|
import { Actions, store } from '../../models/store';
|
||||||
import * as analytics from '../../modules/analytics';
|
import * as analytics from '../../modules/analytics';
|
||||||
import { FlashAnother } from '../flash-another/flash-another';
|
import { FlashAnother } from '../flash-another/flash-another';
|
||||||
@ -39,8 +40,19 @@ function restart(goToMain: () => void) {
|
|||||||
goToMain();
|
goToMain();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getSuccessBannerURL() {
|
||||||
|
return (
|
||||||
|
(await settings.get('successBannerURL')) ??
|
||||||
|
'https://www.balena.io/etcher/success-banner?borderTop=false&darkBackground=true'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function FinishPage({ goToMain }: { goToMain: () => void }) {
|
function FinishPage({ goToMain }: { goToMain: () => void }) {
|
||||||
const [webviewShowing, setWebviewShowing] = React.useState(false);
|
const [webviewShowing, setWebviewShowing] = React.useState(false);
|
||||||
|
const [successBannerURL, setSuccessBannerURL] = React.useState('');
|
||||||
|
(async () => {
|
||||||
|
setSuccessBannerURL(await getSuccessBannerURL());
|
||||||
|
})();
|
||||||
const flashResults = flashState.getFlashResults();
|
const flashResults = flashState.getFlashResults();
|
||||||
const errors: FlashError[] = (
|
const errors: FlashError[] = (
|
||||||
store.getState().toJS().failedDeviceErrors || []
|
store.getState().toJS().failedDeviceErrors || []
|
||||||
@ -96,8 +108,9 @@ function FinishPage({ goToMain }: { goToMain: () => void }) {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
{successBannerURL.length && (
|
||||||
<SafeWebview
|
<SafeWebview
|
||||||
src="https://www.balena.io/etcher/success-banner?borderTop=false&darkBackground=true"
|
src={successBannerURL}
|
||||||
onWebviewShow={setWebviewShowing}
|
onWebviewShow={setWebviewShowing}
|
||||||
style={{
|
style={{
|
||||||
display: webviewShowing ? 'flex' : 'none',
|
display: webviewShowing ? 'flex' : 'none',
|
||||||
@ -108,6 +121,7 @@ function FinishPage({ goToMain }: { goToMain: () => void }) {
|
|||||||
height: '100vh',
|
height: '100vh',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user