Skip to content

Commit 36688a2

Browse files
committed
added delay in screenshot and adjusted window showing mechanism
1 parent f7607a7 commit 36688a2

File tree

7 files changed

+64
-8
lines changed

7 files changed

+64
-8
lines changed

Diff for: .gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ dist-electron
33
release
44
dist
55
.env
6-
.env.*
6+
.env.*
7+
.DS_Store

Diff for: build/entitlements.mac.plist

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.cs.allow-jit</key>
6+
<true/>
7+
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
8+
<true/>
9+
<key>com.apple.security.cs.debugger</key>
10+
<true/>
11+
<key>com.apple.security.device.camera</key>
12+
<true/>
13+
<key>com.apple.security.device.microphone</key>
14+
<true/>
15+
<key>com.apple.security.files.user-selected.read-write</key>
16+
<true/>
17+
<key>com.apple.security.cs.disable-library-validation</key>
18+
<true/>
19+
</dict>
20+
</plist>

Diff for: electron/ScreenshotHelper.ts

+2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ export class ScreenshotHelper {
7979
showMainWindow: () => void
8080
): Promise<string> {
8181
hideMainWindow()
82+
// Add a small delay to ensure the window is fully hidden
83+
await new Promise((resolve) => setTimeout(resolve, 100))
8284
let screenshotPath = ""
8385

8486
if (this.view === "queue") {

Diff for: electron/WindowHelper.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,7 @@ export class WindowHelper {
186186
})
187187
}
188188

189-
this.mainWindow.showInactive()
190-
189+
this.mainWindow.show()
191190
this.isWindowVisible = true
192191
}
193192

Diff for: package-lock.json

+4-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"clean": "rimraf dist dist-electron",
77
"dev": "cross-env NODE_ENV=development vite",
8-
"build": "npm run clean && tsc && vite build && electron-builder",
8+
"build": "node scripts/build.js",
99
"preview": "vite preview",
1010
"electron:dev": "tsc -p electron/tsconfig.json && electron .",
1111
"app:dev": "concurrently \"cross-env NODE_ENV=development vite\" \"wait-on http://localhost:5173 && cross-env electron .\"",
@@ -36,7 +36,11 @@
3636
]
3737
}
3838
],
39-
"icon": "assets/icons/mac/icon.icns"
39+
"icon": "assets/icons/mac/icon.icns",
40+
"hardenedRuntime": true,
41+
"gatekeeperAssess": false,
42+
"entitlements": "build/entitlements.mac.plist",
43+
"entitlementsInherit": "build/entitlements.mac.plist"
4044
},
4145
"win": {
4246
"target": [
@@ -81,6 +85,7 @@
8185
"autoprefixer": "^10.4.20",
8286
"concurrently": "^9.1.0",
8387
"cross-env": "^7.0.3",
88+
"dotenv": "^16.4.7",
8489
"electron": "^33.2.0",
8590
"electron-builder": "^25.1.8",
8691
"electron-is-dev": "^3.0.1",

Diff for: scripts/build.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
require("dotenv").config()
2+
const { execSync } = require("child_process")
3+
4+
try {
5+
// Verify environment variables
6+
const requiredEnvVars = ["APPLE_ID", "APPLE_APP_SPECIFIC_PASSWORD"]
7+
const missing = requiredEnvVars.filter((key) => !process.env[key])
8+
9+
if (missing.length > 0) {
10+
console.error("Missing required environment variables:", missing.join(", "))
11+
process.exit(1)
12+
}
13+
14+
// Run the build command
15+
execSync(
16+
"npm run clean && cross-env NODE_ENV=production tsc && vite build && electron-builder --mac",
17+
{
18+
stdio: "inherit",
19+
env: {
20+
...process.env,
21+
CSC_IDENTITY_AUTO_DISCOVERY: "true"
22+
}
23+
}
24+
)
25+
} catch (error) {
26+
console.error("Build failed:", error)
27+
process.exit(1)
28+
}

0 commit comments

Comments
 (0)