Files
bluebubbles-app/lib/helpers/ui/attributed_body_helpers.dart
zlshames ec81edfd45 renamed models folder to database
- fix: startup issue
2024-08-15 09:49:31 -04:00

20 lines
678 B
Dart

import 'package:bluebubbles/database/models.dart';
/// Get all audio transcripts from a list of attributed bodies
///
/// [attrBodies] is a list of attributed body objects
///
/// Returns a map of audio transcripts with the message part number as the key
Map<int, String> getAudioTranscriptsFromAttributedBody(List<AttributedBody> attrBodies) {
Map<int, String> transcripts = {};
for (AttributedBody body in attrBodies) {
for (Run run in body.runs) {
if (run.attributes?.audioTranscript != null) {
int partNum = run.attributes!.messagePart ?? 0;
transcripts[partNum] = run.attributes!.audioTranscript!;
}
}
}
return transcripts;
}