fix: the menu bar could never read a browser's address
Tested end to end from the menu bar: a video playing in Arc was saved, its channel subscribed to, and the subscription removed again. Three things were wrong. One script named all seven browsers. AppleScript resolves an application's terminology when it compiles, so naming a browser that is not installed is a compile error — which no `try` can catch, and which kills the whole script before a line of it runs. On a Mac without Brave the lookup failed outright and Arc, first in the list and working, was never asked. Each browser now gets its own script. The tray icon was dropped as soon as it was built. TrayIcon is reference-counted and "the icon is removed when the last instance is dropped", so it was created and destroyed in the same breath. It is held for the life of the app. Subscribing to a channel already present as a bare row — the parent of a video saved from the menu bar — was refused as a duplicate, and the upsert would not have promoted it anyway. Saving a video from a channel therefore made it impossible to subscribe to. The check asks whether it is a subscription, not whether the row exists, and subscribing promotes. Feedback no longer depends on one channel that can fail silently: a notification from the app, the AppleScript one behind it, and the menu's own first line, which reports the last result and cannot be suppressed. A log beside the database records each step, which is how all three of these were found rather than guessed at.
This commit is contained in:
@@ -1696,7 +1696,7 @@ pub async fn add_channel(
|
||||
return Err("No channel found at that link. A channel page or one of its videos works best.".into());
|
||||
};
|
||||
|
||||
if state.db.lock().await.has_channel(&id)? {
|
||||
if state.db.lock().await.is_subscribed(&id)? {
|
||||
return Err(format!("{title} is already in your subscriptions."));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user