From 82c791bb2162c5d2d4084def1a880304ebc7f2dd Mon Sep 17 00:00:00 2001 From: Hank Grabowski Date: Thu, 19 Dec 2024 21:30:14 -0500 Subject: [PATCH] Cleanup TODOs --- lib/models/filters/timeline_entry_filter.dart | 3 +++ lib/riverpod_controllers/connection_manager_services.dart | 2 +- lib/riverpod_controllers/entry_tree_item_services.dart | 6 ------ lib/riverpod_controllers/entry_tree_item_services.g.dart | 2 +- lib/riverpod_controllers/timeline_entry_services.dart | 1 - lib/screens/filter_editor_screen.dart | 3 +-- lib/utils/entry_tree_item_flattening.dart | 1 - 7 files changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/models/filters/timeline_entry_filter.dart b/lib/models/filters/timeline_entry_filter.dart index a57887b..23dfd70 100644 --- a/lib/models/filters/timeline_entry_filter.dart +++ b/lib/models/filters/timeline_entry_filter.dart @@ -34,6 +34,9 @@ enum TimelineEntryFilterAction { } } +final emptyTimelineEntryFilter = TimelineEntryFilter.create( + action: TimelineEntryFilterAction.warn, name: '', enabled: false); + class TimelineEntryFilter { final String id; final TimelineEntryFilterAction action; diff --git a/lib/riverpod_controllers/connection_manager_services.dart b/lib/riverpod_controllers/connection_manager_services.dart index 634328e..5854dbe 100644 --- a/lib/riverpod_controllers/connection_manager_services.dart +++ b/lib/riverpod_controllers/connection_manager_services.dart @@ -83,7 +83,7 @@ Future> myContacts(Ref ref, Profile profile) async { } final _cbiLogger = Logger('ConnectionByIdProvider'); -//TODO May need to bootstrap RP with server call if by ID and doesn't know about it + @riverpod Result connectionById( Ref ref, Profile profile, String id, diff --git a/lib/riverpod_controllers/entry_tree_item_services.dart b/lib/riverpod_controllers/entry_tree_item_services.dart index e868fb7..09706a1 100644 --- a/lib/riverpod_controllers/entry_tree_item_services.dart +++ b/lib/riverpod_controllers/entry_tree_item_services.dart @@ -69,8 +69,6 @@ class EntryTreeManager extends _$EntryTreeManager { @override Result build(Profile profile, String id) { _etmLogger.finest('Building for $id for $profile'); - //TODO try using cache for instead of keep alive - // ref.cacheFor(const Duration(hours: 1)); entryId = id; final entries = ref.watch(_entryTreeItemsProvider(profile)); final entry = entries[id]; @@ -100,7 +98,6 @@ class EntryTreeManager extends _$EntryTreeManager { if (state.isFailure || entry != state.value) { state = Result.ok(entry); - ref.invalidateSelf(); //TODO Confirm need to invalidate (I don't think I do any longer) } return state; @@ -180,7 +177,6 @@ class TimelineUpdater extends _$TimelineUpdater { .toList(); if (entries.isNotEmpty) { _cleanupEntriesForId(id); - //TODO confirm if ID may be wrong, have to think about if this always needs to be a post ID. Maybe this field is superfluous await _processNewItems(entries, profile.userId); } @@ -194,7 +190,6 @@ class TimelineUpdater extends _$TimelineUpdater { } FutureResult deleteEntryById(String id) async { - // TODO fix tiemline is still showing deleted entries even after a refresh _tluLogger.finest('Delete entry: $id'); final result = await ref .read(deleteStatusEntryByIdProvider(profile, id).future) @@ -366,7 +361,6 @@ class StatusWriter extends _$StatusWriter { return true; } - // TODO move to RP timeline entry services FutureResult createNewStatus( Profile profile, String text, { diff --git a/lib/riverpod_controllers/entry_tree_item_services.g.dart b/lib/riverpod_controllers/entry_tree_item_services.g.dart index 1c08682..47521f7 100644 --- a/lib/riverpod_controllers/entry_tree_item_services.g.dart +++ b/lib/riverpod_controllers/entry_tree_item_services.g.dart @@ -569,7 +569,7 @@ class _PostTreeEntryByIdProviderElement String get id => (origin as PostTreeEntryByIdProvider).id; } -String _$entryTreeManagerHash() => r'297419e4f1d6514f666676caf9dcb9db56df2e2f'; +String _$entryTreeManagerHash() => r'4550b72602c1fdd6977608930c259fec2ef622ed'; abstract class _$EntryTreeManager extends BuildlessNotifier> { diff --git a/lib/riverpod_controllers/timeline_entry_services.dart b/lib/riverpod_controllers/timeline_entry_services.dart index 51fa302..1dbeb87 100644 --- a/lib/riverpod_controllers/timeline_entry_services.dart +++ b/lib/riverpod_controllers/timeline_entry_services.dart @@ -18,7 +18,6 @@ Map _timelineEntries(Ref ref, Profile profile) => {}; final _logger = Logger('TimelineEntryManagerProvider'); -//TODO Test using cacheFor to let it expire @Riverpod(keepAlive: true) class TimelineEntryManager extends _$TimelineEntryManager { var entryId = ''; diff --git a/lib/screens/filter_editor_screen.dart b/lib/screens/filter_editor_screen.dart index 65bcd7a..342373b 100644 --- a/lib/screens/filter_editor_screen.dart +++ b/lib/screens/filter_editor_screen.dart @@ -44,7 +44,7 @@ class _FilterEditorScreenState extends ConsumerState { final profile = ref.read(activeProfileProvider); final filter = ref .read(filterByIdProvider(profile, widget.id)) - .value; //TODO Handle error handling + .getValueOrElse(() => emptyTimelineEntryFilter); nameController.text = filter.name; action = filter.action; for (final f in filter.authorFilters) { @@ -69,7 +69,6 @@ class _FilterEditorScreenState extends ConsumerState { Widget build(BuildContext context) { _logger.finest('Build for filter ${widget.id}'); final profile = ref.watch(activeProfileProvider); - //TODO streamline media queries final fieldWidth = MediaQuery.sizeOf(context).width * 0.8; return Scaffold( diff --git a/lib/utils/entry_tree_item_flattening.dart b/lib/utils/entry_tree_item_flattening.dart index a680810..971c2fa 100644 --- a/lib/utils/entry_tree_item_flattening.dart +++ b/lib/utils/entry_tree_item_flattening.dart @@ -17,7 +17,6 @@ extension FlatteningExtensions on EntryTreeItem { required Ref ref}) { final items = []; - // TODO handle if entries aren't in manager final entryForItemResult = ref.read(timelineEntryManagerProvider(profile, id)); if (entryForItemResult.isFailure) {