Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/components/App/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import TopBar from '../TopBar';
import ClippedDrawer from '../ClippedDrawer';
import UpdateDialog from '../UpdateDialog';
import {
openWebSite, setError, setLoading, setUpdate,
openWebSite, setCheckedForUpdates, setError, setLoading, setUpdate,
} from '../../reducers/MainReducer/Actions';
import Updater from '../../utils/Updater';
import AlertDialog from '../AlertDialog';
Expand All @@ -36,6 +36,7 @@ const App = () => {
const [state, d1] = useContext(MainContext);
const {
themeIndex, themeType, update, languageIndex, autoUpdate, error, loading,
checkedForUpdates,
} = state;

const [snackOpen, setSnackOpen] = useState(false);
Expand Down Expand Up @@ -93,6 +94,13 @@ const App = () => {
setSnackOpen(false);
};

/**
* Close the dialog that displays a message that no updates are available
*/
const closeNoUpdate = () => {
d1(setCheckedForUpdates(false));
};

useEffect(() => {
// eslint-disable-next-line no-underscore-dangle
if (window.__TAURI__) {
Expand Down Expand Up @@ -136,6 +144,7 @@ const App = () => {
onClose={closeAlertDialog}
/>
) : null}
{/* eslint-disable-next-line no-nested-ternary */}
{update && update.updateAvailable ? (
<UpdateDialog
downloadUrl={update.updateUrl}
Expand All @@ -149,6 +158,15 @@ const App = () => {
download={language.download}
cancel={language.cancel}
/>
) : update && !update.updateAvailable && checkedForUpdates ? (
<AlertDialog
open
title={language.checkForUpdates}
content={language.runningLatestVersion}
onOk={closeNoUpdate}
onClose={closeNoUpdate}
agreeLabel={language.ok}
/>
) : null}
<Snackbar open={snackOpen} onClose={closeSnack}>
<Alert onClose={closeSnack} severity="info" sx={{ width: '100%' }}>
Expand Down
1 change: 1 addition & 0 deletions src/contexts/MainContextProvider/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const initState = {
themeType,
pageIndex: 0,
update: null,
checkedForUpdates: false,
error: null,
languageSelector,
loading: false,
Expand Down
3 changes: 2 additions & 1 deletion src/languages/de_de.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,6 @@
"ok": "OK",
"downloadApp": "Laden Sie die Desktop-Anwendung herunter",
"languageSelector": "Sprachauswahl im Menü",
"fixedMenu": "Festes Menü"
"fixedMenu": "Festes Menü",
"runningLatestVersion": "Sie verwenden die neueste Version von Advanced PassGen!"
}
3 changes: 2 additions & 1 deletion src/languages/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,6 @@
"ok": "OK",
"downloadApp": "Download the desktop application",
"languageSelector": "Language selector in the top bar",
"fixedMenu": "Fixed menu"
"fixedMenu": "Fixed menu",
"runningLatestVersion": "You are using the latest version!"
}
3 changes: 2 additions & 1 deletion src/languages/fr_fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,6 @@
"ok": "OK",
"downloadApp": "Télécharger l'application desktop",
"languageSelector": "Sélecteur de langue dans la barre du haut",
"fixedMenu": "Menu fixe"
"fixedMenu": "Menu fixe",
"runningLatestVersion": "Vous utilisez la dernière version!"
}
3 changes: 2 additions & 1 deletion src/languages/jp_jp.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,6 @@
"ok": "わかった",
"downloadApp": "デスクトップ アプリケーションをダウンロードする",
"languageSelector": "トップバーの言語セレクター",
"fixedMenu": "固定メニュー"
"fixedMenu": "固定メニュー",
"runningLatestVersion": "最新バージョンを実行しています。"
}
3 changes: 2 additions & 1 deletion src/languages/nl_nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,6 @@
"ok": "Oké",
"downloadApp": "Download de desktop applicatie",
"languageSelector": "Taalkiezer in de bovenste balk",
"fixedMenu": "Vaste menu balk"
"fixedMenu": "Vaste menu balk",
"runningLatestVersion": "Je gebruikt de nieuwste versie!"
}
3 changes: 2 additions & 1 deletion src/languages/ru_ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,6 @@
"ok": "ХОРОШО",
"downloadApp": "Скачать десктопное приложение",
"languageSelector": "Выбор языка в верхней панели",
"fixedMenu": "Фиксированное меню"
"fixedMenu": "Фиксированное меню",
"runningLatestVersion": "Вы используете последнюю версию!"
}
3 changes: 2 additions & 1 deletion src/languages/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,6 @@
"ok": "确定",
"downloadApp": "下载桌面应用程序",
"languageSelector": "顶栏中的语言选择器",
"fixedMenu": "固定菜单"
"fixedMenu": "固定菜单",
"runningLatestVersion": "你正在运行最新版本。"
}
1 change: 1 addition & 0 deletions src/reducers/MainReducer/Actions/actionTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export const SET_ERROR = 'SET_ERROR';
export const SET_LANGUAGE_SELECTOR = 'SET_LANGUAGE_SELECTOR';
export const SET_LOADING = 'SET_LOADING';
export const SET_FIXED_MENU = 'SET_FIXED_MENU';
export const SET_CHECKED_FOR_UPDATES = 'SET_CHECKED_FOR_UPDATES';
6 changes: 6 additions & 0 deletions src/reducers/MainReducer/Actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { invoke } from '@tauri-apps/api';
import {
RESET_STATE,
SET_AUTO_UPDATE,
SET_CHECKED_FOR_UPDATES,
SET_ERROR,
SET_FIXED_MENU,
SET_LANGUAGE_INDEX,
Expand Down Expand Up @@ -79,3 +80,8 @@ export const setFixedMenu = (value) => ({
type: SET_FIXED_MENU,
payload: value,
});

export const setCheckedForUpdates = (value) => ({
type: SET_CHECKED_FOR_UPDATES,
payload: value,
});
6 changes: 6 additions & 0 deletions src/reducers/MainReducer/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
RESET_STATE,
SET_AUTO_UPDATE,
SET_CHECKED_FOR_UPDATES,
SET_ERROR,
SET_FIXED_MENU,
SET_LANGUAGE_INDEX,
Expand Down Expand Up @@ -84,6 +85,11 @@ const MainReducer = (state, action) => {
...state,
fixedMenu: action.payload,
};
case SET_CHECKED_FOR_UPDATES:
return {
...state,
checkedForUpdates: action.payload,
};
default:
return state;
}
Expand Down
2 changes: 2 additions & 0 deletions src/routes/Settings/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import GridList from '../../components/GridList';
import {
resetState,
setAutoUpdate,
setCheckedForUpdates,
setError,
setFixedMenu,
setLanguageIndex,
Expand Down Expand Up @@ -111,6 +112,7 @@ const Settings = () => {
Updater(res.toLowerCase(), packageJson.version)
.then((up) => {
d1(setUpdate(up));
d1(setCheckedForUpdates(true));
})
.catch((error) => {
d1(setError(error));
Expand Down