1
1
mirror of https://github.com/neosubhamoy/pytubepp-helper.git synced 2026-02-04 11:22:22 +05:30

(feat): added notifications page and app updater

This commit is contained in:
2025-02-13 09:30:35 +05:30
Verified
parent f6686f7e37
commit d6c5ff4be8
13 changed files with 436 additions and 11 deletions

View File

@@ -15,7 +15,7 @@ function App({ children }: { children: React.ReactNode }) {
const appWindow = getCurrentWebviewWindow()
const [isAppUpdateChecked, setIsAppUpdateChecked] = useState(false);
// Prevent context menu in production
// Prevent right click context menu in production
if (!import.meta.env.DEV) {
document.oncontextmenu = (event) => {
event.preventDefault()
@@ -66,14 +66,14 @@ function App({ children }: { children: React.ReactNode }) {
const permission = await requestPermission();
permissionGranted = permission === 'granted';
}
setIsAppUpdateChecked(true);
try {
setIsAppUpdateChecked(true);
const update = await checkAppUpdate();
if (update) {
console.log(`found update ${update.version} from ${update.date} with notes ${update.body}`);
if (permissionGranted) {
sendNotification({ title: 'Update Available', body: 'A new version of pytubepp-helper is available. Please update to the latest version.' });
}
console.log(`app update available v${update.version}`);
if (permissionGranted) {
sendNotification({ title: `Update Available (v${update.version})`, body: `A newer version of PytubePP Helper is available. Please update to the latest version to get the best experience!` });
}
}
} catch (error) {
console.error(error);