Skip to content

Commit 16918d6

Browse files
committed
fix: disable notification auto sync temporarily
Disable the current problematic implementation and enable it when fixed one day. Fixes: #149
1 parent 1944784 commit 16918d6

File tree

2 files changed

+44
-46
lines changed

2 files changed

+44
-46
lines changed

lib/app.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ class _AppState extends State<App> with WindowListener {
203203
notificationRepository: context.repo(),
204204
storageProvider: getIt(),
205205
);
206-
if (widget.autoSyncNoticeSeconds > 0) {
207-
bloc.start(Duration(seconds: widget.autoSyncNoticeSeconds));
208-
}
206+
// if (widget.autoSyncNoticeSeconds > 0) {
207+
// bloc.start(Duration(seconds: widget.autoSyncNoticeSeconds));
208+
// }
209209
return bloc;
210210
},
211211
),

lib/features/settings/view/settings_page.dart

Lines changed: 41 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@ import 'package:system_theme/system_theme.dart';
99
import 'package:tsdm_client/constants/constants.dart';
1010
import 'package:tsdm_client/constants/layout.dart';
1111
import 'package:tsdm_client/extensions/color.dart';
12-
import 'package:tsdm_client/extensions/duration.dart';
1312
import 'package:tsdm_client/features/checkin/models/models.dart';
14-
import 'package:tsdm_client/features/notification/bloc/auto_notification_cubit.dart';
1513
import 'package:tsdm_client/features/settings/bloc/settings_bloc.dart';
1614
import 'package:tsdm_client/features/settings/repositories/settings_repository.dart';
1715
import 'package:tsdm_client/features/settings/view/debug_showcase_page.dart';
18-
import 'package:tsdm_client/features/settings/widgets/auto_sync_notice_dialog.dart';
1916
import 'package:tsdm_client/features/settings/widgets/check_in_dialog.dart';
2017
import 'package:tsdm_client/features/settings/widgets/clear_cache_bottom_sheet.dart';
2118
import 'package:tsdm_client/features/settings/widgets/color_picker_dialog.dart';
@@ -433,12 +430,12 @@ class _SettingsPageState extends State<SettingsPage> {
433430
final tr = context.t.settingsPage.behaviorSection;
434431
final doublePressExit = state.settingsMap.doublePressExit;
435432
final threadReverseOrder = state.settingsMap.threadReverseOrder;
436-
// Duration in seconds.
437-
final autoSyncNoticeSeconds = state.settingsMap.autoSyncNoticeSeconds;
438-
Duration? autoSyncNoticeDuration;
439-
if (autoSyncNoticeSeconds > 0) {
440-
autoSyncNoticeDuration = Duration(seconds: autoSyncNoticeSeconds);
441-
}
433+
// // Duration in seconds.
434+
// final autoSyncNoticeSeconds = state.settingsMap.autoSyncNoticeSeconds;
435+
// Duration? autoSyncNoticeDuration;
436+
// if (autoSyncNoticeSeconds > 0) {
437+
// autoSyncNoticeDuration = Duration(seconds: autoSyncNoticeSeconds);
438+
// }
442439

443440
return [
444441
SectionTitleText(tr.title),
@@ -463,40 +460,41 @@ class _SettingsPageState extends State<SettingsPage> {
463460
.read<SettingsBloc>()
464461
.add(SettingsValueChanged(SettingsKeys.threadReverseOrder, v)),
465462
),
466-
SectionListTile(
467-
leading: const Icon(Icons.sync_outlined),
468-
title: Text(tr.autoSyncNotice.title),
469-
subtitle: Text(tr.autoSyncNotice.detail),
470-
trailing: Text(
471-
autoSyncNoticeDuration?.readable(context) ?? context.t.general.never,
472-
style: Theme.of(context)
473-
.textTheme
474-
.labelMedium
475-
?.copyWith(color: Theme.of(context).colorScheme.secondary),
476-
),
477-
onTap: () async {
478-
final seconds = await showDialog<int>(
479-
context: context,
480-
builder: (_) => AutoSyncNoticeDialog(autoSyncNoticeSeconds),
481-
);
482-
if (seconds == null || !context.mounted) {
483-
return;
484-
}
485-
if (seconds > 0) {
486-
context
487-
.read<AutoNotificationCubit>()
488-
.start(Duration(seconds: seconds));
489-
} else {
490-
context.read<AutoNotificationCubit>().stop();
491-
}
492-
context.read<SettingsBloc>().add(
493-
SettingsValueChanged(
494-
SettingsKeys.autoSyncNoticeSeconds,
495-
seconds,
496-
),
497-
);
498-
},
499-
),
463+
// SectionListTile(
464+
// leading: const Icon(Icons.sync_outlined),
465+
// title: Text(tr.autoSyncNotice.title),
466+
// subtitle: Text(tr.autoSyncNotice.detail),
467+
// trailing: Text(
468+
// autoSyncNoticeDuration?.readable(context) ??
469+
// context.t.general.never,
470+
// style: Theme.of(context)
471+
// .textTheme
472+
// .labelMedium
473+
// ?.copyWith(color: Theme.of(context).colorScheme.secondary),
474+
// ),
475+
// onTap: () async {
476+
// final seconds = await showDialog<int>(
477+
// context: context,
478+
// builder: (_) => AutoSyncNoticeDialog(autoSyncNoticeSeconds),
479+
// );
480+
// if (seconds == null || !context.mounted) {
481+
// return;
482+
// }
483+
// if (seconds > 0) {
484+
// context
485+
// .read<AutoNotificationCubit>()
486+
// .start(Duration(seconds: seconds));
487+
// } else {
488+
// context.read<AutoNotificationCubit>().stop();
489+
// }
490+
// context.read<SettingsBloc>().add(
491+
// SettingsValueChanged(
492+
// SettingsKeys.autoSyncNoticeSeconds,
493+
// seconds,
494+
// ),
495+
// );
496+
// },
497+
// ),
500498
];
501499
}
502500

0 commit comments

Comments
 (0)