Repository navigation
Keep the Mac app syncing and notifying from the menu bar - #1817
Merged
Merged
Conversation
macOS never launches an app for its background tasks, and doesn't run them reliably while it's open, so new notices, files and assignments were never notified about on the Mac. learnX now syncs there every 15 minutes while it runs, also with its windows closed, with a longer budget since nothing ends the run. Settings › Notifications says so on the Mac. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
learnX's menu bar item stays while it runs, with Open learnX, Check for New Content and Quit learnX, as the Electron app's tray does on Windows, so it keeps syncing and notifying with no window open. The Dock shows learnX only while a window is open. Open at Login (Settings) adds it as a login item; opened that way it starts without a window, with JS running for the sync. AppKit's status item, activation policy and launch event come from a new AppKit bundle the Mac app embeds, as Quick Look's does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Mac Catalyst, SystemLoginItem registers with SMAppService, so the test that turns it on would add the test host to the Mac's login items. There it only reads the state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
React Native's root view factory takes launchOptions:, so the Mac Catalyst build failed to compile the login item launch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The module's AsyncFunctions call static functions that the tests call directly, as other modules do, and the tests cover what the menu bar and Open at Login do on iPhone and iPad, where there's no plugin or login item. This keeps the native line coverage above its minimum. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The app menu has a Quit learnX of its own, which a search of every menu item finds first, so the test looks in the menu bar item's menu. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Rui · project thread
What
On the Mac, learnX now checks for new content and sends notifications on a timer of its own while it runs, including with no window open, and stays in the menu bar so it can keep running.
BGTaskSchedulertasks and runs them unreliably even while the app is open, so on the MacsetUpBackgroundFetchno longer registers the system task. InsteadrunInMenuBar()(called fromindex.js) starts a 15-minute JS timer that runs the same sync as the system task, with a longer budget. A shared in-flight guard (runSync) keeps the timer, the system task, and the menu's Check for New Content from running two syncs at once.modules/menubar, plus an AppKit pluginios/MacMenuBarloaded from the app's PlugIns, like MacPreview). It's always shown while learnX runs, with the same menu as the Windows tray: Open learnX, Check for New Content, and Quit learnX, titled in the app's language. Its icon is the X of the app icon, drawn as a template image.SMAppService.mainApp. When macOS opens it as a login item, it starts the React Native host without a window, so it syncs from the menu bar only. A login item the user turned off in System Settings opens System Settings to allow it there.The native fingerprint changes (new pod), so
ota-fingerprint.jsonis updated.Tests
useLoginItemon the Mac, and the Settings and Notification settings captions.MenuBarUITests): closing the last window leaves learnX running in the menu bar, Open learnX brings a window back, and Quit learnX quits it. Open at Login isn't run there, since it would add a real login item.Generated by Claude Code