From 89585ea93b5ec74ad4561e56f0699200384b6083 Mon Sep 17 00:00:00 2001 From: Tom Brow Date: Mon, 26 Oct 2026 19:10:16 -0700 Subject: [PATCH] fix(mobile): include legacy Solo chats in the push lease Signed-off-by: Tom Brow --- .../lib/shared/push/push_subscription_provider.dart | 11 ++++++++++- .../shared/push/push_subscription_provider_test.dart | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/mobile/lib/shared/push/push_subscription_provider.dart b/mobile/lib/shared/push/push_subscription_provider.dart index 801f887731..71e194150b 100644 --- a/mobile/lib/shared/push/push_subscription_provider.dart +++ b/mobile/lib/shared/push/push_subscription_provider.dart @@ -7,6 +7,7 @@ import '../../features/channels/channel_mutes/channel_mutes_provider.dart'; import '../../features/channels/channels_provider.dart'; import '../community/community.dart'; import '../community/community_provider.dart'; +import '../me/me_sync.dart'; import '../relay/relay_provider.dart'; import 'push_subscription.dart'; @@ -24,9 +25,15 @@ final pushSubscriptionSyncProvider = Provider((ref) { return; } + // Legacy Solo chats arrive with the encrypted Solo record. Until it loads, + // labelled Solo chats, DMs and mentions still push; the lease updates when + // the record arrives. + final legacySoloChannelIds = + ref.watch(meGroupsProvider).value?.channels ?? const []; final subscriptions = desiredBuzzPushSubscriptions( community: active, channels: channels, + legacySoloChannelIds: legacySoloChannelIds, mutedChannelIds: [ for (final entry in mutes.store.channels.entries) if (entry.value.muted) entry.key, @@ -44,6 +51,7 @@ List? desiredBuzzPushSubscriptions({ required Community community, required Iterable channels, required Iterable mutedChannelIds, + Iterable legacySoloChannelIds = const [], }) { final pubkey = community.pubkey ?? pubkeyFromNsec(community.nsec); if (pubkey == null || pubkey.isEmpty) return null; @@ -55,7 +63,8 @@ List? desiredBuzzPushSubscriptions({ // through an exact #p mention, so subscribing to every joined channel // would over-notify. for (final channel in channels) - if ((channel.isDm || channel.isPersonalChat(pubkey, const [])) && + if ((channel.isDm || + channel.isPersonalChat(pubkey, legacySoloChannelIds)) && channel.isMember && !channel.isArchived) channel.id, diff --git a/mobile/test/shared/push/push_subscription_provider_test.dart b/mobile/test/shared/push/push_subscription_provider_test.dart index 37c290755a..abb0eb467e 100644 --- a/mobile/test/shared/push/push_subscription_provider_test.dart +++ b/mobile/test/shared/push/push_subscription_provider_test.dart @@ -45,6 +45,7 @@ void main() { const otherSoloID = '123e4567-e89b-42d3-a456-426614174006'; const streamID = '123e4567-e89b-42d3-a456-426614174007'; const mutedSoloID = '123e4567-e89b-42d3-a456-426614174008'; + const legacySoloID = '123e4567-e89b-42d3-a456-426614174009'; Channel solo(String id, {String? createdBy, bool archived = false}) => channel( id, @@ -67,14 +68,16 @@ void main() { solo(otherSoloID, createdBy: 'author'), channel(streamID, channelType: 'stream', visibility: 'private'), solo(mutedSoloID), + channel(legacySoloID, channelType: 'stream', visibility: 'private'), ], + legacySoloChannelIds: const [legacySoloID], mutedChannelIds: const [mutedSoloID], ); expect(subscriptions, hasLength(2)); expect(subscriptions!.first.ignore.last.hTags, [mutedSoloID]); expect(subscriptions.last.filter.kinds, buzzPushChannelKinds); - expect(subscriptions.last.filter.hTags, [dmID, soloID]); + expect(subscriptions.last.filter.hTags, [dmID, soloID, legacySoloID]); }); test('returns no desired subscriptions without a signing identity', () {