Change PIN to 1451
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
38
apps/captain-mobile-v2/flutter/lib/models/conversation.dart
Normal file
38
apps/captain-mobile-v2/flutter/lib/models/conversation.dart
Normal file
@@ -0,0 +1,38 @@
|
||||
class Conversation {
|
||||
final String id;
|
||||
final String? title;
|
||||
final DateTime createdAt;
|
||||
final DateTime updatedAt;
|
||||
final int messageCount;
|
||||
|
||||
Conversation({
|
||||
required this.id,
|
||||
this.title,
|
||||
required this.createdAt,
|
||||
required this.updatedAt,
|
||||
this.messageCount = 0,
|
||||
});
|
||||
|
||||
factory Conversation.fromJson(Map<String, dynamic> json) {
|
||||
return Conversation(
|
||||
id: json['id'],
|
||||
title: json['title'],
|
||||
createdAt: DateTime.parse(json['created_at']),
|
||||
updatedAt: DateTime.parse(json['updated_at']),
|
||||
messageCount: json['message_count'] ?? 0,
|
||||
);
|
||||
}
|
||||
|
||||
String get displayTitle => title ?? 'New Conversation';
|
||||
|
||||
String get timeAgo {
|
||||
final now = DateTime.now();
|
||||
final diff = now.difference(updatedAt);
|
||||
|
||||
if (diff.inMinutes < 1) return 'Just now';
|
||||
if (diff.inMinutes < 60) return '${diff.inMinutes}m ago';
|
||||
if (diff.inHours < 24) return '${diff.inHours}h ago';
|
||||
if (diff.inDays < 7) return '${diff.inDays}d ago';
|
||||
return '${updatedAt.day}/${updatedAt.month}/${updatedAt.year}';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user