Phase 3.3: topic sensitivity + Phase 3.4: auth foundation
Phase 3.3 — Session Topic Sensitivity (complete): - Backend: topic_sensitivity column + session_sensitivity_log, sensitivity service (flip with one-way-latch + audit), PATCH /api/shared/chat/sessions/:id/topic, topic carried in pairing + extension WS payloads, CC filter + sensitive stats + per-mitra sensitive columns on activity page - client_app: TopicSelectionBottomSheet before pricing, topic flows through pairing request, silent WS handler for session_topic_updated - mitra_app: SensitivityBadge + SensitivityTheme + sensitivityConfigProvider, overlay badge + yellow accent, chat screen app-bar toggle with configurable confirmation + latch, extension card shows current flag, history + transcript yellow theme - control_center: Sensitivitas Topik settings section, topic filter + column with inline audit log, sensitive stats dashboard card, mitra activity sensitive columns with QC flag Phase 3.4 — Self-Managed Auth (foundation only): - Migration: auth_sessions + otp_requests tables, social identity columns on customers, password_hash + lockout on control_center_users, OTP + CC lockout app_config keys - New services: password (bcrypt + complexity), token (JWT HS256 + refresh rotation, session_id claim pre-wires future Valkey revocation), social-identity (Google + Apple JWKS), OTP (Fazpass stub — real API TBD) - Constants: AuthProvider + OtpChannel - Middleware, auth route rewrites, WS auth update, Firebase → FCM isolation still pending (next chunk); Fazpass docs + Apple Developer setup still required before E2E testing Docs: - requirement/phase3.3.md, phase3.3-plan.md, phase3.3-testing.md - requirement/phase3.4.md, phase3.4-plan.md Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../chat_request_notifier.dart';
|
||||
import '../../constants.dart';
|
||||
import '../../../router.dart';
|
||||
import 'sensitivity_badge.dart';
|
||||
import 'sensitivity_theme.dart';
|
||||
|
||||
class ChatRequestOverlay extends ConsumerStatefulWidget {
|
||||
final Widget child;
|
||||
@@ -132,12 +135,17 @@ class _ChatRequestOverlayState extends ConsumerState<ChatRequestOverlay>
|
||||
: data.durationMinutes != null
|
||||
? '${data.durationMinutes} Menit'
|
||||
: '';
|
||||
final isSensitive = data.topicSensitivity == TopicSensitivity.sensitive;
|
||||
final theme = SensitivityTheme.of(data.topicSensitivity);
|
||||
|
||||
return Container(
|
||||
decoration: const BoxDecoration(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
||||
boxShadow: [BoxShadow(color: Colors.black26, blurRadius: 10, offset: Offset(0, -2))],
|
||||
borderRadius: const BorderRadius.vertical(top: Radius.circular(20)),
|
||||
border: isSensitive
|
||||
? Border(top: BorderSide(color: theme.badgeBg, width: 4))
|
||||
: null,
|
||||
boxShadow: const [BoxShadow(color: Colors.black26, blurRadius: 10, offset: Offset(0, -2))],
|
||||
),
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
@@ -168,6 +176,10 @@ class _ChatRequestOverlayState extends ConsumerState<ChatRequestOverlay>
|
||||
'Durasi: $durationText',
|
||||
style: const TextStyle(fontSize: 14, color: Colors.grey),
|
||||
),
|
||||
if (isSensitive) ...[
|
||||
const SizedBox(height: 8),
|
||||
SensitivityBadge(sensitivity: data.topicSensitivity, fontSize: 12),
|
||||
],
|
||||
const SizedBox(height: 8),
|
||||
const Text(
|
||||
'Seorang customer ingin curhat denganmu.',
|
||||
|
||||
46
mitra_app/lib/core/chat/widgets/sensitivity_badge.dart
Normal file
46
mitra_app/lib/core/chat/widgets/sensitivity_badge.dart
Normal file
@@ -0,0 +1,46 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../constants.dart';
|
||||
import 'sensitivity_theme.dart';
|
||||
|
||||
/// Small pill-style badge used across the mitra app to indicate a sensitive session.
|
||||
/// Renders nothing for regular sessions.
|
||||
class SensitivityBadge extends StatelessWidget {
|
||||
final TopicSensitivity sensitivity;
|
||||
final double fontSize;
|
||||
final EdgeInsets padding;
|
||||
|
||||
const SensitivityBadge({
|
||||
super.key,
|
||||
required this.sensitivity,
|
||||
this.fontSize = 11,
|
||||
this.padding = const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (sensitivity != TopicSensitivity.sensitive) return const SizedBox.shrink();
|
||||
const theme = SensitivityTheme.sensitive;
|
||||
return Container(
|
||||
padding: padding,
|
||||
decoration: BoxDecoration(
|
||||
color: theme.badgeBg,
|
||||
borderRadius: BorderRadius.circular(999),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.warning_amber_rounded, size: fontSize + 2, color: theme.badgeFg),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'Topik sensitif',
|
||||
style: TextStyle(
|
||||
color: theme.badgeFg,
|
||||
fontSize: fontSize,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
38
mitra_app/lib/core/chat/widgets/sensitivity_theme.dart
Normal file
38
mitra_app/lib/core/chat/widgets/sensitivity_theme.dart
Normal file
@@ -0,0 +1,38 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../constants.dart';
|
||||
|
||||
/// Color tokens used by the mitra chat UI to differentiate regular vs sensitive sessions.
|
||||
class SensitivityTheme {
|
||||
final Color bgTint;
|
||||
final Color accent;
|
||||
final Color banner;
|
||||
final Color badgeBg;
|
||||
final Color badgeFg;
|
||||
|
||||
const SensitivityTheme({
|
||||
required this.bgTint,
|
||||
required this.accent,
|
||||
required this.banner,
|
||||
required this.badgeBg,
|
||||
required this.badgeFg,
|
||||
});
|
||||
|
||||
static const regular = SensitivityTheme(
|
||||
bgTint: Color(0xFFF5D0D6),
|
||||
accent: Color(0xFFBE7C8A),
|
||||
banner: Color(0xFFC4868F),
|
||||
badgeBg: Color(0xFFBE7C8A),
|
||||
badgeFg: Colors.white,
|
||||
);
|
||||
|
||||
static const sensitive = SensitivityTheme(
|
||||
bgTint: Color(0xFFFFE8A3),
|
||||
accent: Color(0xFFB88900),
|
||||
banner: Color(0xFFE0A500),
|
||||
badgeBg: Color(0xFFF7B500),
|
||||
badgeFg: Color(0xFF3D2A00),
|
||||
);
|
||||
|
||||
static SensitivityTheme of(TopicSensitivity s) =>
|
||||
s == TopicSensitivity.sensitive ? sensitive : regular;
|
||||
}
|
||||
Reference in New Issue
Block a user