Files
halobestie-clone/mitra_app/lib/features/profile/support_handles_provider.dart
Ramadhan Sjamsani 31da57d218 Mitra Profil: drop handle subtitle on WA/TG rows
User feedback — the wa.me/... and t.me/... subtitles under "Chat
WhatsApp Kami" / "Chat Telegram Kami" leaked the raw URL into the UI.
Just the label now, matching how typical "contact us" menu entries
read. Tap still launches the deeplink from backend config.

Drop the unused `SupportHandle.displayHandle` getter that produced the
scheme-stripped subtitle — no other call site.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 19:32:46 +08:00

34 lines
1.1 KiB
Dart

import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../core/api/api_client_provider.dart';
class SupportHandle {
final String label;
final String deeplink;
const SupportHandle({required this.label, required this.deeplink});
factory SupportHandle.fromJson(Map<String, dynamic> json) =>
SupportHandle(
label: json['label'] as String? ?? '',
deeplink: json['deeplink'] as String? ?? '',
);
}
class SupportHandles {
final SupportHandle? wa;
final SupportHandle? telegram;
const SupportHandles({this.wa, this.telegram});
factory SupportHandles.fromJson(Map<String, dynamic> json) {
SupportHandle? parse(dynamic v) =>
v is Map<String, dynamic> ? SupportHandle.fromJson(v) : null;
return SupportHandles(wa: parse(json['wa']), telegram: parse(json['telegram']));
}
}
final supportHandlesProvider = FutureProvider<SupportHandles>((ref) async {
final api = ref.read(apiClientProvider);
final response = await api.get('/api/shared/support-handles');
final data = response['data'] as Map<String, dynamic>? ?? const {};
return SupportHandles.fromJson(data);
});