You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.5 KiB
Dart
56 lines
1.5 KiB
Dart
import 'package:flutter/foundation.dart';
|
|
|
|
import 'package:matrix/matrix.dart';
|
|
|
|
import 'package:fluffychat/pangea/extensions/pangea_event_extension.dart';
|
|
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
|
import '../constants/pangea_event_types.dart';
|
|
import 'choreo_record.dart';
|
|
|
|
class ChoreoEvent {
|
|
Event event;
|
|
ChoreoRecord? _content;
|
|
|
|
ChoreoEvent({required this.event}) {
|
|
if (event.type != PangeaEventTypes.choreoRecord) {
|
|
throw Exception(
|
|
"${event.type} should not be used to make a ChoreoEvent",
|
|
);
|
|
}
|
|
}
|
|
|
|
ChoreoRecord? get content {
|
|
try {
|
|
_content ??= event.getPangeaContent<ChoreoRecord>();
|
|
return _content;
|
|
} catch (err, s) {
|
|
if (kDebugMode) rethrow;
|
|
ErrorHandler.logError(e: err, s: s);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
// bool get hasAcceptedMatches =>
|
|
// content?.steps.any(
|
|
// (element) =>
|
|
// element.acceptedOrIgnoredMatch?.status ==
|
|
// PangeaMatchStatus.accepted,
|
|
// ) ??
|
|
// false;
|
|
|
|
// bool get hasIgnoredMatches =>
|
|
// content?.steps.any(
|
|
// (element) =>
|
|
// element.acceptedOrIgnoredMatch?.status == PangeaMatchStatus.ignored,
|
|
// ) ??
|
|
// false;
|
|
|
|
// bool get includedIT =>
|
|
// content?.steps.any((step) {
|
|
// return step.acceptedOrIgnoredMatch?.status ==
|
|
// PangeaMatchStatus.accepted &&
|
|
// (step.acceptedOrIgnoredMatch?.isITStart ?? false);
|
|
// }) ??
|
|
// false;
|
|
}
|