mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2025-12-17 06:14:21 +01:00
Ask for diagnostic reporting on startup
This commit is contained in:
committed by
Tony Giorgio
parent
59bcd6296d
commit
c955626206
@@ -1,5 +1,5 @@
|
|||||||
import { useNavigate } from "@solidjs/router";
|
import { useNavigate } from "@solidjs/router";
|
||||||
import { createSignal } from "solid-js";
|
import { createEffect, createSignal } from "solid-js";
|
||||||
|
|
||||||
import logo from "~/assets/mutiny-pixel-logo.png";
|
import logo from "~/assets/mutiny-pixel-logo.png";
|
||||||
import { Button, DefaultMain, NiceP } from "~/components";
|
import { Button, DefaultMain, NiceP } from "~/components";
|
||||||
@@ -9,8 +9,22 @@ export function Setup() {
|
|||||||
const [_state, actions] = useMegaStore();
|
const [_state, actions] = useMegaStore();
|
||||||
|
|
||||||
const [isCreatingNewWallet, setIsCreatingNewWallet] = createSignal(false);
|
const [isCreatingNewWallet, setIsCreatingNewWallet] = createSignal(false);
|
||||||
|
const [isDiagnosticReportingEnabled, setIsDiagnosticReportingEnabled] =
|
||||||
|
createSignal(true);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
// default is to set reporting
|
||||||
|
actions.setReportDiagnostics();
|
||||||
|
|
||||||
|
// set up a listener that toggles it
|
||||||
|
createEffect(() => {
|
||||||
|
if (isDiagnosticReportingEnabled()) {
|
||||||
|
actions.setReportDiagnostics();
|
||||||
|
} else {
|
||||||
|
actions.disableReportDiagnostics();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
async function handleNewWallet() {
|
async function handleNewWallet() {
|
||||||
try {
|
try {
|
||||||
setIsCreatingNewWallet(true);
|
setIsCreatingNewWallet(true);
|
||||||
@@ -67,6 +81,19 @@ export function Setup() {
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex-1" />
|
<div class="flex-1" />
|
||||||
|
<p class="max-w-[15rem] text-center text-xs font-light text-m-grey-400">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={isDiagnosticReportingEnabled()}
|
||||||
|
onChange={() =>
|
||||||
|
setIsDiagnosticReportingEnabled(
|
||||||
|
!isDiagnosticReportingEnabled()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
Allow anonymous error reporting to help us improve the app.
|
||||||
|
You can opt out at any time.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</DefaultMain>
|
</DefaultMain>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -48,41 +48,6 @@ const sentryenv = import.meta.env.VITE_SENTRY_ENVIRONMENT || (DEV ? "dev" : "");
|
|||||||
export const makeMegaStoreContext = () => {
|
export const makeMegaStoreContext = () => {
|
||||||
const [searchParams] = useSearchParams();
|
const [searchParams] = useSearchParams();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const reportDiagnostics =
|
|
||||||
localStorage.getItem("report_diagnostics") === "true";
|
|
||||||
|
|
||||||
// initialize both inside worker and outside
|
|
||||||
if (reportDiagnostics && sentryenv !== "") {
|
|
||||||
Sentry.init({
|
|
||||||
dsn: "https://192c556849619517322719962a057376@sen.mutinywallet.com/2",
|
|
||||||
environment: sentryenv,
|
|
||||||
release: "mutiny-web@" + RELEASE_VERSION,
|
|
||||||
integrations: [
|
|
||||||
Sentry.browserTracingIntegration(),
|
|
||||||
Sentry.replayIntegration()
|
|
||||||
],
|
|
||||||
|
|
||||||
initialScope: {
|
|
||||||
tags: { component: "main" }
|
|
||||||
},
|
|
||||||
|
|
||||||
// Set tracesSampleRate to 1.0 to capture 100%
|
|
||||||
// of transactions for performance monitoring.
|
|
||||||
// We recommend adjusting this value in production
|
|
||||||
tracesSampleRate: 1.0,
|
|
||||||
|
|
||||||
// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
|
|
||||||
tracePropagationTargets: [
|
|
||||||
"localhost",
|
|
||||||
/^https:\/\/mutinywallet\.com/
|
|
||||||
],
|
|
||||||
|
|
||||||
// Capture Replay for 10% of all sessions,
|
|
||||||
// plus 100% of sessions with an error
|
|
||||||
replaysSessionSampleRate: 0.1,
|
|
||||||
replaysOnErrorSampleRate: 1.0
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Not actually a shared worker, but it's the same code
|
// Not actually a shared worker, but it's the same code
|
||||||
const sw = new ComlinkWorker<typeof import("../workers/walletWorker")>(
|
const sw = new ComlinkWorker<typeof import("../workers/walletWorker")>(
|
||||||
@@ -123,7 +88,8 @@ export const makeMegaStoreContext = () => {
|
|||||||
lang: localStorage.getItem("i18nexLng") || undefined,
|
lang: localStorage.getItem("i18nexLng") || undefined,
|
||||||
preferredInvoiceType: "unified" as "unified" | "lightning" | "onchain",
|
preferredInvoiceType: "unified" as "unified" | "lightning" | "onchain",
|
||||||
should_zap_hodl: localStorage.getItem("should_zap_hodl") === "true",
|
should_zap_hodl: localStorage.getItem("should_zap_hodl") === "true",
|
||||||
report_diagnostics: reportDiagnostics,
|
report_diagnostics:
|
||||||
|
localStorage.getItem("report_diagnostics") === "true",
|
||||||
testflightPromptDismissed:
|
testflightPromptDismissed:
|
||||||
localStorage.getItem("testflightPromptDismissed") === "true",
|
localStorage.getItem("testflightPromptDismissed") === "true",
|
||||||
federations: undefined as MutinyFederationIdentity[] | undefined,
|
federations: undefined as MutinyFederationIdentity[] | undefined,
|
||||||
@@ -208,6 +174,41 @@ export const makeMegaStoreContext = () => {
|
|||||||
const settings = await getSettings();
|
const settings = await getSettings();
|
||||||
setState({ load_stage: "setup" });
|
setState({ load_stage: "setup" });
|
||||||
|
|
||||||
|
const reportDiagnostics =
|
||||||
|
localStorage.getItem("report_diagnostics") === "true";
|
||||||
|
|
||||||
|
if (reportDiagnostics && sentryenv !== "") {
|
||||||
|
Sentry.init({
|
||||||
|
dsn: "https://192c556849619517322719962a057376@sen.mutinywallet.com/2",
|
||||||
|
environment: sentryenv,
|
||||||
|
release: "mutiny-web@" + RELEASE_VERSION,
|
||||||
|
integrations: [
|
||||||
|
Sentry.browserTracingIntegration(),
|
||||||
|
Sentry.replayIntegration()
|
||||||
|
],
|
||||||
|
|
||||||
|
initialScope: {
|
||||||
|
tags: { component: "main" }
|
||||||
|
},
|
||||||
|
|
||||||
|
// Set tracesSampleRate to 1.0 to capture 100%
|
||||||
|
// of transactions for performance monitoring.
|
||||||
|
// We recommend adjusting this value in production
|
||||||
|
tracesSampleRate: 1.0,
|
||||||
|
|
||||||
|
// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
|
||||||
|
tracePropagationTargets: [
|
||||||
|
"localhost",
|
||||||
|
/^https:\/\/mutinywallet\.com/
|
||||||
|
],
|
||||||
|
|
||||||
|
// Capture Replay for 10% of all sessions,
|
||||||
|
// plus 100% of sessions with an error
|
||||||
|
replaysSessionSampleRate: 0.1,
|
||||||
|
replaysOnErrorSampleRate: 1.0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// handle lsp settings
|
// handle lsp settings
|
||||||
if (searchParams.lsps) {
|
if (searchParams.lsps) {
|
||||||
settings.lsp = "";
|
settings.lsp = "";
|
||||||
@@ -559,6 +560,14 @@ export const makeMegaStoreContext = () => {
|
|||||||
);
|
);
|
||||||
setState({ report_diagnostics });
|
setState({ report_diagnostics });
|
||||||
},
|
},
|
||||||
|
setReportDiagnostics() {
|
||||||
|
localStorage.setItem("report_diagnostics", "true");
|
||||||
|
setState({ report_diagnostics: true });
|
||||||
|
},
|
||||||
|
disableReportDiagnostics() {
|
||||||
|
localStorage.setItem("report_diagnostics", "false");
|
||||||
|
setState({ report_diagnostics: false });
|
||||||
|
},
|
||||||
async refreshFederations() {
|
async refreshFederations() {
|
||||||
const federations = await sw.list_federations();
|
const federations = await sw.list_federations();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user