Repository navigation
Add a Parcel widget for deliveries on their way - #27
Open
masonjmiller wants to merge 1 commit into
Open
masonjmiller wants to merge 1 commit into
masonjmiller wants to merge 1 commit into
Conversation
Parcel tracks deliveries from hundreds of carriers, and Parcel Premium comes with an API key that reads the same deliveries the app shows. The widget lists them with what each needs: out for delivery and ready for pickup first, then what needs attention, then the rest by when they're due, each with its carrier's latest scan and "Today", "Tomorrow" or the day it's due, with the delivery window when the carrier gives one. A single delivery gets the whole widget, with its recent scans. A tap opens Parcel. The key is pasted into the widget's settings and kept in the Keychain, shared by every Parcel widget since it belongs to the account. Saving asks Parcel straight away, so the settings say whether the key works. ParcelService asks for each list a widget shows, active or recent, every five minutes, or each every ten when both are on screen. Parcel allows 20 requests an hour per key and answers from what its servers already have, so this stays at twelve. It honours Retry-After on a 429, asks nothing while the displays sleep, and keeps the last list when a refresh fails, with the reason and its age underneath. Parcel passes on what carriers write, so reading is forgiving: null or missing fields are absent, a malformed event or delivery is dropped rather than costing the rest, and a reply without a list is an error rather than "nothing on the way". Expected dates come as timestamps when the carrier gave a zone and otherwise as local strings, where midnight means the day. Event dates are carrier text; ParcelSchedule reads the forms seen in Parcel replies, and the widget leaves a time out rather than guess at one. It follows the theme throughout: its fonts and sizes, text colors, corner radius and gap, rows drawn like widget cards, and the accent for deliveries in transit until another color is picked on the Theme page. That last part uses the same defaultsToAccentColor and widgetPrimaryOrAccent as the Cameras widget (kemalandic#22), identical so that whichever lands second merges cleanly. A tap opens Parcel, so the widget is excluded from Opens on Tap. It reuses the CI code's transport and Keychain store. The tests use a reply shaped like Parcel's, with made-up deliveries. 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.
A native Parcel widget (Info): the deliveries on their way, from Parcel, the package tracker for Apple platforms. Like the Cameras widget (#22), I built it with Claude.
What it does
Setup
Parcel's API is part of Parcel Premium. The key comes from web.parcelapp.net and goes into the widget's settings, which have a Get a Key button. It's kept in the Keychain, not the layout, and shared by every Parcel widget, since it belongs to the account. Saving asks Parcel straight away, so the line under the field says whether the key works.
How
ParcelService(ServiceKey.parcel):Retry-Aftersays after a 429 (15 minutes without one);ParcelAPIreads replies forgivingly, because the API is unversioned and its values come from carriers:nullor wrongly typed fields are absent;{"name": …});ParcelSchedulehandles dates:ConfigFieldType.parcelKeywithParcelKeyEditor.CITransport,KeychainSecretStore(serviceai.pakslab.edgecontrol.parcel) andInMemorySecretStore.WidgetLaunch.excludedgainsparcel, since a tap already opens Parcel.Why not a plugin
I tried that first. Plugin views load from
file://, and Parcel's API answers the CORS preflight (the customapi-keyheader needs one) with a 401 and noAccess-Control-Allow-Origin. A web view can't reach it, so it has to be native.Testing
./Scripts/ci-local.sh allpasses:31 of the tests are new, in three suites:
Retry-After, keeping a stale list, and adding and removing the key.On a XENEON EDGE with a real Parcel Premium account (macOS 27.2):
I haven't yet seen the one-delivery view, the Recent list, or a real 429 on real data; the tests cover them.
Overlaps with #22
defaultsToAccentColorandTheme.widgetPrimaryOrAccent, and the Theme page using them, are copied unchanged from Add a Cameras widget for go2rtc and HLS cameras #22, so whichever lands second merges cleanly. The exception isWidgetLaunch.excluded, where each adds its own widget.ConfigFieldType,ServiceKey,AppModel,WidgetRegistry, the README's widget count and the guide.Whichever lands later, I'll rebase.
🤖 Generated with Claude Code