Skip to content

feat(chat): open the storefront order chat from the customer card - #113

Merged
roncodes merged 14 commits into
feature/v3-redesignfrom
feat/order-customer-chat
Oct 14, 2026
Merged

roncodes merged 14 commits into
feature/v3-redesignfrom
feat/order-customer-chat

Conversation

@roncodes

@roncodes roncodes commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Summary

The Chat button on OrderCustomerCard had no onPress. This connects it to the per-order chat channel that the storefront backend now creates when a driver is assigned (fleetbase/storefront#117, branch feat/order-chat).

  • Lookup: new getOrderChannel(order) in ChatContext finds the driver's channel whose meta.storefront_order_uuid matches the order uuid, or whose meta.storefront_order_id matches the order public id. If it's not in the cached list, it reloads chat-channels once, because the channel is created at assignment time and that can be after channels were loaded. getChannels now returns the loaded channels so this works.
  • Open: sets currentChannel and navigates to DriverChatTab > ChatChannel (initial: false, so back lands on the chat list), which reuses the existing ChatChannelScreen.
  • No channel yet (for example, an order assigned before the backend change): shows an info toast, "Chat with this customer is not available for this order yet." A failed lookup shows an error toast.
  • Hidden when:
    • the order has no meta.storefront_id (not a storefront order),
    • the card is a multi-drop waypoint card for a customer other than the order's customer (the channel only includes the order customer),
    • the chat tab is turned off via driverNavigator.tabs (otherwise the navigation would do nothing).
  • The matching and storefront checks are in src/utils/chat.js. They accept both SDK Order resources and serialized orders.

Tests

  • __tests__/OrderChatChannel-test.js: matching by uuid, falling back to public id, no match, isStorefrontOrder.
  • __tests__/OrderCustomerCard-test.js: button hidden for non-storefront orders and when the chat tab is disabled; navigates when a channel exists; shows the toast and doesn't navigate when there's no channel; shows the error toast when the lookup fails.

yarn test: 7 suites, 20 tests passing.

Notes

  • Not tested on a device or simulator yet.
  • Unrelated and not changed here: OrderScreen.tsx already fails prettier --check on main.

Also fixed: opening chat push notifications (DriverLayout.tsx)

  • The handler sent the driver to a ChatList screen that doesn't exist. The chat stack's home screen is ChatHome.
  • It never set the current chat channel, and ChatChannelScreen renders that instead of its route params. So tapping a chat notification showed the previously opened channel, or crashed when none had been opened.
  • If the channel can't be loaded, it now logs a warning and doesn't navigate. It still carries on to the order-notification branch.
  • Added getChannel and setCurrentChannel to the listener's effect dependencies. The storage setter changes when the driver signs in.

mcnutt0316 and others added 13 commits July 27, 2026 10:50
resizePhoto measured Dimensions.get('window') — the device screen — rather
than the image at the given uri. Captured photos were scaled to the phone's
point size and into the screen's aspect ratio, so proof-of-delivery images
uploaded at a fraction of their real resolution.

Read the actual dimensions with Image.getSize, wrapped as a promise. On
failure it resolves null and resizePhoto returns the original uri, so an
unreadable image uploads full size rather than being lost.

Fixes #89
Fix POD photo resizing to use image dimensions instead of screen size
Both prefixes are honoured so a release branch opened before the rename still
releases. A merge that produces no tag and no publish looks exactly like a
successful one, so the cutover is deliberately not a flag day.
ci(release): adopt the release/v* branch convention
The Chat button on the order customer card had no handler. It now looks up
the order's chat channel (created by the storefront backend when a driver is
assigned, tagged with storefront_order_uuid / storefront_order_id in its meta),
reloading channels once if it is not cached, and opens ChatChannelScreen.

If the order has no channel yet a toast explains that instead of failing
silently. The button is hidden for non-storefront orders, for waypoint
customers other than the order customer, and when the chat tab is disabled.
The notification handler navigated to a ChatList route that does not exist
(the chat stack's home screen is ChatHome), and never set the current chat
channel, which ChatChannelScreen renders instead of its route params. So
opening a chat notification showed the previously opened channel, or crashed
when there was none. Also bail out when the channel cannot be loaded, and add
the chat callbacks the listener uses to its effect dependencies.
@roncodes
roncodes changed the base branch from main to feature/v3-redesign October 14, 2026 09:13
Conflicts came from the v2.0.11 release commits this branch carries:
- src/utils/index.js: keep the image-dimension resize fix, in v3's JSDoc style
- translations/en.json: keep v3's strings and main's location disclosure copy;
  drop the unused skipForNow
- package.json: drop main's jest key, which collides with v3's jest.config.js;
  its modulePathIgnorePatterns move there
@roncodes
roncodes merged commit ed72fdc into feature/v3-redesign Oct 14, 2026
@roncodes
roncodes deleted the feat/order-customer-chat branch October 14, 2026 09:22
@roncodes roncodes mentioned this pull request Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants