Repository navigation
feat(chat): open the storefront order chat from the customer card - #113
Merged
Merged
Conversation
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
Release Navigator v2.0.11
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.
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
Draft
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.
Summary
The Chat button on
OrderCustomerCardhad noonPress. This connects it to the per-order chat channel that the storefront backend now creates when a driver is assigned (fleetbase/storefront#117, branchfeat/order-chat).getOrderChannel(order)inChatContextfinds the driver's channel whosemeta.storefront_order_uuidmatches the order uuid, or whosemeta.storefront_order_idmatches the order public id. If it's not in the cached list, it reloadschat-channelsonce, because the channel is created at assignment time and that can be after channels were loaded.getChannelsnow returns the loaded channels so this works.currentChanneland navigates toDriverChatTab > ChatChannel(initial: false, so back lands on the chat list), which reuses the existingChatChannelScreen.meta.storefront_id(not a storefront order),driverNavigator.tabs(otherwise the navigation would do nothing).src/utils/chat.js. They accept both SDKOrderresources 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
OrderScreen.tsxalready failsprettier --checkonmain.Also fixed: opening chat push notifications (
DriverLayout.tsx)ChatListscreen that doesn't exist. The chat stack's home screen isChatHome.ChatChannelScreenrenders that instead of its route params. So tapping a chat notification showed the previously opened channel, or crashed when none had been opened.getChannelandsetCurrentChannelto the listener's effect dependencies. The storage setter changes when the driver signs in.