Skip to content

feat(line): add StartTyping and PlaceholderRecorder integration#811

Merged
alexhoshina merged 2 commits intosipeed:refactor/channel-systemfrom
ex-takashima:feat/line-typing
Feb 26, 2026
Merged

feat(line): add StartTyping and PlaceholderRecorder integration#811
alexhoshina merged 2 commits intosipeed:refactor/channel-systemfrom
ex-takashima:feat/line-typing

Conversation

@ex-takashima
Copy link
Contributor

Summary

  • Implement TypingCapable interface for LINE channel using the loading animation API (1:1 chats only)
  • Integrate PlaceholderRecorder.RecordTypingStop in processEvent for Manager coordination
  • Skip RecordPlaceholder — LINE has no message edit API, so placeholder messages would be uneditable
  • Relax callAPI status check from 200 to 2xx range (loading API may return 202)

LINE API constraints

Feature LINE Support Implementation
Typing indicator Loading animation (1:1 only) StartTyping() with 50s refresh
Message edit Not supported Not implemented
Message delete Not supported (user-only unsend) Not implemented

Changes

  • StartTyping() — new method, periodic 50s refresh goroutine, context-cancel to stop
  • sendLoading() — now accepts context.Context and returns error
  • processEvent() — replaced direct sendLoading call with StartTyping + PlaceholderRecorder integration
  • callAPI()200 check relaxed to 2xx

Split from #728 per @alexhoshina's request to keep that PR focused on MediaStore.

Test plan

  • Verify loading animation appears in 1:1 LINE chats
  • Verify no crash in group chats (typing skipped gracefully)
  • Verify goroutine cleanup on context cancel
  • CI passes (linter + tests)

🤖 Generated with Claude Code

Implement TypingCapable interface for LINE channel using the
loading animation API (1:1 chats only, no group support).

- Add StartTyping() with 50s periodic refresh and context-based stop
- Integrate PlaceholderRecorder.RecordTypingStop in processEvent
- Skip RecordPlaceholder (LINE has no message edit API)
- Change sendLoading to accept context and return error
- Relax callAPI status check from 200 to 2xx range

Design consulted with Codex (GPT-5.2).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
case <-typingCtx.Done():
return
case <-ticker.C:
_ = c.sendLoading(typingCtx, chatID)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error here was discarded; there should at least be a log record

Address review feedback from @alexhoshina and Codex:
- Log sendLoading errors in ticker goroutine instead of discarding
- Only start typing indicator when PlaceholderRecorder is available
  to avoid wasted API calls and unnecessary goroutine creation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ex-takashima
Copy link
Contributor Author

@alexhoshina Thanks for the review! Fixed:

  • sendLoading error logging — ticker goroutine now logs refresh failures via logger.DebugCF instead of discarding
  • Skip typing without recorderStartTyping is now only called when PlaceholderRecorder is available, avoiding wasted API calls and unnecessary goroutine creation

Ready for re-review.

Copy link
Collaborator

@alexhoshina alexhoshina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alexhoshina alexhoshina merged commit d917140 into sipeed:refactor/channel-system Feb 26, 2026
2 checks passed
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