* file reorganization * added activity summary widget to show in chat view and activity launch view * more updates to activity sessions start page * function to ping course * remove duplicate loading of participants * nav bar visibility changes * add generalized image from url widget * update bottom of screen activity status message and add summaries to chat event list * scroll to summary on click * show invited activity sessions in course chats view
40 lines
1.3 KiB
Dart
40 lines
1.3 KiB
Dart
part of "pangea_room_extension.dart";
|
|
|
|
extension RoomInformationRoomExtension on Room {
|
|
String? get creatorId => getState(EventTypes.RoomCreate)?.senderId;
|
|
|
|
bool isFirstOrSecondChild(String roomId) {
|
|
return isSpace &&
|
|
(spaceChildren.any((room) => room.roomId == roomId) ||
|
|
spaceChildren
|
|
.where((sc) => sc.roomId != null)
|
|
.map((sc) => client.getRoomById(sc.roomId!))
|
|
.any(
|
|
(room) =>
|
|
room != null &&
|
|
room.isSpace &&
|
|
room.spaceChildren.any((room) => room.roomId == roomId),
|
|
));
|
|
}
|
|
|
|
Future<bool> get botIsInRoom async {
|
|
final List<User> participants = await requestParticipants();
|
|
return participants.any(
|
|
(User user) => user.id == BotName.byEnvironment,
|
|
);
|
|
}
|
|
|
|
Future<bool> get isBotDM async {
|
|
return botOptions?.mode == BotMode.directChat && await botIsInRoom;
|
|
}
|
|
|
|
String? get roomType =>
|
|
getState(EventTypes.RoomCreate)?.content.tryGet<String>('type');
|
|
|
|
bool isAnalyticsRoomOfUser(String userId) =>
|
|
isAnalyticsRoom && isMadeByUser(userId);
|
|
|
|
bool get isAnalyticsRoom => roomType == PangeaRoomTypes.analytics;
|
|
|
|
bool get isHiddenRoom => isAnalyticsRoom || isHiddenActivityRoom;
|
|
}
|