Implement WhatsApp share intake and person quick actions

This commit is contained in:
Rijad Zuzo
2026-02-19 00:09:28 +01:00
parent 818c1046f3
commit d2205bd3d9
15 changed files with 1463 additions and 4 deletions
@@ -40,10 +40,12 @@ void main() {
relationship: 'Friend',
notes: 'test',
tags: <String>['alpha'],
location: 'Berlin',
);
final afterAdd = await container.read(localRepositoryProvider.future);
expect(afterAdd.people.length, initialCount + 1);
expect(afterAdd.people.first.location, 'Berlin');
final String insertedId = afterAdd.people.first.id;
await container
@@ -78,6 +80,68 @@ void main() {
expect(afterDelete.moments.length, beforeCount);
});
test(
'ingestSharedMessage auto-creates profile and reuses source link for follow-up messages',
() async {
final ProviderContainer container = _createContainer();
addTearDown(container.dispose);
final LocalDataState before = await container.read(
localRepositoryProvider.future,
);
final SharedMessageIngestResult first = await container
.read(localRepositoryProvider.notifier)
.ingestSharedMessage(
const SharedMessageIngestInput(
sourceApp: 'whatsapp',
sourceDisplayName: 'Taylor Quinn',
sourceUserId: 'wa:taylor quinn',
messageText: 'Can we do coffee this week?',
),
);
final LocalDataState afterFirst = await container.read(
localRepositoryProvider.future,
);
expect(first.createdProfile, isTrue);
expect(afterFirst.people.length, before.people.length + 1);
expect(
afterFirst.sourceLinks.any((link) => link.profileId == first.profileId),
isTrue,
);
expect(
afterFirst.moments.any(
(RelationshipMoment moment) =>
moment.personId == first.profileId && moment.type == 'whatsapp',
),
isTrue,
);
final SharedMessageIngestResult second = await container
.read(localRepositoryProvider.notifier)
.ingestSharedMessage(
const SharedMessageIngestInput(
sourceApp: 'whatsapp',
sourceDisplayName: 'Taylor Quinn',
sourceUserId: 'wa:taylor quinn',
messageText: 'Lets plan Sunday brunch too.',
),
);
final LocalDataState afterSecond = await container.read(
localRepositoryProvider.future,
);
expect(second.createdProfile, isFalse);
expect(second.profileId, first.profileId);
expect(afterSecond.people.length, afterFirst.people.length);
expect(
afterSecond.sharedMessages.length,
afterFirst.sharedMessages.length + 1,
);
},
);
test('adds, archives, edits, and deletes ideas', () async {
final ProviderContainer container = _createContainer();
addTearDown(container.dispose);