Add persisted local state and baseline CRUD flows
This commit is contained in:
@@ -40,9 +40,24 @@ class SignalsController extends AsyncNotifier<SignalsFeed> {
|
||||
try {
|
||||
return await ref.read(backendGatewayProvider).getSignalsFeed(limit: 20);
|
||||
} catch (_) {
|
||||
final List<PersonProfile> people = ref
|
||||
.read(localRepositoryProvider)
|
||||
.people();
|
||||
final LocalDataState localData = await ref.read(
|
||||
localRepositoryProvider.future,
|
||||
);
|
||||
final List<PersonProfile> people = localData.people;
|
||||
final PersonProfile defaultPerson = people.isNotEmpty
|
||||
? people.first
|
||||
: PersonProfile(
|
||||
id: 'person-default',
|
||||
name: 'Someone Important',
|
||||
relationship: 'Relationship',
|
||||
affinityScore: 70,
|
||||
nextMoment: DateTime(2026, 2, 20),
|
||||
tags: <String>[],
|
||||
notes: '',
|
||||
);
|
||||
final PersonProfile secondaryPerson = people.length > 1
|
||||
? people[1]
|
||||
: defaultPerson;
|
||||
final DateTime now = DateTime.now().toUtc();
|
||||
return SignalsFeed(
|
||||
cursor: 'fallback-signals',
|
||||
@@ -50,9 +65,9 @@ class SignalsController extends AsyncNotifier<SignalsFeed> {
|
||||
SignalItem(
|
||||
id: 'fallback-1',
|
||||
type: 'recommendation',
|
||||
title: 'Check in with ${people.first.name} tonight',
|
||||
title: 'Check in with ${defaultPerson.name} tonight',
|
||||
description: 'A short voice memo can keep momentum.',
|
||||
personId: people.first.id,
|
||||
personId: defaultPerson.id,
|
||||
createdAt: now,
|
||||
),
|
||||
SignalItem(
|
||||
@@ -60,7 +75,7 @@ class SignalsController extends AsyncNotifier<SignalsFeed> {
|
||||
type: 'trend',
|
||||
title: 'Gift idea: practical + personal is trending',
|
||||
description: 'Combine utility with one sentimental detail.',
|
||||
personId: people.last.id,
|
||||
personId: secondaryPerson.id,
|
||||
createdAt: now.subtract(const Duration(hours: 2)),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user