pair method

  1. @override
Future<OryksaPairing> pair(
  1. String locale
)
override

Starts pairing a phone: the QR and the code to show.

Implementation

@override
Future<OryksaPairing> pair(String locale) async {
  await _wait();
  _pairs++;
  // As the server: a new pairing of the same TV closes the previous one.
  _pairId = pairIdOf(_pairs);
  _seq = 0;
  _state = 'waiting';
  _phone = false;
  _events.clear();
  final code = codes[(_pairs - 1) % codes.length];
  return OryksaPairing(
    pairId: _pairId!,
    code: code,
    url: 'https://oryksa.com/tv?c=$code',
    shortUrl: 'oryksa.com/tv',
    qrPngUrl: '',
    expiresIn: const Duration(minutes: 5),
  );
}