Merge pull request #14248 from vector-im/t3chguy/download_toast
Show a download completed toast in electronpull/14299/head
commit
e0ab2bb96e
|
@ -8,6 +8,9 @@
|
|||
"Invalid JSON": "Invalid JSON",
|
||||
"Unable to load config file: please refresh the page to try again.": "Unable to load config file: please refresh the page to try again.",
|
||||
"Unexpected error preparing the app. See console for details.": "Unexpected error preparing the app. See console for details.",
|
||||
"Download Completed": "Download Completed",
|
||||
"Open": "Open",
|
||||
"Dismiss": "Dismiss",
|
||||
"Open user settings": "Open user settings",
|
||||
"Previous/next recently visited room or community": "Previous/next recently visited room or community",
|
||||
"Riot Desktop (%(platformName)s)": "Riot Desktop (%(platformName)s)",
|
||||
|
@ -18,7 +21,6 @@
|
|||
"powered by Matrix": "powered by Matrix",
|
||||
"Custom Server Options": "Custom Server Options",
|
||||
"You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use Riot with an existing Matrix account on a different homeserver.": "You can use the custom server options to sign into other Matrix servers by specifying a different homeserver URL. This allows you to use Riot with an existing Matrix account on a different homeserver.",
|
||||
"Dismiss": "Dismiss",
|
||||
"Unsupported browser": "Unsupported browser",
|
||||
"Your browser can't run Riot": "Your browser can't run Riot",
|
||||
"Riot uses advanced browser features which aren't supported by your current browser.": "Riot uses advanced browser features which aren't supported by your current browser.",
|
||||
|
|
|
@ -45,6 +45,8 @@ import {Action} from "matrix-react-sdk/src/dispatcher/actions";
|
|||
import {ActionPayload} from "matrix-react-sdk/src/dispatcher/payloads";
|
||||
import {showToast as showUpdateToast} from "matrix-react-sdk/src/toasts/UpdateToast";
|
||||
import {CheckUpdatesPayload} from "matrix-react-sdk/src/dispatcher/payloads/CheckUpdatesPayload";
|
||||
import ToastStore from "matrix-react-sdk/src/stores/ToastStore";
|
||||
import GenericExpiringToast from "matrix-react-sdk/src/components/views/toasts/GenericExpiringToast";
|
||||
|
||||
const ipcRenderer = window.ipcRenderer;
|
||||
const isMac = navigator.platform.toUpperCase().includes('MAC');
|
||||
|
@ -247,6 +249,26 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
|||
dis.fire(Action.ViewUserSettings);
|
||||
});
|
||||
|
||||
ipcRenderer.on('userDownloadCompleted', (ev, {path, name}) => {
|
||||
const onAccept = () => {
|
||||
ipcRenderer.send('userDownloadOpen', {path});
|
||||
};
|
||||
|
||||
ToastStore.sharedInstance().addOrReplaceToast({
|
||||
key: `DOWNLOAD_TOAST_${path}`,
|
||||
title: _t("Download Completed"),
|
||||
props: {
|
||||
description: name,
|
||||
acceptLabel: _t("Open"),
|
||||
onAccept,
|
||||
dismissLabel: _t("Dismiss"),
|
||||
numSeconds: 10,
|
||||
},
|
||||
component: GenericExpiringToast,
|
||||
priority: 99,
|
||||
});
|
||||
});
|
||||
|
||||
// register OS-specific shortcuts
|
||||
if (isMac) {
|
||||
registerShortcut(Categories.NAVIGATION, {
|
||||
|
|
Loading…
Reference in New Issue