Compare commits

...

2 Commits

Author SHA1 Message Date
Half-Shot
3af6093755 fix lint 2025-11-07 13:37:42 +00:00
Half-Shot
ab7051cc51 Add tracking for setting up key backups. 2025-11-07 11:10:09 +00:00

View File

@@ -8,6 +8,7 @@ Please see LICENSE files in the repository root for full details.
import KeyIcon from "@vector-im/compound-design-tokens/assets/web/icons/key";
import { type ComponentType } from "react";
import { type Interaction as InteractionEvent } from "@matrix-org/analytics-events/types/typescript/Interaction";
import type React from "react";
import Modal from "../Modal";
@@ -25,6 +26,7 @@ import { Action } from "../dispatcher/actions";
import { UserTab } from "../components/views/dialogs/UserTab";
import defaultDispatcher from "../dispatcher/dispatcher";
import ConfirmKeyStorageOffDialog from "../components/views/dialogs/ConfirmKeyStorageOffDialog";
import { PosthogAnalytics } from "../PosthogAnalytics";
const TOAST_KEY = "setupencryption";
@@ -156,6 +158,11 @@ export const showToast = (kind: Kind): void => {
switch (kind) {
case Kind.SET_UP_RECOVERY:
case Kind.TURN_ON_KEY_STORAGE: {
PosthogAnalytics.instance.trackEvent<InteractionEvent>({
eventName: "Interaction",
interactionType: "Pointer",
name: kind === Kind.SET_UP_RECOVERY ? "ToastSetUpRecoveryClick" : "ToastTurnOnKeyStorageClick",
});
// Open the user settings dialog to the encryption tab
const payload: OpenToTabPayload = {
action: Action.ViewUserSettings,
@@ -191,6 +198,11 @@ export const showToast = (kind: Kind): void => {
const onSecondaryClick = async (): Promise<void> => {
switch (kind) {
case Kind.SET_UP_RECOVERY: {
PosthogAnalytics.instance.trackEvent<InteractionEvent>({
eventName: "Interaction",
interactionType: "Pointer",
name: "ToastSetUpRecoveryDismiss",
});
// Record that the user doesn't want to set up recovery
const deviceListener = DeviceListener.sharedInstance();
await deviceListener.recordRecoveryDisabled();
@@ -209,6 +221,11 @@ export const showToast = (kind: Kind): void => {
break;
}
case Kind.TURN_ON_KEY_STORAGE: {
PosthogAnalytics.instance.trackEvent<InteractionEvent>({
eventName: "Interaction",
interactionType: "Pointer",
name: "ToastTurnOnKeyStorageDismiss",
});
// The user clicked "Dismiss": offer them "Are you sure?"
const modal = Modal.createDialog(
ConfirmKeyStorageOffDialog,