Skip to content

Commit ddea2bd

Browse files
dart fix lint
1 parent 25e2f4e commit ddea2bd

38 files changed

Lines changed: 85 additions & 113 deletions

commet/lib/client/call_manager.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import 'package:commet/client/components/push_notification/notification_content.
77
import 'package:commet/client/components/push_notification/notification_manager.dart';
88
import 'package:commet/client/components/voip/voip_component.dart';
99
import 'package:commet/client/components/voip/voip_session.dart';
10-
import 'package:commet/client/stale_info.dart';
1110
import 'package:commet/config/platform_utils.dart';
1211
import 'package:commet/utils/notifying_list.dart';
1312
import 'package:intl/intl.dart';

commet/lib/client/components/calendar_room/calendar_sync.dart

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,12 @@ class CalendarSync {
2121
Future<void> syncAllClients() async {
2222
Log.i("Client Manager: ${clientManager}");
2323

24-
if (clientManager == null) {
25-
Timer(Duration(seconds: 30), () => syncAllClients());
26-
} else {
27-
await Future.wait([
28-
for (var client in clientManager!.clients) syncClient(client),
29-
]);
24+
await Future.wait([
25+
for (var client in clientManager.clients) syncClient(client),
26+
]);
3027

31-
Timer(Duration(minutes: 30), () => syncAllClients());
28+
Timer(Duration(minutes: 30), () => syncAllClients());
3229
}
33-
}
3430

3531
Future<void> syncClient(Client client) async {
3632
// Wait for client to come online

commet/lib/client/components/component.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ abstract class NeedsPostLoginInit {
2121
void postLoginInit();
2222

2323
static void doPostLoginInit() {
24-
for (var client in clientManager!.clients) {
24+
for (var client in clientManager.clients) {
2525
if (!client.isLoggedIn()) continue;
2626

2727
var components = client.getAllComponents()!;

commet/lib/client/components/push_notification/android/android_notifier.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,18 @@ class AndroidNotifier implements Notifier {
6565
return;
6666
}
6767

68-
var client = clientManager!.clients
68+
var client = clientManager.clients
6969
.firstWhereOrNull((element) => element.hasRoom(roomId));
7070

7171
if (client == null) {
72-
client = clientManager!.clients.firstWhereOrNull((client) =>
72+
client = clientManager.clients.firstWhereOrNull((client) =>
7373
client
7474
.getComponent<InvitationComponent>()
7575
?.invitations
7676
.any((i) => i.roomId == roomId) ==
7777
true);
7878

79-
for (client in clientManager!.clients) {
79+
for (client in clientManager.clients) {
8080
final comp = client.getComponent<InvitationComponent>();
8181

8282
var invite =
@@ -149,7 +149,7 @@ class AndroidNotifier implements Notifier {
149149

150150
Future<void> displayMessageNotification(
151151
MessageNotificationContent content) async {
152-
var client = clientManager?.getClient(content.clientId);
152+
var client = clientManager.getClient(content.clientId);
153153
var room = client?.getRoom(content.roomId);
154154

155155
if (room == null) {
@@ -254,7 +254,7 @@ class AndroidNotifier implements Notifier {
254254
}
255255

256256
Future<void> displayCallNotification(CallNotificationContent content) async {
257-
var client = clientManager?.getClient(content.clientId);
257+
var client = clientManager.getClient(content.clientId);
258258
var room = client?.getRoom(content.roomId);
259259

260260
if (room == null) {
@@ -355,7 +355,7 @@ class AndroidNotifier implements Notifier {
355355
var uri = CustomURI.parse(details.actionId!);
356356
Log.d("Parsed action uri: $uri");
357357
if (uri case AcceptCallUri _) {
358-
final session = clientManager?.callManager.currentSessions
358+
final session = clientManager.callManager.currentSessions
359359
.where((e) =>
360360
e.sessionId == uri.callId &&
361361
e.client.identifier == uri.clientId)
@@ -367,7 +367,7 @@ class AndroidNotifier implements Notifier {
367367
}
368368

369369
if (uri case DeclineCallUri _) {
370-
final session = clientManager?.callManager.currentSessions
370+
final session = clientManager.callManager.currentSessions
371371
.where((e) =>
372372
e.sessionId == uri.callId &&
373373
e.client.identifier == uri.clientId)

commet/lib/client/components/push_notification/linux/linux_notifier.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class LinuxNotifier implements Notifier {
6060
if (eventId == null) return;
6161
if (message == null) return;
6262

63-
var client = clientManager!.getClient(clientId);
63+
var client = clientManager.getClient(clientId);
6464

6565
if (client == null) return;
6666

@@ -80,13 +80,13 @@ class LinuxNotifier implements Notifier {
8080
if ([callAccept, callDecline].contains(action)) {
8181
final callId = payload['call_id'];
8282
final clientId = payload['client_id'];
83-
final session = clientManager?.callManager.currentSessions
83+
final session = clientManager.callManager.currentSessions
8484
.where(
8585
(e) => e.sessionId == callId && e.client.identifier == clientId)
8686
.firstOrNull;
8787

8888
if (action == callDecline) {
89-
clientManager?.callManager.stopRingtone();
89+
clientManager.callManager.stopRingtone();
9090
}
9191

9292
if (session != null) {
@@ -96,7 +96,7 @@ class LinuxNotifier implements Notifier {
9696

9797
if (action == callDecline) {
9898
session.declineCall();
99-
clientManager?.callManager.stopRingtone();
99+
clientManager.callManager.stopRingtone();
100100
}
101101
} else {
102102
Log.d("Could not find call session");
@@ -131,7 +131,7 @@ class LinuxNotifier implements Notifier {
131131

132132
Future<void> displayMessageNotification(
133133
MessageNotificationContent content) async {
134-
var client = clientManager?.getClient(content.clientId);
134+
var client = clientManager.getClient(content.clientId);
135135
var room = client?.getRoom(content.roomId);
136136

137137
if (room == null) {
@@ -201,7 +201,7 @@ class LinuxNotifier implements Notifier {
201201
}
202202

203203
Future<void> displayCallNotification(CallNotificationContent content) async {
204-
var client = clientManager?.getClient(content.clientId);
204+
var client = clientManager.getClient(content.clientId);
205205
var room = client?.getRoom(content.roomId);
206206

207207
if (room == null) {

commet/lib/client/components/push_notification/modifiers/linux_notification_formatting.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class NotificationModifierLinuxFormatting implements NotificationModifier {
3434
if (content is MessageNotificationContent &&
3535
content.formattedContent != null &&
3636
content.formatType != null) {
37-
final client = clientManager!.getClient(content.clientId);
37+
final client = clientManager.getClient(content.clientId);
3838
final room = client!.getRoom(content.roomId)!;
3939

4040
var formattedContent = await convertFormattedContent(

commet/lib/client/components/push_notification/modifiers/suppress_other_device_active.dart

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,7 @@ class NotificationModifierSuppressOtherActiveDevice
1818
return content;
1919
}
2020

21-
if (clientManager == null) {
22-
Log.w(
23-
"Suppressing notifications for background client is not currently supported");
24-
return content;
25-
}
26-
27-
var clients = clientManager!.clients
21+
var clients = clientManager.clients
2822
.where((element) => element.hasRoom(content.roomId));
2923

3024
for (var client in clients) {

commet/lib/client/components/push_notification/notification_manager.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class NotificationManager {
5050
"https://commet.chat/troubleshoot/android-background-service-failed/")),
5151
);
5252

53-
clientManager?.alertManager.addAlert(alert);
53+
clientManager.alertManager.addAlert(alert);
5454
preferences.setLastForegroundServiceRunSucceeded(null);
5555
}
5656
}

commet/lib/client/components/push_notification/push_notification_component.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ abstract class PushNotificationComponent<T extends Client>
1111
Future<void> updatePushers();
1212

1313
static Future<void> updateAllPushers() async {
14-
if (clientManager == null) {
15-
return;
16-
}
17-
18-
for (var client in clientManager!.clients) {
14+
for (var client in clientManager.clients) {
1915
var notifier = client.getComponent<PushNotificationComponent>();
2016
await notifier?.updatePushers();
2117
}

commet/lib/client/components/push_notification/windows/windows_notifier.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class WindowsNotifier implements Notifier {
6969
if (eventId == null) return;
7070
if (message == null) return;
7171

72-
var client = clientManager!.getClient(clientId);
72+
var client = clientManager.getClient(clientId);
7373

7474
if (client == null) return;
7575

@@ -90,7 +90,7 @@ class WindowsNotifier implements Notifier {
9090
print("Handling call response");
9191
final callId = args['call_id'];
9292
final clientId = args['client_id'];
93-
final session = clientManager?.callManager.currentSessions
93+
final session = clientManager.callManager.currentSessions
9494
.where(
9595
(e) => e.sessionId == callId && e.client.identifier == clientId)
9696
.firstOrNull;
@@ -133,7 +133,7 @@ class WindowsNotifier implements Notifier {
133133
CallNotificationContent content) async {
134134
String? avatarFilePath;
135135

136-
var client = clientManager?.getClient(content.clientId);
136+
var client = clientManager.getClient(content.clientId);
137137
var room = client?.getRoom(content.roomId);
138138

139139
if (room == null) {
@@ -193,7 +193,7 @@ class WindowsNotifier implements Notifier {
193193
MessageNotificationContent content) async {
194194
String? avatarFilePath;
195195

196-
var client = clientManager?.getClient(content.clientId);
196+
var client = clientManager.getClient(content.clientId);
197197
var room = client?.getRoom(content.roomId);
198198

199199
if (room == null) {

0 commit comments

Comments
 (0)