Skip to content

Commit ef07421

Browse files
committed
fix: report native push diagnostics to Sentry logs
1 parent 8b2a815 commit ef07421

3 files changed

Lines changed: 15 additions & 5 deletions

File tree

‎src-tauri/Cargo.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src-tauri/Cargo.toml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ windows = { version = "0.62", features = [
110110
tauri-plugin-single-instance = { version = "2.4.3", features = ["deep-link"] }
111111

112112
[target.'cfg(any(windows, target_os = "linux"))'.dependencies]
113-
tauri-plugin-notifications = { git = "https://github.com/SableClient/tauri-plugin-notifications.git", rev = "a88516315e3fd75a38993bf318649bcfb61864ff" }
113+
tauri-plugin-notifications = { git = "https://github.com/SableClient/tauri-plugin-notifications.git", rev = "ac93b116a345146d7207329191a5bbda8e58b012" }
114114

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

120120
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
121121
tauri-plugin-updater = { version = "2", optional = true }
@@ -139,7 +139,7 @@ libloading = "0.9"
139139
zbus = "5"
140140

141141
[target.'cfg(any(target_os = "android", target_os = "ios"))'.dependencies]
142-
tauri-plugin-notifications = { git = "https://github.com/SableClient/tauri-plugin-notifications.git", rev = "a88516315e3fd75a38993bf318649bcfb61864ff", features = [
142+
tauri-plugin-notifications = { git = "https://github.com/SableClient/tauri-plugin-notifications.git", rev = "ac93b116a345146d7207329191a5bbda8e58b012", features = [
143143
"push-notifications",
144144
] }
145145
tauri-plugin-edge-to-edge = { git = "https://github.com/SableClient/tauri-plugin-edge-to-edge.git", rev = "33c6116c27be28c06df5a9d02231ecc5fdeb93c5" }

‎src/app/hooks/usePushDiagnosticsReport.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ const report = async (): Promise<void> => {
1212

1313
entries.forEach(([outcome, occurrences]) => {
1414
Sentry.metrics.count('sable.push.cold_outcome', occurrences, { attributes: { outcome } });
15+
Sentry.logger.info('Native push diagnostic', {
16+
outcome,
17+
occurrences,
18+
lastOutcome: diagnostics.lastOutcome ?? '',
19+
lastAt: diagnostics.lastAt,
20+
});
1521
});
1622

1723
Sentry.addBreadcrumb({
@@ -31,9 +37,13 @@ export const usePushDiagnosticsReport = (): void => {
3137
void report();
3238
};
3339

40+
const interval = window.setInterval(drain, 30_000);
3441
document.addEventListener('visibilitychange', drain);
3542
drain();
3643

37-
return () => document.removeEventListener('visibilitychange', drain);
44+
return () => {
45+
window.clearInterval(interval);
46+
document.removeEventListener('visibilitychange', drain);
47+
};
3848
}, []);
3949
};

0 commit comments

Comments
 (0)