-
Notifications
You must be signed in to change notification settings - Fork 17
/
main.dart
815 lines (760 loc) · 27.8 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
import 'dart:async';
import 'dart:io';
import 'package:ably_flutter/ably_flutter.dart' as ably;
import 'package:ably_flutter_example/encrypted_messaging_service.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:flutter/material.dart';
import 'constants.dart';
import 'op_state.dart';
import 'push_notifications/push_notification_handlers.dart';
import 'push_notifications/push_notification_service.dart';
import 'ui/message_encryption/message_encryption_sliver.dart';
import 'ui/push_notifications/push_notifications_sliver.dart';
import 'ui/utilities.dart';
Future<void> main() async {
// Before calling any Ably methods, ensure the widget binding is ready.
WidgetsFlutterBinding.ensureInitialized();
PushNotificationHandlers.setUpEventHandlers();
PushNotificationHandlers.setUpMessageHandlers();
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
const defaultChannel = Constants.channelName;
class _MyAppState extends State<MyApp> {
String _platformVersion = 'Unknown';
String _ablyVersion = 'Unknown';
final String _apiKey = const String.fromEnvironment(Constants.ablyApiKey);
ably.Realtime? _realtime;
ably.Rest? _rest;
EncryptedMessagingService? encryptedMessagingService;
ably.ConnectionState? _realtimeConnectionState;
ably.ChannelState? _realtimeChannelState;
final _subscriptionsToDispose = <StreamSubscription>[];
StreamSubscription<ably.Message?>? _channelMessageSubscription;
ably.Message? channelMessage;
ably.PaginatedResult<ably.Message>? _restHistory;
ably.PaginatedResult<ably.Message>? _realtimeHistory;
ably.PaginatedResult<ably.PresenceMessage>? _restPresenceMembers;
ably.PaginatedResult<ably.PresenceMessage>? _restPresenceHistory;
StreamSubscription<ably.PresenceMessage?>?
_channelPresenceMessageSubscription;
ably.PresenceMessage? channelPresenceMessage;
List<ably.PresenceMessage>? _realtimePresenceMembers;
ably.PaginatedResult<ably.PresenceMessage>? _realtimePresenceHistory;
late final PushNotificationService _pushNotificationService =
PushNotificationService();
bool isIOSSimulator = false;
//Storing different message types here to be publishable
List<dynamic> messagesToPublish = [
null,
'A simple panda...',
{
'I am': null,
'and': {
'also': 'nested',
'too': {'deep': true}
}
},
[
42,
{'are': 'you'},
'ok?',
false,
{
'I am': null,
'and': {
'also': 'nested',
'too': {'deep': true}
}
}
]
];
@override
void initState() {
super.initState();
asyncInitState();
}
@override
void dispose() {
// This dispose would not be effective in this example as this is
// a single view but subscriptions must be disposed when listeners are
// implemented in the actual application
//
// See: https://api.flutter.dev/flutter/widgets/State/dispose.html
for (final s in _subscriptionsToDispose) {
s.cancel();
}
super.dispose();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> asyncInitState() async {
String platformVersion;
String ablyVersion;
if (Platform.isIOS) {
final iosInfo = await DeviceInfoPlugin().iosInfo;
setState(() {
isIOSSimulator = !iosInfo.isPhysicalDevice;
});
}
// Platform messages may fail, so we use a try/catch PlatformException.
try {
platformVersion = await ably.platformVersion();
} on ably.AblyException {
platformVersion = 'Failed to get platform version.';
}
try {
ablyVersion = await ably.version();
} on ably.AblyException {
ablyVersion = 'Failed to get Ably version.';
}
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) return;
print('queueing set state');
setState(() {
print('set state');
_platformVersion = platformVersion;
_ablyVersion = ablyVersion;
});
createAblyRealtime();
await createAblyRest();
}
Future<void> createAblyRest() async {
final clientOptions = ably.ClientOptions.fromKey(_apiKey)
..clientId = Constants.clientId
..logLevel = ably.LogLevel.verbose
..logHandler = ({msg, exception}) {
print('Custom logger :: $msg $exception');
};
ably.Rest rest;
try {
rest = ably.Rest(options: clientOptions);
} on Exception catch (error) {
print('Error creating Ably Rest: $error');
rethrow;
}
await encryptedMessagingService!.setRest(rest);
_pushNotificationService.setRestClient(rest);
setState(() {
_rest = rest;
});
const name = 'Hello';
const dynamic data = 'Flutter';
print('publishing messages... name "$name", message "$data"');
try {
await Future.wait([
rest.channels.get(defaultChannel).publish(name: name, data: data),
rest.channels.get(defaultChannel).publish(name: name)
]);
await rest.channels.get(defaultChannel).publish(data: data);
await rest.channels.get(defaultChannel).publish();
print('Messages published');
} on ably.AblyException catch (e) {
print(e.errorInfo);
}
// set state here as handle will have been acquired before calling
// publish on channels above...
setState(() {});
}
void createAblyRealtime() {
final clientOptions = ably.ClientOptions.fromKey(_apiKey)
..clientId = Constants.clientId
..logLevel = ably.LogLevel.verbose
..autoConnect = false
..logHandler = ({msg, exception}) {
print('Custom logger :: $msg $exception');
};
try {
final realtime = ably.Realtime(options: clientOptions);
listenRealtimeConnection(realtime);
final channel = realtime.channels.get(defaultChannel);
listenRealtimeChannel(channel);
encryptedMessagingService = EncryptedMessagingService(realtime);
_pushNotificationService.setRealtimeClient(realtime);
setState(() {
_realtime = realtime;
});
} on Exception catch (error) {
print('Error creating Ably Realtime: $error');
rethrow;
}
}
void listenRealtimeConnection(ably.Realtime realtime) {
final alphaSubscription =
realtime.connection.on().listen((stateChange) async {
if (stateChange.current == ably.ConnectionState.failed) {
logAndDisplayError(stateChange.reason);
}
print('${DateTime.now()}:'
' ConnectionStateChange event: ${stateChange.event}'
'\nReason: ${stateChange.reason}');
setState(() {
_realtimeConnectionState = stateChange.current;
});
});
_subscriptionsToDispose.add(alphaSubscription);
}
void listenRealtimeChannel(ably.RealtimeChannel channel) {
final _channelStateChangeSubscription = channel.on().listen((stateChange) {
print('ChannelStateChange: ${stateChange.current}'
'\nReason: ${stateChange.reason}');
setState(() {
_realtimeChannelState = channel.state;
});
});
_subscriptionsToDispose.add(_channelStateChangeSubscription);
}
// https://github.com/dart-lang/sdk/issues/37498
// ignore: missing_return
static String opStateDescription(
OpState state, String action, String operating, String done) {
switch (state) {
case OpState.notStarted:
return action;
case OpState.inProgress:
return '$operating...';
case OpState.succeeded:
return done;
case OpState.failed:
return 'Failed to $action';
}
}
// https://github.com/dart-lang/sdk/issues/37498
// ignore: missing_return
static Color opStateColor(OpState state) {
switch (state) {
case OpState.notStarted:
return const Color.fromARGB(255, 192, 192, 255);
case OpState.inProgress:
return const Color.fromARGB(255, 192, 192, 192);
case OpState.succeeded:
return const Color.fromARGB(255, 128, 255, 128);
case OpState.failed:
return const Color.fromARGB(255, 255, 128, 128);
}
}
Widget createRTConnectButton() => FlatButton(
padding: EdgeInsets.zero,
onPressed: (_realtime == null) ? null : _realtime!.connect,
child: const Text('Connect'),
);
Widget createRTCloseButton() => FlatButton(
padding: EdgeInsets.zero,
onPressed: (_realtimeConnectionState == ably.ConnectionState.connected)
? _realtime!.close
: null,
child: const Text('Close Connection'),
);
Widget createChannelAttachButton() => FlatButton(
padding: EdgeInsets.zero,
onPressed: (_realtimeConnectionState == ably.ConnectionState.connected)
? () async {
final channel = _realtime!.channels.get(defaultChannel);
print('Attaching to channel ${channel.name}.'
' Current state ${channel.state}.');
try {
await channel.attach();
} on ably.AblyException catch (e) {
print('Unable to attach to channel: ${e.errorInfo}');
}
}
: null,
child: const Text('Attach to Channel'),
);
Widget createChannelDetachButton() => FlatButton(
padding: EdgeInsets.zero,
onPressed: (_realtimeChannelState == ably.ChannelState.attached)
? () {
final channel = _realtime!.channels.get(defaultChannel);
print('Detaching from channel ${channel.name}.'
' Current state ${channel.state}.');
channel.detach();
print('Detached');
}
: null,
child: const Text('Detach from channel'),
);
Widget createChannelSubscribeButton() => FlatButton(
onPressed: (_realtimeChannelState == ably.ChannelState.attached &&
_channelMessageSubscription == null)
? () {
final channel = _realtime!.channels.get(defaultChannel);
final messageStream =
channel.subscribe(names: ['message-data', 'Hello']);
_channelMessageSubscription = messageStream.listen((message) {
print('Channel message received: $message\n'
'\tisNull: ${message.data == null}\n'
'\tisString ${message.data is String}\n'
'\tisMap ${message.data is Map}\n'
'\tisList ${message.data is List}\n');
setState(() {
channelMessage = message;
});
});
print('Channel messages subscribed');
_subscriptionsToDispose.add(_channelMessageSubscription!);
}
: null,
child: const Text('Subscribe'),
);
Widget createChannelUnSubscribeButton() => FlatButton(
onPressed: (_channelMessageSubscription != null)
? () async {
await _channelMessageSubscription!.cancel();
print('Channel messages unsubscribed');
setState(() {
_channelMessageSubscription = null;
});
}
: null,
child: const Text('Unsubscribe'),
);
int typeCounter = 0;
int realtimePubCounter = 0;
Widget createChannelPublishButton() => FlatButton(
onPressed: (_realtimeChannelState == ably.ChannelState.attached)
? () async {
print('Sending rest message...');
final data = messagesToPublish[
(realtimePubCounter++ % messagesToPublish.length)];
final m = ably.Message(name: 'Hello', data: data);
try {
switch (typeCounter % 3) {
case 0:
await _realtime!.channels
.get(defaultChannel)
.publish(name: 'Hello', data: data);
break;
case 1:
await _realtime!.channels
.get(defaultChannel)
.publish(message: m);
break;
case 2:
await _realtime!.channels
.get(defaultChannel)
.publish(messages: [m, m]);
}
if (realtimePubCounter != 0 &&
realtimePubCounter % messagesToPublish.length == 0) {
typeCounter++;
}
print('Realtime message sent.');
setState(() {});
} on ably.AblyException catch (e) {
print(e);
}
}
: null,
color: Colors.yellow,
child: Text(
'Publish: '
'${messagesToPublish[realtimePubCounter % messagesToPublish.length]}',
),
);
int msgCounter = 1;
Widget sendRestMessage() => FlatButton(
onPressed: (_rest == null)
? null
: () async {
print('Sending rest message');
try {
await _rest!.channels
.get(defaultChannel)
.publish(name: 'Hello', data: 'Flutter $msgCounter');
print('Rest message sent.');
setState(() {
++msgCounter;
});
} on ably.AblyException catch (e) {
print('Rest message sending failed:: $e :: ${e.errorInfo}');
}
},
color: Colors.yellow,
child: const Text('Publish'),
);
Widget getPageNavigator<T>({
required bool enabled,
required String name,
required Future<ably.PaginatedResult<T>> Function() query,
required Function(ably.PaginatedResult<T> result) onUpdate,
ably.PaginatedResult<T>? page,
}) =>
FlatButton(
onPressed: !enabled
? null
: () async {
final next = page?.hasNext() ?? false;
print('$name: getting ${next ? 'next' : 'first'} page');
try {
if (page == null || page.items.isEmpty) {
onUpdate(await query());
} else if (next) {
onUpdate(await page.next());
} else {
onUpdate(await page.first());
}
} on ably.AblyException catch (e) {
print('failed to get $name:: $e :: ${e.errorInfo}');
}
},
onLongPress: !enabled
? null
: () async {
onUpdate(await query());
},
color: Colors.yellow,
child: Text('Get $name'),
);
Widget getRestChannelHistory() => getPageNavigator<ably.Message>(
name: 'Rest history',
enabled: _rest != null,
page: _restHistory,
query: () async =>
_rest!.channels.get(defaultChannel).history(ably.RestHistoryParams(
direction: 'forwards',
limit: 10,
)),
onUpdate: (result) {
setState(() {
_restHistory = result;
});
});
Widget getRestChannelPresence() => getPageNavigator<ably.PresenceMessage>(
name: 'Rest presence members',
enabled: _rest != null,
page: _restPresenceMembers,
query: () async => _rest!.channels
.get(defaultChannel)
.presence
.get(ably.RestPresenceParams(limit: 10)),
onUpdate: (result) {
setState(() {
_restPresenceMembers = result;
});
});
Widget getRestChannelPresenceHistory() =>
getPageNavigator<ably.PresenceMessage>(
name: 'Rest presence history',
enabled: _rest != null,
page: _restPresenceHistory,
query: () async => _rest!.channels
.get(defaultChannel)
.presence
.history(ably.RestHistoryParams(limit: 10)),
onUpdate: (result) {
setState(() {
_restPresenceHistory = result;
});
});
Widget releaseRestChannel() => FlatButton(
color: Colors.deepOrangeAccent[100],
onPressed: (_rest == null)
? null
: () => _rest!.channels.release(defaultChannel),
child: const Text('Release Rest channel'),
);
Widget getRealtimeChannelHistory() => getPageNavigator<ably.Message>(
name: 'Realtime history',
enabled: _realtime != null,
page: _realtimeHistory,
query: () async => _realtime!.channels.get(defaultChannel).history(
ably.RealtimeHistoryParams(
limit: 10,
untilAttach: true,
),
),
onUpdate: (result) {
setState(() {
_realtimeHistory = result;
});
});
Widget createChannelPresenceSubscribeButton() => FlatButton(
onPressed: (_realtimeChannelState == ably.ChannelState.attached &&
_channelPresenceMessageSubscription == null)
? () {
final channel = _realtime!.channels.get(defaultChannel);
final presenceMessageStream = channel.presence.subscribe();
_channelPresenceMessageSubscription =
presenceMessageStream.listen((presenceMessage) {
print('Channel presence message received: $presenceMessage');
setState(() {
channelPresenceMessage = presenceMessage;
});
});
setState(() {});
print('Channel presence messages subscribed');
_subscriptionsToDispose
.add(_channelPresenceMessageSubscription!);
}
: null,
child: const Text('Subscribe'),
);
Widget createChannelPresenceUnSubscribeButton() => FlatButton(
onPressed: (_channelPresenceMessageSubscription != null)
? () async {
await _channelPresenceMessageSubscription!.cancel();
print('Channel presence messages unsubscribed');
setState(() {
_channelPresenceMessageSubscription = null;
});
}
: null,
child: const Text('Unsubscribe'),
);
Widget getRealtimeChannelPresence() => FlatButton(
onPressed: (_realtime == null)
? null
: () async {
_realtimePresenceMembers = await _realtime!.channels
.get(defaultChannel)
.presence
.get(ably.RealtimePresenceParams());
setState(() {});
},
color: Colors.yellow,
child: const Text('Get Realtime presence members'),
);
Widget getRealtimeChannelPresenceHistory() =>
getPageNavigator<ably.PresenceMessage>(
name: 'Realtime presence history',
enabled: _realtime != null,
page: _realtimePresenceHistory,
query: () async => _realtime!.channels
.get(defaultChannel)
.presence
.history(ably.RealtimeHistoryParams(limit: 10)),
onUpdate: (result) {
setState(() {
_realtimePresenceHistory = result;
});
});
Widget releaseRealtimeChannel() => FlatButton(
color: Colors.deepOrangeAccent[100],
onPressed: (_realtime == null)
? null
: () => _realtime!.channels.release(defaultChannel),
child: const Text('Release Realtime channel'),
);
final List _presenceData = [
null,
1,
'hello',
{'a': 'b'},
[
1,
'ably',
null,
{'a': 'b'}
],
{
'c': ['a', 'b']
},
];
int _presenceDataIncrementer = 0;
Object get _nextPresenceData =>
_presenceData[_presenceDataIncrementer++ % _presenceData.length]
.toString();
Object? get _currentPresenceData => (_presenceDataIncrementer == 0)
? null
: _presenceData[(_presenceDataIncrementer - 1) % _presenceData.length];
Widget enterRealtimePresence() => FlatButton(
onPressed: (_realtime == null)
? null
: () async {
await _realtime!.channels
.get(defaultChannel)
.presence
.enter(_nextPresenceData);
setState(() {});
},
color: Colors.yellow,
child: const Text('Enter'),
);
Widget updateRealtimePresence() => FlatButton(
onPressed: (_realtime == null)
? null
: () async {
await _realtime!.channels
.get(defaultChannel)
.presence
.updateClient(Constants.clientId, _nextPresenceData);
setState(() {});
},
color: Colors.yellow,
child: const Text('Update'),
);
Widget leaveRealtimePresence() => FlatButton(
onPressed: (_realtime == null)
? null
: () async {
await _realtime!.channels
.get(defaultChannel)
.presence
.leave(_nextPresenceData);
setState(() {});
},
color: Colors.yellow,
child: const Text('Leave'),
);
@override
Widget build(BuildContext context) => MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Ably Plugin Example App'),
),
body: Center(
child: ListView(
padding:
const EdgeInsets.symmetric(vertical: 24, horizontal: 36),
children: [
const Text(
'System Details',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
Text('Running on: $_platformVersion\n'),
Text('Ably version: $_ablyVersion\n'),
Text('Ably Client ID: ${Constants.clientId}\n'),
if (_apiKey == '')
RichText(
text: const TextSpan(
style: TextStyle(color: Colors.black),
children: [
TextSpan(
text: 'Warning: ',
style: TextStyle(
color: Colors.red,
fontWeight: FontWeight.bold)),
TextSpan(text: 'API key is not configured, use '),
TextSpan(
text:
'`flutter run --dart-define=ABLY_API_KEY=your_api_key`',
style: TextStyle()),
TextSpan(
text:
"or add this to the 'additional run args' in the run configuration in Android Studio.")
]),
)
else
Text('API key: $_apiKey'),
const Divider(),
const Text(
'Realtime',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
Text('Connection State: $_realtimeConnectionState'),
Text('Channel State: $_realtimeChannelState'),
Row(
children: <Widget>[
Expanded(
child: createRTConnectButton(),
),
Expanded(
child: createRTCloseButton(),
)
],
),
Row(
children: <Widget>[
Expanded(child: createChannelAttachButton()),
Expanded(child: createChannelDetachButton()),
],
),
Row(
children: <Widget>[
Expanded(child: createChannelSubscribeButton()),
Expanded(child: createChannelUnSubscribeButton()),
],
),
const Text(
'Channel Messages',
style: TextStyle(fontSize: 20),
),
Text('Message from channel: ${channelMessage?.data ?? '-'}'),
createChannelPublishButton(),
getRealtimeChannelHistory(),
..._realtimeHistory?.items
.map((m) => Text('${m.name}:${m.data?.toString()}'))
.toList() ??
[],
const Text(
'Presence',
style: TextStyle(fontSize: 20),
),
Text('Current Data: $_currentPresenceData'),
Row(
children: <Widget>[
Expanded(child: createChannelPresenceSubscribeButton()),
Expanded(child: createChannelPresenceUnSubscribeButton()),
],
),
Text(
'Presence Message from channel:'
' ${channelPresenceMessage?.data ?? '-'}',
),
Row(
children: [
Expanded(
child: enterRealtimePresence(),
),
Expanded(
child: updateRealtimePresence(),
),
Expanded(
child: leaveRealtimePresence(),
),
],
),
getRealtimeChannelPresence(),
..._realtimePresenceMembers
?.map((m) => Text('${m.id}:${m.clientId}:${m.data}'))
.toList() ??
[],
getRealtimeChannelPresenceHistory(),
..._realtimePresenceHistory?.items
.map((m) => Text('${m.id}:${m.clientId}:${m.data}'))
.toList() ??
[],
releaseRealtimeChannel(),
const Divider(),
const Text(
'Rest',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
sendRestMessage(),
Text(
'Rest: press this button to publish a new message with'
' data "Flutter $msgCounter"',
),
getRestChannelHistory(),
..._restHistory?.items
.map((m) => Text('${m.name}:${m.data?.toString()}'))
.toList() ??
[],
getRestChannelPresence(),
..._restPresenceMembers?.items
.map((m) => Text('${m.id}:${m.clientId}:${m.data}'))
.toList() ??
[],
getRestChannelPresenceHistory(),
..._restPresenceHistory?.items
.map((m) => Text('${m.id}:${m.clientId}:${m.data}'))
.toList() ??
[],
releaseRestChannel(),
const Divider(),
MessageEncryptionSliver(encryptedMessagingService),
const Divider(),
PushNotificationsSliver(
_pushNotificationService,
isIOSSimulator: isIOSSimulator,
)
]),
),
),
);
}