Commit Graph

29 Commits

Author SHA1 Message Date
Jonas Bark
331b864e15 feat(self-test): verdict CTAs — overlay reveal, mode switch, support hand-off
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 13:11:42 +02:00
Jonas Bark
07e78821c5 feat(support): add heads-up about slower replies to chat intro
Second line under the chat intro sets expectations on response time,
translated into all six locales.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-20 08:03:33 +02:00
Jonas Bark
12b51447a3 fix: sending a screenshot without text no longer crashes
SupportComposer._submit caught the send failure to restore the text and
the staged attachment, then rethrew. The send button drops the returned
Future, so that rethrow escaped into the zone as an unhandled error and
was reported as "App crashed".

- _submit is terminal now, and the button invokes it via unawaited() so
  no Future is silently dropped. The page-level rethrows stay: they are
  how the composer learns it must restore.
- The page-level send catches forward through recordError
  ('support.chat.send') — this path had no crash reporting at all.
- Interim client mitigation for image-only messages: substitute a
  localized placeholder body when the body is empty but an attachment is
  present, since the send-support-message edge function still rejects an
  empty body.
- A failed send no longer orphans the uploaded blob: the successful
  upload is retained against the staged attachment the composer restores,
  so a retry re-uses it instead of uploading a second copy (there is no
  client-side delete for the attachment bucket).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-17 13:14:18 +02:00
Jonas Bark
f2cc8ba930 fix: attach menu null-check on defunct context, allow .log attachments
The attach dropdown's MenuButtons resolved context.i18n at overlay
rebuild time; after a file-picker round trip the captured composer
context can be defunct, and Localizations.of on it returns null in
release builds (assert stripped) — the menu broke with 'Null check
operator used on a null value'. Resolve the strings before opening the
dropdown instead. Also allow .log files — the app's own exported logs
were rejected by the extension filter.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-13 08:55:59 +02:00
Jonas Bark
acea58806a fix info button 2026-07-09 20:48:18 +02:00
Jonas Bark
8bb86dce17 perf: open support chat instantly; gather diagnostics in background
debugText now runs a multi-second mDNS scan. Stop awaiting it before
navigating — kick it off as a future, open the chat immediately, and let
SupportChatPage await it lazily for the diagnostic preview and at send time.
2026-06-22 17:00:17 +02:00
Jonas Bark
4def703293 adjust issue visibility 2026-05-17 19:35:16 +02:00
Jonas Bark
78294aefeb Support intake form: "Something else" category + DE wording fix
Adds a fifth top-level intake category for problems that don't fit
the trainer-app / controller / smart-trainer / account buckets — no
follow-up dropdown, the user just continues to the composer.

Also renames "Anleitung lesen" → "Beitrag lesen" in the German
recommended-help button.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 19:32:11 +02:00
Jonas Bark
946790b22e Support intake form: use settings + connected controllers
Skip the "Which trainer app?" dropdown when one is already selected in
settings (pre-fill subcategory_value with its name). For "Which
controller?", restrict the catalogue to controllers actually paired
via core.connection.controllerDevices; fall back to the full list
when nothing is connected so users can still report pairing issues.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 19:16:56 +02:00
Jonas Bark
6f4bdad16c Support chat: intake form on new chats
Adds a small intake form to the new-chat empty state — users pick a
problem category (trainer app / controller / smart trainer / account)
plus a follow-up, see matching public issues with optional blog/video
links, and the answers ride along with the first message as JSON for
later analysis. Translations added for de/es/fr/it/pl.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-17 19:10:07 +02:00
Jonas Bark
106bea2857 show known open issues at the top of the Support chat
So users can spot already-tracked problems before opening a chat.
Each title links to https://bikecontrol.app/issues/{id}.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 08:40:50 +02:00
Jonas Bark
c5f3fe213b support chat: linkify URLs in incoming admin messages
Adds a `_LinkifiedText` widget used in place of the plain `Text` for
non-user (admin) message bodies. Scans the body for `http(s)://...`
and `www.X` URLs, strips trailing sentence punctuation that would
otherwise get swept into the match (`.`, `)`, `,`, etc.), and renders
the matched range as a tappable `TextSpan` that opens the URL in the
system browser via `url_launcher` (LaunchMode.externalApplication).

