Add WhatsApp media downloads and completion toasts
- Save WhatsApp media downloads without overwriting existing files - Show download notifications with open and folder actions - Display the app version and update Linux package metadata
This commit is contained in:
1 parent
78e64c836f
commit
02f5b05265
6 files changed
+700
-10
No files matched your search
+57
@@ -0,0 +1,57 @@
|
||||
const { app } = require('electron');
|
||||
|
||||
const BADGE_ID = 'whatsapp-desktop-version';
|
||||
|
||||
const BADGE_CSS = `
|
||||
#${BADGE_ID} {
|
||||
position: fixed;
|
||||
left: 10px;
|
||||
bottom: 8px;
|
||||
z-index: 2147483647;
|
||||
padding: 1px 7px;
|
||||
border: 1px solid rgba(134, 150, 160, 0.28);
|
||||
border-radius: 999px;
|
||||
background: rgba(17, 27, 33, 0.55);
|
||||
color: rgba(233, 237, 239, 0.62);
|
||||
font: 500 10px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
||||
letter-spacing: 0.3px;
|
||||
pointer-events: none;
|
||||
user-select: none;
|
||||
}
|
||||
`;
|
||||
|
||||
function badgeScript(version) {
|
||||
return `
|
||||
(() => {
|
||||
const id = ${JSON.stringify(BADGE_ID)};
|
||||
const existing = document.getElementById(id);
|
||||
|
||||
if (existing) {
|
||||
existing.remove();
|
||||
}
|
||||
|
||||
if (!document.body) {
|
||||
return;
|
||||
}
|
||||
|
||||
const badge = document.createElement('div');
|
||||
badge.id = id;
|
||||
badge.textContent = ${JSON.stringify(`v${version}`)};
|
||||
document.body.appendChild(badge);
|
||||
})();
|
||||
`;
|
||||
}
|
||||
|
||||
async function injectVersionStyles(webContents) {
|
||||
await webContents.insertCSS(BADGE_CSS);
|
||||
}
|
||||
|
||||
async function injectVersionBadge(webContents, version = app.getVersion()) {
|
||||
await webContents.executeJavaScript(badgeScript(version));
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
BADGE_ID,
|
||||
injectVersionStyles,
|
||||
injectVersionBadge
|
||||
};
|
||||
Reference in new issue
Block a user