mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-30 05:42:44 -08:00
fix: report native push diagnostics to Sentry logs (#2061)
<!-- Please read https://github.com/SableClient/Sable/blob/dev/CONTRIBUTING.md before submitting your pull request --> ### Description <!-- Please include a summary of the change. Please also include relevant motivation and context. List any dependencies that are required for this change. --> Fixes # #### Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ### Checklist: - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings ### AI disclosure: - [ ] Partially AI assisted (clarify which code was AI assisted and briefly explain what it does). - [ ] Fully AI generated (explain what all the generated code does in moderate detail). <!-- Write any explanation required here, but do not generate the explanation using AI!! You must prove you understand what the code in this PR does. -->
This commit is contained in:
3 files changed
+15
-5
No files matched your search
Generated
+1
-1
@@ -8325,7 +8325,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tauri-plugin-notifications"
|
||||
version = "0.5.0"
|
||||
source = "git+https://github.com/SableClient/tauri-plugin-notifications.git?rev=a88516315e3fd75a38993bf318649bcfb61864ff#a88516315e3fd75a38993bf318649bcfb61864ff"
|
||||
source = "git+https://github.com/SableClient/tauri-plugin-notifications.git?rev=ac93b116a345146d7207329191a5bbda8e58b012#ac93b116a345146d7207329191a5bbda8e58b012"
|
||||
dependencies = [
|
||||
"log",
|
||||
"notify-rust",
|
||||
|
||||
@@ -110,12 +110,12 @@ windows = { version = "0.62", 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 = "a88516315e3fd75a38993bf318649bcfb61864ff" }
|
||||
tauri-plugin-notifications = { git = "https://github.com/SableClient/tauri-plugin-notifications.git", rev = "ac93b116a345146d7207329191a5bbda8e58b012" }
|
||||
|
||||
# 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 = "a88516315e3fd75a38993bf318649bcfb61864ff", default-features = false }
|
||||
tauri-plugin-notifications = { git = "https://github.com/SableClient/tauri-plugin-notifications.git", rev = "ac93b116a345146d7207329191a5bbda8e58b012", default-features = false }
|
||||
|
||||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
||||
tauri-plugin-updater = { version = "2", optional = true }
|
||||
@@ -139,7 +139,7 @@ libloading = "0.9"
|
||||
zbus = "5"
|
||||
|
||||
[target.'cfg(any(target_os = "android", target_os = "ios"))'.dependencies]
|
||||
tauri-plugin-notifications = { git = "https://github.com/SableClient/tauri-plugin-notifications.git", rev = "a88516315e3fd75a38993bf318649bcfb61864ff", features = [
|
||||
tauri-plugin-notifications = { git = "https://github.com/SableClient/tauri-plugin-notifications.git", rev = "ac93b116a345146d7207329191a5bbda8e58b012", features = [
|
||||
"push-notifications",
|
||||
] }
|
||||
tauri-plugin-edge-to-edge = { git = "https://github.com/SableClient/tauri-plugin-edge-to-edge.git", rev = "33c6116c27be28c06df5a9d02231ecc5fdeb93c5" }
|
||||
|
||||
@@ -12,6 +12,12 @@ const report = async (): Promise<void> => {
|
||||
|
||||
entries.forEach(([outcome, occurrences]) => {
|
||||
Sentry.metrics.count('sable.push.cold_outcome', occurrences, { attributes: { outcome } });
|
||||
Sentry.logger.info('Native push diagnostic', {
|
||||
outcome,
|
||||
occurrences,
|
||||
lastOutcome: diagnostics.lastOutcome ?? '',
|
||||
lastAt: diagnostics.lastAt,
|
||||
});
|
||||
});
|
||||
|
||||
Sentry.addBreadcrumb({
|
||||
@@ -31,9 +37,13 @@ export const usePushDiagnosticsReport = (): void => {
|
||||
void report();
|
||||
};
|
||||
|
||||
const interval = window.setInterval(drain, 30_000);
|
||||
document.addEventListener('visibilitychange', drain);
|
||||
drain();
|
||||
|
||||
return () => document.removeEventListener('visibilitychange', drain);
|
||||
return () => {
|
||||
window.clearInterval(interval);
|
||||
document.removeEventListener('visibilitychange', drain);
|
||||
};
|
||||
}, []);
|
||||
};
|
||||
Reference in new issue
Block a user