Files
buzz/mobile/lib/features/settings/settings_page/notifications_section.dart
Tom Brow a94ebece0e Revert "fix(mobile): push every message in your own Solo chats (#8615)" (#8690)
Reverts [#8615](https://github.com/block/buzz/pull/8615).

Mobile push for Solo chats returns to mention-only, matching buzz-app,
which alerts on every message only in DMs. This also removes the
lease-size guards #8615 added, since they existed to fit Solo chats into
the lease.

### Validation

- Clean revert of bad9d26142 with no conflicts.
- Mobile lint and the full mobile test suite pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Tom Brow <tomb@squareup.com>
2026-10-29 15:36:16 -07:00

79 lines
2.6 KiB
Dart

part of '../settings_page.dart';
class _NotificationsSection extends ConsumerWidget {
const _NotificationsSection();
@override
Widget build(BuildContext context, WidgetRef ref) {
if (defaultTargetPlatform != TargetPlatform.iOS) {
return const SizedBox.shrink();
}
final community = ref.watch(activeCommunityProvider).value;
if (community == null) return const SizedBox.shrink();
final setup = ref.watch(buzzPushSetupStatusProvider);
final capability = ref.watch(currentRelayPushDescriptorProvider);
final hasCapability =
!capability.isLoading &&
!capability.hasError &&
capability.value != null;
final optOutPending =
community.pushSubscriptionState.pendingTombstoneGeneration != null;
if (!hasCapability &&
!community.pushNotificationsEnabled &&
!optOutPending &&
!setup.hasError) {
return const SizedBox.shrink();
}
final canToggle = hasCapability || community.pushNotificationsEnabled;
void setEnabled(bool enabled) {
unawaited(
ref
.read(communityListProvider.notifier)
.setPushNotificationsEnabled(community.id, enabled),
);
}
return AppListCard(
verticalPadding: Grid.twelve,
children: [
if (setup.hasError)
AppListRow(
key: const ValueKey('push-setup-retry'),
title: 'Notification setup failed',
subtitle: 'You can keep using Buzz. Tap to retry notifications.',
onTap: () => retryBuzzPushSetup(ref),
),
MergeSemantics(
key: const ValueKey('push-notifications-setting'),
child: Stack(
alignment: Alignment.centerRight,
children: [
AppListRow(
key: const ValueKey('push-notifications-enabled'),
title: 'Notifications',
// Reserve horizontal room without letting the switch's 48dp
// layout height expand this single-line row.
trailing: const SizedBox(width: 60),
onTap: canToggle
? () => setEnabled(!community.pushNotificationsEnabled)
: null,
),
Positioned.fill(
right: Grid.xs,
child: Align(
alignment: Alignment.centerRight,
child: Switch.adaptive(
value: community.pushNotificationsEnabled,
onChanged: canToggle ? setEnabled : null,
),
),
),
],
),
),
],
);
}
}