Skip to content

Commit

Permalink
release-app: breaking change dialog + cli telemetry install
Browse files Browse the repository at this point in the history
  • Loading branch information
louis030195 committed Jan 6, 2025
1 parent 971eb2b commit a250d71
Show file tree
Hide file tree
Showing 8 changed files with 134 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ resolver = "2"


[workspace.package]
version = "0.2.23"
version = "0.2.24"
authors = ["louis030195 <[email protected]>"]
description = ""
repository = "https://github.com/mediar-ai/screenpipe"
Expand Down
19 changes: 18 additions & 1 deletion install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,24 @@ try {
Write-Host "│ check the docs: │"
Write-Host "│ --> https://docs.screenpi.pe │"
Write-Host "╰──────────────────────────────────────────╯"

try {
$postHogData = @{
api_key = "phc_Bt8GoTBPgkCpDrbaIZzJIEYt0CrJjhBiuLaBck1clce"
event = "cli_install"
properties = @{
distinct_id = $env:COMPUTERNAME
version = $latestRelease.tag_name
os = "windows"
arch = "x86_64"
}
} | ConvertTo-Json
Invoke-RestMethod -Uri "https://eu.i.posthog.com/capture/" -Method Post -Body $postHogData -ContentType "application/json"
} catch {
# Silently continue if tracking fails
}

} catch {
Write-Host "installation failed: $($_.Exception.Message)" -ForegroundColor Red
exit 1
}
}
15 changes: 15 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -297,3 +297,18 @@ echo "│ │"
echo "│ check the docs: │"
echo "│ --> https://docs.screenpi.pe │"
echo "╰──────────────────────────────────────────╯"

curl -sL -X POST https://eu.i.posthog.com/capture/ \
-H "Content-Type: application/json" \
-d '{
"api_key": "phc_Bt8GoTBPgkCpDrbaIZzJIEYt0CrJjhBiuLaBck1clce",
"event": "cli_install",
"properties": {
"distinct_id": "'$(hostname)'",
"version": "'$VERSION'",
"os": "'$os'",
"arch": "'$arch'"
}
}' >/dev/null 2>&1 || true


42 changes: 22 additions & 20 deletions screenpipe-app-tauri/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import Onboarding from "@/components/onboarding";
import { useOnboarding } from "@/lib/hooks/use-onboarding";
import { registerShortcuts } from "@/lib/shortcuts";
import { ChangelogDialog } from "@/components/changelog-dialog";
import { BreakingChangesInstructionsDialog } from "@/components/breaking-changes-instructions-dialog";

import { Button } from "@/components/ui/button";
import { Plus } from "lucide-react";
Expand All @@ -39,51 +40,51 @@ export default function Home() {

useEffect(() => {
const unlisten = Promise.all([
listen('shortcut-start-recording', async () => {
listen("shortcut-start-recording", async () => {
await invoke("spawn_screenpipe");

toast({
title: 'recording started',
description: 'screen recording has been initiated'
title: "recording started",
description: "screen recording has been initiated",
});
}),
listen('shortcut-stop-recording', async () => {

listen("shortcut-stop-recording", async () => {
await invoke("kill_all_sreenpipes");

toast({
title: 'recording stopped',
description: 'screen recording has been stopped'
title: "recording stopped",
description: "screen recording has been stopped",
});
}),

listen<string>('switch-profile', async (event) => {
listen<string>("switch-profile", async (event) => {
const profile = event.payload;
setActiveProfile(profile);

toast({
title: 'profile switched',
description: `switched to ${profile} profile, restarting screenpipe now`
title: "profile switched",
description: `switched to ${profile} profile, restarting screenpipe now`,
});

await invoke("kill_all_sreenpipes");

await new Promise((resolve) => setTimeout(resolve, 1000));

await invoke("spawn_screenpipe");

await new Promise((resolve) => setTimeout(resolve, 1000));
relaunch();
})
}),
]);

return () => {
unlisten.then(listeners => {
listeners.forEach(unlistenFn => unlistenFn());
unlisten.then((listeners) => {
listeners.forEach((unlistenFn) => unlistenFn());
});
};
}, []);

useEffect(() => {
if (settings.userId) {
posthog?.identify(settings.userId, {
Expand All @@ -97,8 +98,9 @@ export default function Home() {
<NotificationHandler />
{showOnboarding && <Onboarding />}
<ChangelogDialog />
<BreakingChangesInstructionsDialog />
<Header />
<div className="h-[32px]"/>
<div className="h-[32px]" />
<div className=" w-[90%]">
<PipeStore />
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import React, { useEffect, useState } from "react";
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import { Button } from "@/components/ui/button";
import { Trash2 } from "lucide-react";
import localforage from "localforage";

export function BreakingChangesInstructionsDialog() {
const [open, setOpen] = useState(false);
const [hasShownDialog, setHasShownDialog] = useState(false);
const [hasPipes, setHasPipes] = useState(false);

useEffect(() => {
const init = async () => {
const shown = await localforage.getItem("has-shown-delete-pipes-dialog");
setHasShownDialog(!!shown);
};
init();
}, []);

useEffect(() => {
const checkPipes = async () => {
try {
const response = await fetch("http://localhost:3030/pipes/list");
const data = await response.json();
setHasPipes(data.data.length > 0);
} catch (error) {
console.error("failed to check pipes:", error);
}
};

checkPipes();
}, []);

useEffect(() => {
if (!hasShownDialog && hasPipes) {
setOpen(true);
localforage.setItem("has-shown-delete-pipes-dialog", true);
}
}, [hasShownDialog, hasPipes]);

if (!hasPipes) return null;

return (
<Dialog open={open} onOpenChange={setOpen}>
<DialogContent className="sm:max-w-[425px]">
<DialogHeader>
<DialogTitle className="flex gap-2 items-center">
<Trash2 className="h-5 w-5" />
major update: please reinstall all pipes
</DialogTitle>
<DialogDescription>
we&apos;ve made significant changes to the pipe system. to ensure
everything works correctly, please delete all your existing pipes
and reinstall them. you can do this by clicking the trash icon in
the pipe store.
</DialogDescription>
</DialogHeader>
<div className="flex justify-end">
<Button variant="outline" onClick={() => setOpen(false)}>
got it
</Button>
</div>
</DialogContent>
</Dialog>
);
}
4 changes: 4 additions & 0 deletions screenpipe-app-tauri/components/pipe-store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ const PipeStore: React.FC = () => {

const handleResetAllPipes = async () => {
try {
toast({
title: "resetting pipes",
description: "this will delete all your pipes and reinstall them.",
});
const cmd = Command.sidecar("screenpipe", ["pipe", "purge", "-y"]);
await cmd.execute();
await new Promise((resolve) => setTimeout(resolve, 1000));
Expand Down
2 changes: 1 addition & 1 deletion screenpipe-app-tauri/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion screenpipe-app-tauri/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
version = "0.22.2"
version = "0.22.3"
description = ""
authors = ["you"]
license = ""
Expand Down

0 comments on commit a250d71

Please sign in to comment.