refactor: Remove unused dependencies
parent
c5fa552481
commit
53aaee9911
@ -1,7 +0,0 @@
|
|||||||
import 'dart:math';
|
|
||||||
|
|
||||||
const _chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890';
|
|
||||||
Random _rnd = Random();
|
|
||||||
|
|
||||||
String getClientSecret(int length) => String.fromCharCodes(Iterable.generate(
|
|
||||||
length, (_) => _chars.codeUnitAt(_rnd.nextInt(_chars.length))));
|
|
@ -1,30 +0,0 @@
|
|||||||
import 'package:matrix/matrix.dart';
|
|
||||||
|
|
||||||
extension ClientPresenceExtension on Client {
|
|
||||||
List<CachedPresence> get contactList {
|
|
||||||
final directChatsMxid = rooms
|
|
||||||
.where((r) => r.isDirectChat)
|
|
||||||
.map((r) => r.directChatMatrixID)
|
|
||||||
.toSet();
|
|
||||||
final contactList = directChatsMxid
|
|
||||||
.map(
|
|
||||||
(mxid) =>
|
|
||||||
presences[mxid] ??
|
|
||||||
CachedPresence(
|
|
||||||
PresenceType.offline,
|
|
||||||
0,
|
|
||||||
null,
|
|
||||||
false,
|
|
||||||
mxid ?? '',
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
contactList.sort((a, b) => a.userid.compareTo(b.userid));
|
|
||||||
contactList.sort((a, b) => ((a.lastActiveTimestamp ??
|
|
||||||
DateTime.fromMillisecondsSinceEpoch(0))
|
|
||||||
.compareTo(
|
|
||||||
b.lastActiveTimestamp ?? DateTime.fromMillisecondsSinceEpoch(0))));
|
|
||||||
return contactList;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue