Skip to content

Commit e05ff76

Browse files
committed
Merge branch 'main' into fix/fix-build-pipeline
2 parents e328779 + 9a461d2 commit e05ff76

8 files changed

Lines changed: 80 additions & 17 deletions

File tree

src-tauri/.cargo/config.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[build]
2+
rustflags = ["-C", "target-feature=+crt-static"]
3+
4+
[target.aarch64-apple-darwin]
5+
rustflags = [
6+
"-C", "link-arg=-undefined",
7+
"-C", "link-arg=dynamic_lookup",
8+
]
9+
10+
[profile.release]
11+
panic = "abort"
12+
codegen-units = 1
13+
lto = true
14+
opt-level = "s"
15+
strip = true

src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "circle-camera"
3-
version = "0.2.0"
3+
version = "0.3.0"
44
description = "A minimal webcam app that displays in a circle"
55
authors = ["Dev By RayRay"]
66
license = "EUPL"
@@ -9,6 +9,10 @@ edition = "2021"
99

1010
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1111

12+
# Configure specific target optimizations
13+
[target.aarch64-apple-darwin]
14+
rustflags = ["-C", "link-arg=-undefined", "-C", "link-arg=dynamic_lookup"]
15+
1216
[lib]
1317
name = "circle_camera_lib"
1418
crate-type = ["staticlib", "cdylib", "rlib"]

src-tauri/Info.plist

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,11 @@
88
<string>This app needs access to your microphone for video recording.</string>
99
<key>NSCameraUseContinuityCameraDeviceType</key>
1010
<true/>
11+
<key>LSMinimumSystemVersion</key>
12+
<string>10.15</string>
13+
<key>CFBundleInfoDictionaryVersion</key>
14+
<string>6.0</string>
15+
<key>CFBundlePackageType</key>
16+
<string>APPL</string>
1117
</dict>
1218
</plist>

src-tauri/build.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
fn main() {
2+
// Add specific configuration for Mac builds
3+
#[cfg(target_os = "macos")]
4+
{
5+
println!("cargo:rustc-link-lib=framework=WebKit");
6+
}
7+
28
tauri_build::build()
39
}

