Skip to content
Closed
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
5 changes: 5 additions & 0 deletions .changeset/native-push-notifications.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
default: minor
---

Add native push notifications with reply actions, content preview, and configurable gateway
38 changes: 19 additions & 19 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ windows = { version = "0.61", features = [
tauri-plugin-single-instance = { version = "2.4.3", features = ["deep-link"] }

[target.'cfg(any(windows, target_os = "linux"))'.dependencies]
tauri-plugin-notifications = { git = "https://github.com/SableClient/tauri-plugin-notifications.git", rev = "0ca647a8d762cbba2ecfbefed7ff13565ec46229" }
tauri-plugin-notifications = { git = "https://github.com/SableClient/tauri-plugin-notifications.git", rev = "e7a879690069d6f66ce3b536ad2495736c9beca3" }

# default-features = false drops notify-rust so macOS uses the native
# UNUserNotificationCenter backend (needs a signed .app to deliver).
[target.'cfg(target_os = "macos")'.dependencies]
tauri-plugin-notifications = { git = "https://github.com/SableClient/tauri-plugin-notifications.git", rev = "0ca647a8d762cbba2ecfbefed7ff13565ec46229", default-features = false }
tauri-plugin-notifications = { git = "https://github.com/SableClient/tauri-plugin-notifications.git", rev = "e7a879690069d6f66ce3b536ad2495736c9beca3", default-features = false }

[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-updater = { version = "2", optional = true }
Expand All @@ -102,7 +102,7 @@ cef = { version = "=148.0.0", optional = true }
libloading = "0.8"

[target.'cfg(any(target_os = "android", target_os = "ios"))'.dependencies]
tauri-plugin-notifications = { git = "https://github.com/SableClient/tauri-plugin-notifications.git", rev = "0ca647a8d762cbba2ecfbefed7ff13565ec46229", features = [
tauri-plugin-notifications = { git = "https://github.com/SableClient/tauri-plugin-notifications.git", rev = "e7a879690069d6f66ce3b536ad2495736c9beca3", features = [
"push-notifications",
] }
tauri-plugin-edge-to-edge = { git = "https://github.com/SableClient/tauri-plugin-edge-to-edge.git", rev = "33c6116c27be28c06df5a9d02231ecc5fdeb93c5" }
Expand Down
16 changes: 16 additions & 0 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,22 @@
"appLink": false
}
]
},
"notifications": {
"actionTypes": [
{
"id": "sable-message",
"actions": [
{
"id": "sable-reply",
"title": "Reply",
"input": true,
"inputButtonTitle": "Send",
"inputPlaceholder": "Type a reply"
}
]
}
]
}
}
}
37 changes: 37 additions & 0 deletions src/app/features/settings/notifications/PushPusherConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
export type PushPusherSettings = {
useRichPushPayloads?: boolean;
pushNotifyUrlOverride?: string;
};

export function resolvePushNotifyUrl(
configuredUrl: string | undefined,
override: string | undefined
): string {
const candidate = override?.trim() || configuredUrl?.trim();
if (!candidate)
throw new Error('Push requires pushNotificationDetails.pushNotifyUrl in config.json.');

let url: URL;
try {
url = new URL(candidate);
} catch {
throw new Error('Push gateway URL must be a full HTTPS URL ending in /notify.');
}
if (
url.protocol !== 'https:' ||
url.username ||
url.password ||
url.hash ||
url.pathname !== '/_matrix/push/v1/notify'
) {
throw new Error('Push gateway URL must be an HTTPS Matrix /_matrix/push/v1/notify endpoint.');
}
return url.toString();
}

export function withPushPayloadFormat<T extends Record<string, unknown>>(
data: T,
useRichPushPayloads = false
): T | (T & { format: 'event_id_only' }) {
return useRichPushPayloads ? data : { ...data, format: 'event_id_only' };
}
17 changes: 17 additions & 0 deletions src/app/features/settings/notifications/SystemNotification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,10 @@ export function SystemNotification() {
settingsAtom,
'clearNotificationsOnRead'
);
const [useRichPushPayloads, setUseRichPushPayloads] = useSetting(
settingsAtom,
'useRichPushPayloads'
);
const [showUnreadCounts, setShowUnreadCounts] = useSetting(settingsAtom, 'showUnreadCounts');
const [badgeCountDMsOnly, setBadgeCountDMsOnly] = useSetting(settingsAtom, 'badgeCountDMsOnly');
const [showPingCounts, setShowPingCounts] = useSetting(settingsAtom, 'showPingCounts');
Expand Down Expand Up @@ -1126,6 +1130,19 @@ export function SystemNotification() {
}
/>
</SequenceCard>
<SequenceCard
className={SequenceCardStyle}
variant="SurfaceVariant"
direction="Column"
gap="400"
>
<SettingTile
title="Rich Push Payloads"
focusId="rich-push-payloads"
description="Include message content in push payloads for faster notifications. Your push gateway can see unencrypted message text."
after={<Switch value={useRichPushPayloads} onChange={setUseRichPushPayloads} />}
/>
</SequenceCard>
<SequenceCard
className={SequenceCardStyle}
variant="SurfaceVariant"
Expand Down
Loading
Loading