206 lines
5.5 KiB
Dart
206 lines
5.5 KiB
Dart
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
extension SolianCallExt 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?> showPlayAudioManuallyDialog() => showDialog<bool>(
|
||
|
context: this,
|
||
|
builder: (ctx) => AlertDialog(
|
||
|
title: const Text('Play Audio'),
|
||
|
content: const Text(
|
||
|
'You need to manually activate audio PlayBack for iOS Safari !'),
|
||
|
actions: [
|
||
|
TextButton(
|
||
|
onPressed: () => Navigator.pop(ctx, false),
|
||
|
child: const Text('Ignore'),
|
||
|
),
|
||
|
TextButton(
|
||
|
onPressed: () => Navigator.pop(ctx, true),
|
||
|
child: const Text('Play Audio'),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
|
||
|
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'),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
enum SimulateScenarioResult {
|
||
|
signalReconnect,
|
||
|
fullReconnect,
|
||
|
speakerUpdate,
|
||
|
nodeFailure,
|
||
|
migration,
|
||
|
serverLeave,
|
||
|
switchCandidate,
|
||
|
e2eeKeyRatchet,
|
||
|
participantName,
|
||
|
participantMetadata,
|
||
|
clear,
|
||
|
}
|