From 3a7378d2463615986ff6b375304b7dedd7e1c160 Mon Sep 17 00:00:00 2001 From: ramadhan sjamsani Date: Mon, 27 Apr 2026 13:44:12 +0800 Subject: [PATCH] Phase 3: hide mitra force-close (Akhiri) button in active sessions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removes the Akhiri button + confirmation dialog + _endSession from the mitra active sessions screen. Backend POST .../end-early route and the early_end_mitra_enabled config flag are preserved — re-enable plan lives in requirement/phase3.6.md. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../chat/screens/active_sessions_screen.dart | 33 +------------------ 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/mitra_app/lib/features/chat/screens/active_sessions_screen.dart b/mitra_app/lib/features/chat/screens/active_sessions_screen.dart index a6325d1..429e93c 100644 --- a/mitra_app/lib/features/chat/screens/active_sessions_screen.dart +++ b/mitra_app/lib/features/chat/screens/active_sessions_screen.dart @@ -33,34 +33,6 @@ class _ActiveSessionsScreenState extends ConsumerState { } } - Future _endSession(String sessionId) async { - final confirmed = await showDialog( - context: context, - builder: (ctx) => AlertDialog( - title: const Text('Akhiri Sesi?'), - content: const Text('Apakah kamu yakin ingin mengakhiri sesi ini?'), - actions: [ - TextButton(onPressed: () => Navigator.of(ctx).pop(false), child: const Text('Batal')), - TextButton(onPressed: () => Navigator.of(ctx).pop(true), child: const Text('Ya, Akhiri')), - ], - ), - ); - - if (confirmed == true) { - try { - final apiClient = ref.read(apiClientProvider); - await apiClient.post('/api/mitra/chat-requests/sessions/$sessionId/end'); - _loadSessions(); - } catch (_) { - if (mounted) { - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar(content: Text('Gagal mengakhiri sesi.')), - ); - } - } - } - } - @override Widget build(BuildContext context) { return Scaffold( @@ -78,10 +50,7 @@ class _ActiveSessionsScreenState extends ConsumerState { leading: const Icon(Icons.chat), title: Text(customerName), subtitle: Text('Status: ${session['status']}'), - trailing: TextButton( - onPressed: () => _endSession(session['id'] as String), - child: const Text('Akhiri', style: TextStyle(color: Colors.red)), - ), + trailing: const Icon(Icons.chevron_right), onTap: () => context.push( '/chat/session/${session['id']}', extra: {'customerName': customerName},