오대리ㅣㅣㅣㅣ
This commit is contained in:
25
mobile/lib/models/context_member_model.dart
Normal file
25
mobile/lib/models/context_member_model.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
class ContextMember {
|
||||
ContextMember({
|
||||
required this.userId,
|
||||
required this.role,
|
||||
required this.displayName,
|
||||
this.avatarUrl,
|
||||
this.statusMessage,
|
||||
});
|
||||
|
||||
final String userId;
|
||||
final String role;
|
||||
final String displayName;
|
||||
final String? avatarUrl;
|
||||
final String? statusMessage;
|
||||
|
||||
factory ContextMember.fromJson(Map<String, dynamic> j) {
|
||||
return ContextMember(
|
||||
userId: j['userId'] as String,
|
||||
role: j['role'] as String? ?? 'member',
|
||||
displayName: j['displayName'] as String? ?? '',
|
||||
avatarUrl: j['avatarUrl'] as String?,
|
||||
statusMessage: j['statusMessage'] as String?,
|
||||
);
|
||||
}
|
||||
}
|
||||
26
mobile/lib/models/context_model.dart
Normal file
26
mobile/lib/models/context_model.dart
Normal file
@@ -0,0 +1,26 @@
|
||||
class ContextModel {
|
||||
ContextModel({
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.kind,
|
||||
this.retentionDays,
|
||||
this.screenshotBlocked = false,
|
||||
});
|
||||
|
||||
final String id;
|
||||
final String name;
|
||||
final String kind;
|
||||
final int? retentionDays;
|
||||
final bool screenshotBlocked;
|
||||
|
||||
factory ContextModel.fromJson(Map<String, dynamic> j) {
|
||||
final policy = j['policy'] as Map<String, dynamic>?;
|
||||
return ContextModel(
|
||||
id: j['id'] as String,
|
||||
name: j['name'] as String,
|
||||
kind: j['kind'] as String,
|
||||
retentionDays: policy?['retentionDays'] as int?,
|
||||
screenshotBlocked: policy?['screenshotBlocked'] == true,
|
||||
);
|
||||
}
|
||||
}
|
||||
39
mobile/lib/models/message_model.dart
Normal file
39
mobile/lib/models/message_model.dart
Normal file
@@ -0,0 +1,39 @@
|
||||
class MessageModel {
|
||||
MessageModel({
|
||||
required this.id,
|
||||
required this.roomId,
|
||||
required this.senderId,
|
||||
required this.body,
|
||||
required this.createdAt,
|
||||
this.kind = 'text',
|
||||
});
|
||||
|
||||
final String id;
|
||||
final String roomId;
|
||||
final String senderId;
|
||||
final String body;
|
||||
final String createdAt;
|
||||
final String kind;
|
||||
|
||||
factory MessageModel.fromJson(Map<String, dynamic> j) {
|
||||
return MessageModel(
|
||||
id: j['id'] as String,
|
||||
roomId: j['roomId'] as String,
|
||||
senderId: j['senderId'] as String,
|
||||
body: j['body'] as String,
|
||||
createdAt: j['createdAt'] as String,
|
||||
kind: j['kind'] as String? ?? 'text',
|
||||
);
|
||||
}
|
||||
|
||||
factory MessageModel.fromWs(Map<String, dynamic> j) {
|
||||
return MessageModel(
|
||||
id: j['id'] as String,
|
||||
roomId: j['roomId'] as String,
|
||||
senderId: j['senderId'] as String,
|
||||
body: j['body'] as String,
|
||||
createdAt: j['createdAt'] as String,
|
||||
kind: j['kind'] as String? ?? 'text',
|
||||
);
|
||||
}
|
||||
}
|
||||
28
mobile/lib/models/profile_model.dart
Normal file
28
mobile/lib/models/profile_model.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
class ProfileModel {
|
||||
ProfileModel({
|
||||
required this.userId,
|
||||
required this.contextId,
|
||||
required this.displayName,
|
||||
this.avatarUrl,
|
||||
this.statusMessage,
|
||||
this.updatedAt,
|
||||
});
|
||||
|
||||
final String userId;
|
||||
final String contextId;
|
||||
final String displayName;
|
||||
final String? avatarUrl;
|
||||
final String? statusMessage;
|
||||
final String? updatedAt;
|
||||
|
||||
factory ProfileModel.fromJson(Map<String, dynamic> j) {
|
||||
return ProfileModel(
|
||||
userId: j['userId'] as String,
|
||||
contextId: j['contextId'] as String,
|
||||
displayName: j['displayName'] as String,
|
||||
avatarUrl: j['avatarUrl'] as String?,
|
||||
statusMessage: j['statusMessage'] as String?,
|
||||
updatedAt: j['updatedAt'] as String?,
|
||||
);
|
||||
}
|
||||
}
|
||||
25
mobile/lib/models/room_model.dart
Normal file
25
mobile/lib/models/room_model.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
class RoomModel {
|
||||
RoomModel({
|
||||
required this.id,
|
||||
required this.isGroup,
|
||||
this.name,
|
||||
this.lastBody,
|
||||
this.lastAt,
|
||||
});
|
||||
|
||||
final String id;
|
||||
final bool isGroup;
|
||||
final String? name;
|
||||
final String? lastBody;
|
||||
final String? lastAt;
|
||||
|
||||
factory RoomModel.fromJson(Map<String, dynamic> j) {
|
||||
return RoomModel(
|
||||
id: j['id'] as String,
|
||||
isGroup: (j['is_group'] as int? ?? 0) == 1,
|
||||
name: j['name'] as String?,
|
||||
lastBody: j['last_body'] as String?,
|
||||
lastAt: j['last_at'] as String?,
|
||||
);
|
||||
}
|
||||
}
|
||||
23
mobile/lib/models/ws_chat_side_event.dart
Normal file
23
mobile/lib/models/ws_chat_side_event.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
class WsTypingEvent {
|
||||
WsTypingEvent({
|
||||
required this.roomId,
|
||||
required this.userId,
|
||||
required this.active,
|
||||
});
|
||||
|
||||
final String roomId;
|
||||
final String userId;
|
||||
final bool active;
|
||||
}
|
||||
|
||||
class WsReadEvent {
|
||||
WsReadEvent({
|
||||
required this.roomId,
|
||||
required this.userId,
|
||||
required this.upToMessageId,
|
||||
});
|
||||
|
||||
final String roomId;
|
||||
final String userId;
|
||||
final String upToMessageId;
|
||||
}
|
||||
Reference in New Issue
Block a user