refactor: Added and applied require_trailing_commas linter rule

This commit is contained in:
Malin Errenst 2023-03-02 10:57:52 +01:00
commit ec7acc5385
112 changed files with 3466 additions and 2855 deletions

View file

@ -15,8 +15,10 @@ extension ClientStoriesExtension on Client {
List<User> get contacts => rooms
.where((room) => room.isDirectChat)
.map((room) =>
room.unsafeGetUserFromMemoryOrFallback(room.directChatMatrixID!))
.map(
(room) =>
room.unsafeGetUserFromMemoryOrFallback(room.directChatMatrixID!),
)
.toList();
List<Room> get storiesRooms =>
@ -78,23 +80,30 @@ extension ClientStoriesExtension on Client {
}
Future<Room?> getStoriesRoom(BuildContext context) async {
final candidates = rooms.where((room) =>
room.getState(EventTypes.RoomCreate)?.content.tryGet<String>('type') ==
storiesRoomType &&
room.ownPowerLevel >= 100);
final candidates = rooms.where(
(room) =>
room
.getState(EventTypes.RoomCreate)
?.content
.tryGet<String>('type') ==
storiesRoomType &&
room.ownPowerLevel >= 100,
);
if (candidates.isEmpty) return null;
if (candidates.length == 1) return candidates.single;
return await showModalActionSheet<Room>(
context: context,
actions: candidates
.map(
(room) => SheetAction(
label: room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!),
),
key: room),
)
.toList());
context: context,
actions: candidates
.map(
(room) => SheetAction(
label: room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context)!),
),
key: room,
),
)
.toList(),
);
}
}

View file

@ -23,7 +23,8 @@ class FlutterHiveCollectionsDatabase extends HiveCollectionsDatabase {
static const String _cipherStorageKey = 'hive_encryption_key';
static Future<FlutterHiveCollectionsDatabase> databaseBuilder(
Client client) async {
Client client,
) async {
Logs().d('Open Hive...');
HiveAesCipher? hiverCipher;
try {
@ -96,9 +97,9 @@ class FlutterHiveCollectionsDatabase extends HiveCollectionsDatabase {
}
}
// do not destroy your stable FluffyChat in debug mode
directory = Directory(directory.uri
.resolve(kDebugMode ? 'hive_debug' : 'hive')
.toFilePath());
directory = Directory(
directory.uri.resolve(kDebugMode ? 'hive_debug' : 'hive').toFilePath(),
);
directory.create(recursive: true);
path = directory.path;
}

View file

@ -8,8 +8,9 @@ extension IosBadgeClientExtension on Client {
void updateIosBadge() {
if (PlatformInfos.isIOS) {
// Workaround for iOS not clearing notifications with fcm_shared_isolate
if (!rooms.any((r) =>
r.membership == Membership.invite || (r.notificationCount > 0))) {
if (!rooms.any(
(r) => r.membership == Membership.invite || (r.notificationCount > 0),
)) {
// ignore: unawaited_futures
FlutterLocalNotificationsPlugin().cancelAll();
FlutterAppBadger.removeBadge();

View file

@ -62,7 +62,9 @@ class MatrixLocals extends MatrixLocalizations {
@override
String changedTheGuestAccessRulesTo(
String senderName, String localizedString) {
String senderName,
String localizedString,
) {
return l10n.changedTheGuestAccessRulesTo(senderName, localizedString);
}
@ -73,7 +75,9 @@ class MatrixLocals extends MatrixLocalizations {
@override
String changedTheHistoryVisibilityTo(
String senderName, String localizedString) {
String senderName,
String localizedString,
) {
return l10n.changedTheHistoryVisibilityTo(senderName, localizedString);
}