diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2024-05-30 09:20:48 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2024-05-31 10:17:06 +0200 |
| commit | 4650984b64d0aba0ff4c63aece6844dce3825e4b (patch) | |
| tree | d700d047037829fb5abddb38b1570f963e7b84a7 /gui/src/renderer | |
| parent | 71d3cfa59f80dbe51b987f23b84a4a13a9eb01f5 (diff) | |
| download | mullvadvpn-4650984b64d0aba0ff4c63aece6844dce3825e4b.tar.xz mullvadvpn-4650984b64d0aba0ff4c63aece6844dce3825e4b.zip | |
Show error and troubleshoot dialog when lacking full disk access
Diffstat (limited to 'gui/src/renderer')
| -rw-r--r-- | gui/src/renderer/app.tsx | 4 | ||||
| -rw-r--r-- | gui/src/renderer/components/NotificationArea.tsx | 40 |
2 files changed, 35 insertions, 9 deletions
diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx index 3aa73698dc..e62d65358e 100644 --- a/gui/src/renderer/app.tsx +++ b/gui/src/renderer/app.tsx @@ -529,6 +529,10 @@ export default class AppRenderer { await IpcRendererEventChannel.app.showLaunchDaemonSettings(); } + public showFullDiskAccessSettings = async () => { + await IpcRendererEventChannel.app.showFullDiskAccessSettings(); + }; + public async sendProblemReport( email: string, message: string, diff --git a/gui/src/renderer/components/NotificationArea.tsx b/gui/src/renderer/components/NotificationArea.tsx index a2a89bcd84..79c234f71f 100644 --- a/gui/src/renderer/components/NotificationArea.tsx +++ b/gui/src/renderer/components/NotificationArea.tsx @@ -43,6 +43,8 @@ interface IProps { } export default function NotificationArea(props: IProps) { + const { showFullDiskAccessSettings } = useAppContext(); + const account = useSelector((state: IReduxState) => state.account); const locale = useSelector((state: IReduxState) => state.userInterface.locale); const tunnelState = useSelector((state: IReduxState) => state.connection.status); @@ -65,7 +67,7 @@ export default function NotificationArea(props: IProps) { blockWhenDisconnected, hasExcludedApps, }), - new ErrorNotificationProvider({ tunnelState, hasExcludedApps }), + new ErrorNotificationProvider({ tunnelState, hasExcludedApps, showFullDiskAccessSettings }), new InconsistentVersionNotificationProvider({ consistent: version.consistent }), new UnsupportedVersionNotificationProvider(version), ]; @@ -168,20 +170,40 @@ function NotificationActionWrapper(props: INotificationActionWrapperProps) { } } + const problemReportButton = troubleshootInfo?.buttons ? ( + <AppButton.BlueButton key="problem-report" onClick={goToProblemReport}> + {messages.pgettext('in-app-notifications', 'Send problem report')} + </AppButton.BlueButton> + ) : ( + <AppButton.GreenButton key="problem-report" onClick={goToProblemReport}> + {messages.pgettext('in-app-notifications', 'Send problem report')} + </AppButton.GreenButton> + ); + + let buttons = [ + problemReportButton, + <AppButton.BlueButton key="back" onClick={closeTroubleshootInfo}> + {messages.gettext('Back')} + </AppButton.BlueButton>, + ]; + + if (troubleshootInfo?.buttons) { + const actionButtons = troubleshootInfo.buttons.map((button) => ( + <AppButton.GreenButton key={button.label} onClick={button.action}> + {button.label} + </AppButton.GreenButton> + )); + + buttons = actionButtons.concat(buttons); + } + return ( <> <NotificationActions>{actionComponent}</NotificationActions> <ModalAlert isOpen={troubleshootInfo !== undefined} type={ModalAlertType.info} - buttons={[ - <AppButton.GreenButton key="problem-report" onClick={goToProblemReport}> - {messages.pgettext('in-app-notifications', 'Send problem report')} - </AppButton.GreenButton>, - <AppButton.BlueButton key="back" onClick={closeTroubleshootInfo}> - {messages.gettext('Back')} - </AppButton.BlueButton>, - ]} + buttons={buttons} close={closeTroubleshootInfo}> <ModalMessage>{troubleshootInfo?.details}</ModalMessage> <ModalMessage> |