src-tauri/tauri.conf.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,15 @@
5858
"exceptionDomain": "",
5959
"frameworks": [],
6060
"providerShortName": null,
61-
"signingIdentity": null
61+
"signingIdentity": null,
62+
"minimumSystemVersion": "10.15"
6263
}
6364
},
6465
"plugins": {
6566
"updater": {
6667
"active": true,
6768
"endpoints": [
68-
"http://localhost:8080/latest.json"
69+
"https://github.com/devbyray/circle-camera/releases/latest/download/latest.json"
6970
],
7071
"dialog": true,
7172
"pubkey": ""

src/components/UpdateChecker.vue

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { onMounted, ref } from 'vue';
33
import { version as appVersion } from '../../package.json';
44
5-
// Define TypeScript interface for Update object
5+
// Update the interface to match Tauri's Update type structure
66
interface UpdateInfo {
77
version: string;
88
notes?: string;
@@ -114,19 +114,35 @@ onMounted(async () => {
114114
console.log('Current app version:', currentVersion);
115115
116116
// Check for updates
117-
const update = await check() as UpdateInfo;
118-
updateObject.value = update;
117+
const updateResult = await check();
119118
120-
if (update) {
121-
console.log('Update available:', update.version);
119+
if (updateResult) {
120+
// Create a wrapper that adapts the Tauri Update type to our UpdateInfo interface
121+
updateObject.value = {
122+
version: updateResult.version,
123+
notes: updateResult.body || '', // Change 'notes' to 'body' which is the correct property
124+
date: updateResult.date || '',
125+
downloadAndInstall: (progressCallback?: (progress: number) => void) => {
126+
return updateResult.downloadAndInstall((event) => {
127+
// Convert the DownloadEvent to a simple number progress
128+
if (event.event === 'Progress' && progressCallback && 'data' in event) {
129+
// Use the chunkLength as a proxy for progress percentage
130+
// or implement a custom progress calculation
131+
progressCallback(event.data.chunkLength);
132+
}
133+
});
134+
}
135+
};
136+
137+
console.log('Update available:', updateObject.value.version);
122138
updateAvailable.value = true;
123-
updateVersion.value = update.version;
139+
updateVersion.value = updateObject.value.version;
124140
125141
// Emit event for parent components to handle
126142
emit('update-available', {
127-
version: update.version,
128-
notes: update.notes || 'No release notes available',
129-
releaseUrl: `https://github.com/devbyray/circle-camera/releases/tag/${update.version}`
143+
version: updateObject.value.version,
144+
notes: updateObject.value.notes || 'No release notes available',
145+
releaseUrl: `https://github.com/devbyray/circle-camera/releases/tag/${updateObject.value.version}`
130146
});
131147
} else {
132148
console.log('No update available');

src/components/WebcamContainer.vue

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ const updateInfo = ref({ version: '', notes: '', releaseUrl: '' });
3030
const updateProgress = ref(0);
3131
const updateInProgress = ref(false);
3232
const updateError = ref('');
33-
const updateCheckerRef = ref(null);
33+
const updateCheckerRef = ref<InstanceType<typeof UpdateChecker> | null>(null);
34+
35+
// Store unsubscribe functions to properly clean them up when component is unmounted
36+
const unsubscribeFunctions = ref<Array<() => void>>([]);
3437
3538
// Initialize cameras
3639
async function initializeCameras() {
@@ -81,18 +84,18 @@ function toggleUpdateOverlay() {
8184
}
8285
8386
// Update handlers
84-
function handleUpdateAvailable(info) {
87+
function handleUpdateAvailable(info: { version: string; notes: string; releaseUrl: string }) {
8588
updateAvailable.value = true;
8689
updateInfo.value = info;
8790
console.log('Update available:', info);
8891
}
8992
90-
function handleUpdateProgress(progress) {
93+
function handleUpdateProgress(progress: number) {
9194
updateProgress.value = progress;
9295
updateInProgress.value = true;
9396
}
9497
95-
function handleUpdateError(error) {
98+
function handleUpdateError(error: Error | string) {
9699
updateError.value = error instanceof Error ? error.message : String(error);
97100
updateInProgress.value = false;
98101
}
@@ -155,6 +158,7 @@ async function setupEventListeners() {
155158
console.log('Received border radius event:', event);
156159
borderRadius.value = event.payload as number;
157160
});
161+
unsubscribeFunctions.value.push(unlistenRadius);
158162
console.log('Border radius listener setup complete');
159163
} catch (e) {
160164
console.error('Error setting up border-radius listener:', e);
@@ -166,6 +170,7 @@ async function setupEventListeners() {
166170
console.log('Received border width event:', event);
167171
borderWidth.value = event.payload as number;
168172
});
173+
unsubscribeFunctions.value.push(unlistenWidth);
169174
console.log('Border width listener setup complete');
170175
} catch (e) {
171176
console.error('Error setting up border-width listener:', e);
@@ -177,6 +182,7 @@ async function setupEventListeners() {
177182
console.log('Received border color event:', event);
178183
borderColor.value = event.payload as string;
179184
});
185+
unsubscribeFunctions.value.push(unlistenColor);
180186
console.log('Border color listener setup complete');
181187
} catch (e) {
182188
console.error('Error setting up border-color listener:', e);
@@ -222,6 +228,15 @@ onMounted(async () => {
222228
onUnmounted(() => {
223229
// Remove keyboard event listener
224230
window.removeEventListener('keydown', handleKeyboardShortcuts);
231+
232+
// Unsubscribe from all event listeners
233+
unsubscribeFunctions.value.forEach(unsubscribe => {
234+
try {
235+
unsubscribe();
236+
} catch (e) {
237+
console.error('Error unsubscribing from event:', e);
238+
}
239+
});
225240
});
226241
</script>
227242

0 commit comments

Comments
 (0)