Implemented as a `StatefulWidget` so the `TapGestureRecognizer`s are
disposed with the widget. Falls back to a plain `Text` when no URLs
are found, to avoid `Text.rich` overhead on the common case.

User-sent messages stay as plain `Text` — the sender already knows
what they typed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 14:09:51 +02:00
Jonas Bark
390d09b964 UI adjustments, add screenshot to support 2026-05-13 09:05:48 +02:00
Jonas Bark
e15fb761ab disable thread creation for now 2026-05-07 15:26:37 +02:00
Jonas Bark
847a2962f5 UI, support adjustments 2026-05-05 15:27:28 +02:00
Jonas Bark
34ce646364 fix: hide Create Thread CTA on success_rating bubbles
The rating prompt already has its own primary 'Rate BikeControl'
button; the secondary 'Create Thread' / 'Replies (N)' link below
made the bubble look noisy and invited the user to start a thread on
a non-conversational nudge. Suppress it when isRatingPrompt is true.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 09:10:55 +02:00
Jonas Bark
4b40a3e7a8 feat: render 'success_rating' admin messages as a rating CTA
When an admin-side support-chat message arrives with body
'success_rating', the bubble swaps the raw token for a localised
thank-you sentence ('Thank you for using BikeControl! Please consider
rating BikeControl in the {store} — it helps a lot!') and renders an
inline 'Rate BikeControl' primary button below it.

The {store} placeholder picks the platform-native store name —
App Store on iOS / macOS, Play Store on Android, Microsoft Store on
Windows, with App Store as the web/Linux fallback. The button launches
InAppReview.requestReview() when supported and falls back to
openStoreListing(appStoreId: 'id6753721284', microsoftStoreId:
'9NP42GS03Z26') otherwise — same configuration the existing menu
'Leave a review' entry already uses.

i18n: new successRatingMessage{store} + rateBikeControl keys
translated across en/de/es/fr/it/pl.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 09:05:04 +02:00
Jonas Bark
9771d046fe show support chat indicator 2026-04-28 08:57:46 +02:00
Jonas Bark
6dd0dd92a1 Support UI adjustments 2026-04-27 19:20:28 +02:00
Jonas Bark
83359e30ad fix: anchor SupportChatPage to the newest message via reverse ListView
Switches the message ListView to reverse: true with reversed children,
which makes the newest message the natural visual anchor at first
build instead of scrolling there after layout. The previous
ScrollController + post-frame jumpTo(maxScrollExtent) approach raced
the layout: bubble heights (especially with attachments) finalised
later than the post-frame callback, leaving the list short of the
true bottom.

Removes the now-unused ScrollController, _scrollToBottom helper, and
all the manual scroll calls. Removes the RefreshIndicator wrapper too;
pull-to-refresh on a reversed list would trigger from the bottom edge
which is awkward UX, and the page already auto-refreshes on lifecycle
resume via didChangeAppLifecycleState.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 18:54:51 +02:00
Jonas Bark
3ddceb1744 feat: keep SupportChatPage scrolled to the newest message
Adds a ScrollController on the message-list ListView and scrolls to
maxScrollExtent on every event that adds or refreshes content:

- After _bootstrap loads the initial chat history (jump, no animation,
  so the page opens already pinned to the bottom).
- After _refresh fetches new messages on resume / pull-to-refresh
  (animated, only when the message count changed).
- After enqueuing the optimistic placeholder in _send (animated).
- After replacing the placeholder with the server-confirmed message
  (animated).

The helper guards on hasClients so calls before the ListView is built
are safe.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 18:50:11 +02:00
Jonas Bark
ff448717ff UI adjstments 2026-04-27 15:32:23 +02:00
Jonas Bark
a5510f741c feat: introduce Jonas in the empty support-chat state
When the support chat has no messages yet, the empty state now leads
with a Row that pairs the jonas.jpg Avatar (52 px, primary-tinted
circle backdrop matching the in-thread avatar) with the new
supportChatIntro string ("You'll be talking to Jonas from
BikeControl"). The existing supportChatEmpty CTA stays below as the
secondary call-to-action.

i18n: adds supportChatIntro to all six ARBs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 15:27:25 +02:00
Jonas Bark
fad06bd5e1 feat: bundle consecutive same-sender messages into one ChatGroup
Adds SupportMessageGroup widget + groupConsecutiveBySender helper that
splits a flat timeline into runs of same-sender messages, then renders
each run as one shadcn ChatGroup. The avatar prefix shows once per
support-side group instead of next to every reply, matching the
expected chat-thread visual.

SupportMessageBubble is now stateless about its surroundings (returns
just a ChatBubble), with the reply CTA folded into the bubble content
and a showSenderLabel flag so only the first bubble in a run repeats
"You" / "Support". Both SupportChatPage and SupportThreadPage now build
groups before rendering.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 15:12:03 +02:00
Jonas Bark
f8a7071c85 refactor: render chat messages with shadcn ChatGroup + ChatBubble
Drops the hand-rolled Row(avatar + Container(bubble)) layout and uses
shadcn_flutter's ChatGroup/ChatBubble primitives so the support chat
inherits the design system's bubble styling (tail by default, scaled
border-radius and padding from the active theme).

The Avatar still renders openbikecontrol.png and is passed via
ChatGroup.avatarPrefix on support-side messages only. User-side
messages omit the prefix and use AxisAlignmentDirectional.end so the
bubble right-aligns. Bubble color and the inner sender/body/timestamp
column are unchanged. Reply button stays below the ChatGroup with an
extra left-pad of 46 on support-side rows so it lines up under the
bubble instead of the avatar.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 10:59:00 +02:00
Jonas Bark
cb109b74e8 refactor: use shadcn Avatar widget for Support avatar
Replaces the hand-rolled Container+OpenBikeControlLogo with shadcn
Avatar(provider: AssetImage('openbikecontrol.png'), initials: 'OB',
size: 38) so the support avatar follows the design system's
defaults (theme-driven background, border-radius, image-loading
fallback to initials).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 10:52:35 +02:00
Jonas Bark
14b91b9686 feat: add OpenBikeControl logo as Support avatar in chat bubbles
Wraps the existing message bubble in a Row that prepends a 28×28 round
avatar (openbikecontrol.png via OpenBikeControlLogo) on support-side
messages. User-side messages stay as-is. The reply button gets an
extra left-pad of 36 on support-side rows so it lines up under the
bubble instead of under the avatar.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 10:47:36 +02:00
Jonas Bark
911e1f6a50 refactor: move diagnostic preview into SupportComposer, right-aligned
Pulls the collapsible diagnostic-payload chip from SupportChatPage into
SupportComposer at the top, above the staged-attachment chip and the
text-area row. Right-aligned via Align.centerRight + MainAxisSize.min so
it shrink-wraps to the trigger button instead of spanning the full
composer width. SupportComposer now owns the expanded/collapsed state
and resets it on a successful send. SupportChatPage just passes the
diagnosticPreview string through.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 10:44:17 +02:00
Claude
14cbfb9b58 feat: replace trainer feedback and mail support with chat
Adds a Supabase-backed support chat that replaces the existing trainer
feedback page and the mail support entry in the help dropdown. The chat
captures the same telemetry snapshot (extracted into a shared
TelemetrySnapshot module) and supports threaded replies and attachments.

- New SupportChatService wrapping the four edge functions plus a signed
  URL helper for support-attachments storage.
- New SupportChatPage / SupportThreadPage with composer, attachment chips,
  optimistic send, sign-in gate, and pull-to-refresh.
- Help dropdown's Mail entry replaced with "Chat with Support" that
  pre-fills debugText() as freetext on the first message.
- Trainer device details "Provide Feedback" button now opens the chat
  with TelemetrySnapshot.fromDevice telemetry.
- Login screen gets a subordinate "Don't want to sign in? Write a mail
  instead" ghost button (mobile only) that opens the existing mailto.
- Telemetry helpers moved out of the deleted trainer feedback files into
  lib/services/telemetry_snapshot.dart; test rewritten for the new class.

https://claude.ai/code/session_0155Bb4kCYaxKh7zQfoQHZET
2026-04-27 08:18:23 +00:00