Skip to content

Commit 1428caf

Browse files
committed
fix(notification): remove listener on auth changes
1 parent 16918d6 commit 1428caf

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

lib/features/notification/bloc/auto_notification_cubit.dart

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import 'package:tsdm_client/exceptions/exceptions.dart';
66
import 'package:tsdm_client/extensions/date_time.dart';
77
import 'package:tsdm_client/extensions/fp.dart';
88
import 'package:tsdm_client/features/authentication/repository/authentication_repository.dart';
9-
import 'package:tsdm_client/features/authentication/repository/models/models.dart';
109
import 'package:tsdm_client/features/notification/repository/notification_repository.dart';
1110
import 'package:tsdm_client/shared/providers/storage_provider/storage_provider.dart';
1211
import 'package:tsdm_client/utils/logger.dart';
@@ -37,24 +36,12 @@ final class AutoNotificationCubit extends Cubit<AutoNoticeState>
3736
}) : _authenticationRepository = authenticationRepository,
3837
_notificationRepository = notificationRepository,
3938
_storageProvider = storageProvider,
40-
super(const AutoNoticeStateStopped()) {
41-
_authSub = _authenticationRepository.status.listen(
42-
(e) => switch (e) {
43-
AuthStatusUnknown() ||
44-
AuthStatusLoading() ||
45-
AuthStatusNotAuthed() =>
46-
stop(),
47-
AuthStatusAuthed() => start(null),
48-
},
49-
);
50-
}
39+
super(const AutoNoticeStateStopped());
5140

5241
final AuthenticationRepository _authenticationRepository;
5342
final NotificationRepository _notificationRepository;
5443
final StorageProvider _storageProvider;
5544

56-
late final StreamSubscription<AuthStatus> _authSub;
57-
5845
/// Duration between auto fetch actions.
5946
Duration duration;
6047

@@ -179,7 +166,6 @@ final class AutoNotificationCubit extends Cubit<AutoNoticeState>
179166
@override
180167
Future<void> close() async {
181168
_timer?.cancel();
182-
await _authSub.cancel();
183169
await super.close();
184170
}
185171
}

0 commit comments

Comments
 (0)