26947e96d6
* chore: e2ee. * update. * update. * update. * update. * chore: Use feat/frame-encryption branch of flutter-webrtc. * chore: Add E2EEKEY defines for dart environment, and e2ee switch. * Add encodedInsertableStreams to RTCConfiguration. * update. * feat: Add e2ee indicator for Participant. * feat: add e2ee worker js for flutter web. * dart format. * remove unused file. * fix flutter analyze . * update. * update. * add: indicate for decryption failure, and string key. * remove .lock files. * update. * update. * update e2ee.worker for web. * feat: support setCodecPreferences. * state TrackE2EEStateEvent. * fix wrong import interface from dart_webrtc. * update. * update. * update. * update. * update pubspec.lock. * chore: update protocol and add EncryptionType for Participant. * Update lib/src/e2ee/options.dart Co-authored-by: Théo Monnom <theo.monnom@outlook.com> * fix typo. * revert changes for internal import. * Add _cleanUp() for previous room. * Add e2ee supports detection method for native/web. * Remove redundant overriding methods. * dart format. * Add e2ee.worker code and deployment docs. * chore: remove duplicate words. * chore: using Pbkdf2 derive the key. * Update pubspec.yaml * fix e2ee for safari. * fix key length. * update e2ee.worker.dart.js. * fix. * update proto. * update. * chore: add simulate for rachetKey. * update. * chore: key ratchet for flutter web. * update. * update. * update. * chore: key ratchet export for web. * bump version for xframeworks. * update. * chore: some changes for key safety ratcheting. * update. * fix typo. * update. * rename. * magic bytes for web. * bump version for flutter-webrtc. * fix analyzer. --------- Co-authored-by: Théo Monnom <theo.monnom@outlook.com>
199 lines
5.9 KiB
Dart
199 lines
5.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
extension LKExampleExt on BuildContext {
|
|
//
|
|
Future<bool?> showPublishDialog() => showDialog<bool>(
|
|
context: this,
|
|
builder: (ctx) => AlertDialog(
|
|
title: const Text('Publish'),
|
|
content: const Text('Would you like to publish your Camera & Mic ?'),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, false),
|
|
child: const Text('NO'),
|
|
),
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, true),
|
|
child: const Text('YES'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
|
|
Future<bool?> showUnPublishDialog() => showDialog<bool>(
|
|
context: this,
|
|
builder: (ctx) => AlertDialog(
|
|
title: const Text('UnPublish'),
|
|
content:
|
|
const Text('Would you like to un-publish your Camera & Mic ?'),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, false),
|
|
child: const Text('NO'),
|
|
),
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, true),
|
|
child: const Text('YES'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
|
|
Future<void> showErrorDialog(dynamic exception) => showDialog<void>(
|
|
context: this,
|
|
builder: (ctx) => AlertDialog(
|
|
title: const Text('Error'),
|
|
content: Text(exception.toString()),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx),
|
|
child: const Text('OK'),
|
|
)
|
|
],
|
|
),
|
|
);
|
|
|
|
Future<bool?> showDisconnectDialog() => showDialog<bool>(
|
|
context: this,
|
|
builder: (ctx) => AlertDialog(
|
|
title: const Text('Disconnect'),
|
|
content: const Text('Are you sure to disconnect?'),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, false),
|
|
child: const Text('Cancel'),
|
|
),
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, true),
|
|
child: const Text('Disconnect'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
|
|
Future<bool?> showReconnectDialog() => showDialog<bool>(
|
|
context: this,
|
|
builder: (ctx) => AlertDialog(
|
|
title: const Text('Reconnect'),
|
|
content: const Text('This will force a reconnection'),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, false),
|
|
child: const Text('Cancel'),
|
|
),
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, true),
|
|
child: const Text('Reconnect'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
|
|
Future<void> showReconnectSuccessDialog() => showDialog<void>(
|
|
context: this,
|
|
builder: (ctx) => AlertDialog(
|
|
title: const Text('Reconnect'),
|
|
content: const Text('Reconnection was successful.'),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx),
|
|
child: const Text('OK'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
|
|
Future<bool?> showSendDataDialog() => showDialog<bool>(
|
|
context: this,
|
|
builder: (ctx) => AlertDialog(
|
|
title: const Text('Send data'),
|
|
content: const Text(
|
|
'This will send a sample data to all participants in the room'),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, false),
|
|
child: const Text('Cancel'),
|
|
),
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, true),
|
|
child: const Text('Send'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
|
|
Future<bool?> showDataReceivedDialog(String data) => showDialog<bool>(
|
|
context: this,
|
|
builder: (ctx) => AlertDialog(
|
|
title: const Text('Received data'),
|
|
content: Text(data),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, true),
|
|
child: const Text('OK'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
|
|
Future<bool?> showRecordingStatusChangedDialog(bool isActiveRecording) =>
|
|
showDialog<bool>(
|
|
context: this,
|
|
builder: (ctx) => AlertDialog(
|
|
title: const Text('Room recording reminder'),
|
|
content: Text(isActiveRecording
|
|
? 'Room recording is active.'
|
|
: 'Room recording is stoped.'),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, true),
|
|
child: const Text('OK'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
|
|
Future<bool?> showSubscribePermissionDialog() => showDialog<bool>(
|
|
context: this,
|
|
builder: (ctx) => AlertDialog(
|
|
title: const Text('Allow subscription'),
|
|
content: const Text(
|
|
'Allow all participants to subscribe tracks published by local participant?'),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, false),
|
|
child: const Text('NO'),
|
|
),
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, true),
|
|
child: const Text('YES'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
|
|
Future<SimulateScenarioResult?> showSimulateScenarioDialog() =>
|
|
showDialog<SimulateScenarioResult>(
|
|
context: this,
|
|
builder: (ctx) => SimpleDialog(
|
|
title: const Text('Simulate Scenario'),
|
|
children: SimulateScenarioResult.values
|
|
.map((e) => SimpleDialogOption(
|
|
child: Text(e.name),
|
|
onPressed: () => Navigator.pop(ctx, e),
|
|
))
|
|
.toList(),
|
|
),
|
|
);
|
|
}
|
|
|
|
enum SimulateScenarioResult {
|
|
signalReconnect,
|
|
nodeFailure,
|
|
migration,
|
|
serverLeave,
|
|
switchCandidate,
|
|
clear,
|
|
e2eeKeyRatchet,
|
|
}
|