Repository navigation
보내기 취소: 발송 지연 큐와 취소 API #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+1,453
−32
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
1e8c252
보내기 취소: 서버 발송 지연 큐와 취소 API, 클라이언트 취소 스낵바 추가
littlebit0 1eae0bf
보내기 취소: 종료 시 진행 중 발송 대기, 취소 항목 정리, 취소 스낵바 즉시 표시
littlebit0 dbab32f
발송 큐 용량·동시성 제한: 전체 200·계정별 20 초과 시 429, SMTP 동시 4건, 발송 본문 10MiB 제한
littlebit0 59ae6db
보내기 취소: 비동기 발송 실패 조회(GET /mail/send/:id)와 다시 작성, 취소 남은 시간을 서버 sendAt …
littlebit0 ecb4be1
발송 결과 조회를 최대 5분 백오프로 유지하고, 복구 초안은 새 작성 화면 인스턴스로 연다
littlebit0 0ca917d
복구 작성 화면을 별도 경로로 쌓아 작성 중인 메일을 보존
littlebit0 82a8b99
복구 작성 화면에서 발송한 뒤 go 대신 pop으로 돌아가 기존 작성 내용을 보존
littlebit0 30be151
발송 실패 초안을 앱 단위 상태로 보관하고 '발송 실패 N건' 배너에서 다시 작성·삭제하도록 변경
littlebit0 bf948f7
발송 실패 배너를 한 줄로 줄이고 목록은 높이가 제한된 대화상자에서 보도록 변경
littlebit0 4979b1a
실패 목록 보기 버튼 문구(한국어·영어) 추가
littlebit0 724cbfb
Merge remote-tracking branch 'origin/main' into feat/issue-34-undo-send
littlebit0 a8c4169
Merge remote-tracking branch 'origin/main' into feat/issue-34-undo-send
littlebit0 dc7721c
대기 중인 발송을 모두 취소할 수 있게 하기
littlebit0 03065cc
Merge remote-tracking branch 'origin/main' into feat/issue-34-undo-send
littlebit0 b15d7c1
취소 카운트다운에서 응답 왕복 시간 빼기
littlebit0 b37697c
Merge remote-tracking branch 'origin/main' into feat/issue-34-undo-send
littlebit0 f1cc055
Merge remote-tracking branch 'origin/main' into feat/issue-34-undo-send
littlebit0 34ac986
Merge remote-tracking branch 'origin/main' into feat/issue-34-undo-send
littlebit0 f50c9f3
Merge remote-tracking branch 'origin/main' into feat/issue-34-undo-send
littlebit0 ac0023b
Merge remote-tracking branch 'origin/main' into feat/issue-34-undo-send
littlebit0 41367a6
Merge remote-tracking branch 'origin/main' into feat/issue-34-undo-send
littlebit0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
| import 'package:go_router/go_router.dart'; | ||
|
|
||
| import '../../core/i18n/language_controller.dart'; | ||
| import '../../services/mail_api_client.dart'; | ||
|
|
||
| class FailedSend { | ||
| const FailedSend( | ||
| {required this.id, required this.draft, required this.error}); | ||
| final String id; | ||
| final ComposeDraft draft; | ||
| final String error; | ||
| } | ||
|
|
||
| /// App-level so a failed draft outlives the page and snackbars that reported it. | ||
| class FailedSendsNotifier extends Notifier<List<FailedSend>> { | ||
| @override | ||
| List<FailedSend> build() => const []; | ||
|
|
||
| void add(FailedSend item) => | ||
| state = [...state.where((e) => e.id != item.id), item]; | ||
|
|
||
| void remove(String id) => state = [...state.where((e) => e.id != id)]; | ||
| } | ||
|
|
||
| final failedSendsProvider = | ||
| NotifierProvider<FailedSendsNotifier, List<FailedSend>>( | ||
| FailedSendsNotifier.new); | ||
|
|
||
| /// Reopens a failed draft in the stacked recovery composer and drops it from the list. | ||
| void rewriteFailedSend( | ||
| GoRouter router, FailedSendsNotifier notifier, FailedSend item) { | ||
| notifier.remove(item.id); | ||
| router.push('/compose/recover', extra: item.draft); | ||
| } | ||
|
|
||
| /// Persistent single-row "N failed" indicator; the list lives in a bounded dialog so the | ||
| /// banner never grows and pushes the mail area off screen. | ||
| class FailedSendsBanner extends ConsumerWidget { | ||
| const FailedSendsBanner({super.key}); | ||
|
|
||
| @override | ||
| Widget build(BuildContext context, WidgetRef ref) { | ||
| final items = ref.watch(failedSendsProvider); | ||
| if (items.isEmpty) return const SizedBox.shrink(); | ||
| final strings = ref.watch(appStringsProvider); | ||
| final scheme = Theme.of(context).colorScheme; | ||
|
|
||
| return Material( | ||
| color: scheme.errorContainer, | ||
| child: Padding( | ||
| padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4), | ||
| child: Row( | ||
| children: [ | ||
| Expanded( | ||
| child: Text( | ||
| strings.failedSendsCount(items.length), | ||
| style: Theme.of(context).textTheme.labelLarge?.copyWith( | ||
| color: scheme.onErrorContainer, | ||
| fontWeight: FontWeight.w700, | ||
| ), | ||
| ), | ||
| ), | ||
| TextButton( | ||
| onPressed: () => showDialog<void>( | ||
| context: context, | ||
| builder: (_) => | ||
| _FailedSendsDialog(router: GoRouter.of(context)), | ||
| ), | ||
| child: Text(strings.viewFailedSends), | ||
| ), | ||
| ], | ||
| ), | ||
| ), | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| class _FailedSendsDialog extends ConsumerWidget { | ||
| const _FailedSendsDialog({required this.router}); | ||
| final GoRouter router; | ||
|
|
||
| @override | ||
| Widget build(BuildContext context, WidgetRef ref) { | ||
| final items = ref.watch(failedSendsProvider); | ||
| final strings = ref.watch(appStringsProvider); | ||
| final notifier = ref.read(failedSendsProvider.notifier); | ||
| return AlertDialog( | ||
| title: Text(strings.failedSendsCount(items.length)), | ||
| content: SizedBox( | ||
| width: 480, | ||
| child: ListView.builder( | ||
| shrinkWrap: true, | ||
| itemCount: items.length, | ||
| itemBuilder: (context, i) { | ||
| final item = items[i]; | ||
| return Row( | ||
| children: [ | ||
| Expanded( | ||
| child: Text( | ||
| item.draft.subject.isEmpty | ||
| ? item.draft.to | ||
| : '${item.draft.subject} · ${item.draft.to}', | ||
| maxLines: 1, | ||
| overflow: TextOverflow.ellipsis, | ||
| ), | ||
| ), | ||
| TextButton( | ||
| onPressed: () { | ||
| Navigator.of(context).pop(); | ||
| rewriteFailedSend(router, notifier, item); | ||
| }, | ||
| child: Text(strings.rewriteMail), | ||
| ), | ||
| TextButton( | ||
| onPressed: () { | ||
| if (items.length == 1) Navigator.of(context).pop(); | ||
| notifier.remove(item.id); | ||
| }, | ||
| child: Text(strings.deleteFailedSend), | ||
| ), | ||
| ], | ||
| ); | ||
| }, | ||
| ), | ||
| ), | ||
| actions: [ | ||
| TextButton( | ||
| onPressed: () => Navigator.of(context).pop(), | ||
| child: Text(strings.close), | ||
| ), | ||
| ], | ||
| ); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.