Skip to content
Merged
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
16 changes: 3 additions & 13 deletions apps/desktop/src/lib/trpc/routers/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { localDb } from "main/lib/local-db";
import {
DEFAULT_AUTO_APPLY_DEFAULT_PRESET,
DEFAULT_CONFIRM_ON_QUIT,
DEFAULT_TELEMETRY_ENABLED,
DEFAULT_TERMINAL_LINK_BEHAVIOR,
} from "shared/constants";
import { DEFAULT_RINGTONE_ID, RINGTONES } from "shared/ringtones";
Expand Down Expand Up @@ -386,23 +385,14 @@ export const createSettingsRouter = () => {
return { success: true };
}),

// TODO: remove telemetry procedures once telemetry_enabled column is dropped
getTelemetryEnabled: publicProcedure.query(() => {
const row = getSettings();
return row.telemetryEnabled ?? DEFAULT_TELEMETRY_ENABLED;
return true;
}),

setTelemetryEnabled: publicProcedure
.input(z.object({ enabled: z.boolean() }))
.mutation(({ input }) => {
localDb
.insert(settings)
.values({ id: 1, telemetryEnabled: input.enabled })
.onConflictDoUpdate({
target: settings.id,
set: { telemetryEnabled: input.enabled },
})
.run();

.mutation(() => {
return { success: true };
}),
});
Expand Down
9 changes: 1 addition & 8 deletions apps/desktop/src/main/lib/analytics/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { settings } from "@superset/local-db";
import { app } from "electron";
import { env } from "main/env.main";
import { localDb } from "main/lib/local-db";
import { PostHog } from "posthog-node";
import { DEFAULT_TELEMETRY_ENABLED } from "shared/constants";

Expand All @@ -24,12 +22,7 @@ function getClient(): PostHog | null {
}

function isTelemetryEnabled(): boolean {
try {
const row = localDb.select().from(settings).get();
return row?.telemetryEnabled ?? DEFAULT_TELEMETRY_ENABLED;
} catch {
return DEFAULT_TELEMETRY_ENABLED;
}
return DEFAULT_TELEMETRY_ENABLED;
}

export function setUserId(id: string | null): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export function BehaviorSettings({ visibleItems }: BehaviorSettingsProps) {
setConfirmOnQuit.mutate({ enabled });
};

// TODO: remove telemetry query/mutation/handler once telemetry procedures are removed
const { data: telemetryEnabled, isLoading: isTelemetryLoading } =
electronTrpc.settings.getTelemetryEnabled.useQuery();
const setTelemetryEnabled =
Expand Down Expand Up @@ -221,7 +222,7 @@ export function BehaviorSettings({ visibleItems }: BehaviorSettingsProps) {
</div>
)}

{showTelemetry && (
{false && showTelemetry && (
<div className="flex items-center justify-between">
<div className="space-y-0.5">
<Label htmlFor="telemetry" className="text-sm font-medium">
Expand Down
3 changes: 0 additions & 3 deletions packages/local-db/src/schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@ export const settings = sqliteTable("settings", {
notificationSoundsMuted: integer("notification_sounds_muted", {
mode: "boolean",
}),
telemetryEnabled: integer("telemetry_enabled", {
mode: "boolean",
}),
});

export type InsertSettings = typeof settings.$inferInsert;
Expand Down