acceptText method

void acceptText(
  1. int token
)

Implementation

void acceptText(int token) {
  if (finished || nextIsAudio) throw StateError('Not a text slot');
  final wasMixed = mode == AudioReplyMode.mixed;
  if (token == textEnd) {
    if (wasMixed) {
      textDone = true;
      speaking = true;
    } else {
      finished = true;
    }
  } else if (token == turnEnd) {
    finished = true;
  } else if (!wasMixed) {
    if (token == audioStart) {
      mode = AudioReplyMode.audio;
    } else if (token == mixedStart) {
      mode = AudioReplyMode.mixed;
      slotsLeft = 6;
      speaking = false;
      textDone = false;
    }
  }
  _advance(wasMixed);
}