hatang_chat 0.3.2
hatang_chat: ^0.3.2 copied to clipboard
Hatang live chat for Flutter apps: a native customer-support chat screen that talks to your Hatang site over REST and WebSocket, with identity, events, presence and push hooks.
Changelog #
All notable changes to hatang_chat are documented here. The format follows
Keep a Changelog and the package uses
Semantic Versioning.
[Unreleased] #
0.3.2 - 2026-09-29 #
Added #
- "Chat by hatang.dev" (vi: "Chat bởi hatang.dev") under the composer, like
the web widget. It is plain text, not a link, and follows the
poweredBystring override.
0.3.1 - 2026-09-28 #
Added #
HatangChatLauncherfollows the site's launcher settings from the dashboard: the preset icon (chat, support headset, question mark, round message) or the site's image, and a per-language label that turns it into an extended button such as "Hỗ trợ".childstill overrides both.SiteConfig.launcher(LauncherConfig,LauncherIcon) exposes them.
0.3.0 - 2026-09-28 #
Changed (breaking, 0.x) #
- File attachments need a picker: pass
pickFiletoHatangChat.configure(orHatangAttachmentPicker(pickFile:)). The attach sheet offers "File" only when one is set; camera and photo library are unchanged. Thefile_picker13 picker moved topackage:hatang_chat/file_picker.dart(pickFile: hatangFilePicker), so the main library no longer importsfile_pickerand apps pinned to an older one can add the SDK.
Changed #
- Wider dependency ranges so existing apps resolve without upgrading native
plugins:
flutter_secure_storage>=10.0.0 <12.0.0,flutter_image_compress^2.3.0,image_picker^1.1.2.
Fixed #
reset()before the chat ever connected (autoConnect: false) did nothing, so signing out kept the previous user's visitor. It now forgets the stored visitor without opening a connection.
Added #
HatangAttachmentPicker,HatangAttachmentSourceandHatangFilePickare exported frompackage:hatang_chat/hatang_chat.dart.
0.2.4 - 2026-09-28 #
Fixed #
- "Load earlier messages" showed in a conversation an agent opened with a
greeting although nothing older existed: the first visible item is past
seq 1 because assignment events are hidden from the visitor. The SDK now
uses the gateway's
timeline_has_more(bootstrap andready), falling back to the old guess with gateways that do not send it.
Added #
- Example app on Android: push works with the public demo without any
build flags (the demo's Firebase client options are in
lib/demo.dart; the demo site holds the matching service account).
0.2.3 - 2026-09-28 #
Fixed #
handleNotification(data, context: …)waited until the chat screen was closed, so start-up code that awaited it (as in the README) hung while the chat was open. It now returns once the chat is pushed, like thenavigatorKeyand cold-start paths.
Added #
- Example app: a Push tab (FCM token, paste a token, simulate notification
taps) and optional Firebase Messaging wired to
setPushTokenandhandleNotification, enabled with--dart-define=FIREBASE_*values.
Documentation #
- iOS push checklist in the README (App ID matching the bundle ID exactly,
APNs key in Firebase, capabilities); a mismatched App ID shows up as APNs
TopicDisallowed. - Android: replies use the notification channel
hatang_messages; the README shows how to create it (otherwise Firebase's fallback channel is used). - Local development on the Android emulator uses
adb reverse tcp:3002 tcp:3002;10.0.2.2reached the REST API but not the WebSocket, whose URL the gateway builds from itsCHAT_URL.
0.2.2 - 2026-09-28 #
Added #
- Screenshots on pub.dev and in the README.
- The example app runs against Hatang's public demo inbox when started
without
--dart-definevalues (dart pub unpack hatang_chat, thenflutter runinexample/).
0.2.1 - 2026-09-27 #
Changed #
- Text on the site colour (your bubbles, filled buttons, badges) is now dark
or white, whichever has the higher contrast, instead of white for most
colours. With the default
#0ea5e9it becomes dark (7:1 instead of 2.8:1). Where the site colour is used as text (quick replies, outlined buttons, links, prices) it is darkened or lightened just enough to reach 4.5:1.HatangChatTheme.accentText,contrastRatioandreadableOnexpose the rule; setonMineBubbleto keep white bubble text.
Fixed #
- Card buttons and quick replies use the app's font (
labelLarge) instead of the platform default. - Accessibility: the offline and "connecting" banners meet 4.5:1 contrast, the composer is at least 48 px tall, and order and payment lines wrap instead of overflowing when the text size is doubled.
- The package is WebAssembly-compatible (
flutter build web --wasm): on the web the app version is read fromversion.jsonand the browser from the user agent instead ofpackage_info_plus/device_info_plus, and photos are sent as picked instead of going throughflutter_image_compress. Native platforms behave as before. - Flutter web could not connect: the SDK sent the whole browser user agent as
app.os_versionand the gateway rejected the bootstrap (over 40 characters). The web now reportsChrome 140/Chrome on macOS, and every app field is cut to the gateway's limits on all platforms (locale tags to language-region).
0.2.0 - 2026-09-27 #
Added #
- Cards under the team's messages: product carousel (View opens the product page, Buy prefills the composer), order summary, payment request (VietQR, copyable transfer note, Pay now; paid and expired states), quick replies (newest message only) and the 1–5 star rating with an optional comment.
HatangCommerce(configure(commerce:),HatangConversationView(commerce:)):onBuyProductandonPayhooks so an app can sell through App Store / Play in-app purchase, andshowExternalCheckout: falseto hide the QR code, the transfer note and the web checkout where store rules forbid external payment.- Attachments: an attach button in the composer (camera on phones, photo
library, any file), upload progress on the pending bubble, retry that resumes
an unfinished upload, HEIC/HEIF photos converted to JPEG and large photos
scaled to 2048 px before upload, 10 MB and file-type checks before sending.
Received pictures show as thumbnails cached by attachment id (re-signed links
do not re-download) and open in a full-screen viewer with pinch and
double-tap zoom; other files show name and size and open in the system
handler. Expired links are refreshed once per message.
HatangChatController.attach,pickAndSend,pickAndSendImage,pickAndSendFile;HatangAttachmentPickerfor hosts with their own UI. - History:
HatangChatInbox(andHatangChat.openInbox) lists the visitor's conversations with the agent, last message, time, unread count and resolved status, with pull to refresh and paging; tapping one opens it and "New message" returns to the current conversation.HatangChat.open(context, conversationId: …)now opens that conversation (also from a notification on a cold start). Writing into a resolved conversation reopens it; a closed one is read-only. Engine/controller:listConversations,openConversation,openActive. - Embedding:
setBottomPaddingnow moves a chat screen and launcher that are already shown (bottomPaddingListenable); the launcher uses the host's string overrides. The example app has an Embedded tab. - The User-Agent carries the OS version (
hatang-chat-flutter/0.2.0 (ios/18.1; protocol/1)), andsdkVersionis generated from pubspec.yaml by the release tooling so they cannot drift. ProductCardItem.appStoreProductId/googlePlayProductId(andhasStoreProduct): the in-app purchase ids a shop sets per product in the dashboard, soonBuyProductneeds no SKU mapping.
0.1.0 - 2026-09-28 #
Added #
HatangChat.configurewith a site id and app key; the SDK bootstraps a visitor, keeps its token in secure storage and connects to the Hatang gateway over WebSocket (protocol v1).HatangChatScreenandHatangChat.open(context): a full-screen text chat with greeting, away banner, day separators, typing indicator, read receipts, pending/failed bubbles with tap-to-retry and earlier-history paging.- Session API:
identify,setData,pushEvent,setLocale,setScreen,reset,restoreSession,linkTokenFromUri,session. - Streams:
events,unreadCount(+unreadCountListenable),availability,connectionState. - App lifecycle:
app.stateframes on background/foreground with a delayed socket close and a resume on return. - Push hooks (
setPushToken,clearPushToken,isHatangNotification,handleNotification); device registration is deferred until the gateway ships the/devicesendpoints. - Offline pre-chat form and email request gating, Vietnamese and English strings, light/dark theme derived from the site colour.
Coming #
- Rich cards (products, orders, payments, quick replies, CSAT), attachments and image viewer, inbox of earlier conversations, launcher bubble, embedded conversation view (0.2.0).