mirror of
https://github.com/ivabus/gui
synced 2025-04-23 14:07:14 +03:00
open package page if notification is clicked (#599)
Co-authored-by: neil molina <neil@neils-MacBook-Pro.local>
This commit is contained in:
parent
81527f2dbc
commit
5cbe8cade5
1 changed files with 10 additions and 4 deletions
|
@ -2,7 +2,7 @@ import Pushy from "pushy-electron";
|
||||||
import { readSessionData } from "./auth";
|
import { readSessionData } from "./auth";
|
||||||
import { post } from "./v1-client";
|
import { post } from "./v1-client";
|
||||||
import log from "./logger";
|
import log from "./logger";
|
||||||
import { Notification, BrowserWindow } from "electron";
|
import { Notification, BrowserWindow, shell } from "electron";
|
||||||
import { isInstalled, nameToSlug } from "./package";
|
import { isInstalled, nameToSlug } from "./package";
|
||||||
import {
|
import {
|
||||||
getInstalledPackages,
|
getInstalledPackages,
|
||||||
|
@ -46,10 +46,16 @@ export default function initialize(mainWindow: BrowserWindow) {
|
||||||
const installed = isInstalled(pkg);
|
const installed = isInstalled(pkg);
|
||||||
const isDup = await wasReceivedBefore(data);
|
const isDup = await wasReceivedBefore(data);
|
||||||
if (!isDup && installed) {
|
if (!isDup && installed) {
|
||||||
new Notification({
|
const notification = new Notification({
|
||||||
title: "tea",
|
title: "tea",
|
||||||
body: data?.message as string
|
body: data?.message as string,
|
||||||
}).show();
|
actions: [{ type: "button", text: "Open" }]
|
||||||
|
});
|
||||||
|
notification.on("click", () => {
|
||||||
|
shell.openExternal(data?.url);
|
||||||
|
});
|
||||||
|
notification.show();
|
||||||
|
log.info("notification shown", data);
|
||||||
|
|
||||||
const v = app.dock.getBadge();
|
const v = app.dock.getBadge();
|
||||||
if (!v) {
|
if (!v) {
|
||||||
|
|
Loading…
Reference in a new issue