Skip to content

Commit e9269cb

Browse files
authored
fix(mobile): simplify notification settings (#8199)
Keep notification settings as a separate card with a single “Notifications” toggle. Remove the section heading, bell, all subtitles (including permission/capability and pending opt-out messages), and the iOS settings button. Toggle callbacks, capability visibility, persisted opt-in/out, and relay synchronization are unchanged. The disable failure is being investigated separately. This intentionally removes the pending warning rather than claiming to fix synchronization. Tom explicitly requested removal of the immediate opt-out synchronization warning and all other status text; this is an intentional exception to the pending-feedback guidance in VISION_MOBILE.md. [Codex’s finding is answered against that agreed scope](#8199 (comment)). No new tests. Delete tests for the removed permission/settings UI and remove obsolete display assertions from existing recovery tests while preserving their opt-out synchronization coverage. Closest related issue: [#7826](#7826). No duplicate cleanup PR found. ### Validation Mobile formatting/static analysis passed. The full existing mobile suite passed (3,216 tests; 4 skipped), plus the three unconfigured-build tests and gateway recipe checks. Existing opt-out recovery tests exercised the switch, persisted tombstone, snapshot synchronization, and successful relay retry. Before/after renders use the existing Flutter widget fixture with synthetic data and mocked native navigation. No simulator or TestFlight run was performed. After merge, validate the settings row and on/off flow in the next iOS candidate; remote disable failure remains a separate investigation. GitHub CI also passed the mobile tests, unconfigured-build tests, and gateway recipe checks. The [security review](https://github.com/block/buzz/actions/runs/37863885299) completed successfully. The [Android build](https://github.com/block/buzz/actions/runs/37863554077/job/113605025305) passed. The iOS simulator build, native accessibility checks, and unsigned iOS release build passed. [All required CI checks](https://github.com/block/buzz/actions/runs/37863554077) are green. ### Before and after Headless Flutter widget fixture, with synthetic data and mocked native navigation. | Before | After | | --- | --- | | ![Notification settings before](https://raw.githubusercontent.com/block/buzz/8334767435a2896656df7bcc497dcb64a1846d92/pr-8199--before.png) | ![Notification settings after](https://raw.githubusercontent.com/block/buzz/8334767435a2896656df7bcc497dcb64a1846d92/pr-8199--after.png) | Signed-off-by: Tom Brow <[email protected]>
1 parent 4db7bb0 commit e9269cb

4 files changed

Lines changed: 1 addition & 176 deletions

File tree

‎mobile/lib/features/settings/settings_page.dart‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import 'package:package_info_plus/package_info_plus.dart';
1212
import '../../shared/auth/auth.dart';
1313
import '../../shared/clipboard_utils.dart';
1414
import '../../shared/success_haptic.dart';
15-
import '../../shared/push/push_bridge.dart';
1615
import '../../shared/push/push_relay_capability_provider.dart';
1716
import '../../shared/relay/relay.dart';
1817
import '../../shared/utils/string_utils.dart';

‎mobile/lib/features/settings/settings_page/notifications_section.dart‎

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -22,49 +22,14 @@ class _NotificationsSection extends ConsumerWidget {
2222
!optOutPending) {
2323
return const SizedBox.shrink();
2424
}
25-
final authorization = ref.watch(buzzPushAuthorizationStatusProvider);
26-
final status = authorization.value;
27-
final permissionUnavailable = authorization.hasError;
28-
final permissionDenied = status == BuzzPushAuthorizationStatus.denied;
29-
final showSettingsRecovery =
30-
optOutPending ||
31-
(community.pushNotificationsEnabled &&
32-
(permissionDenied || permissionUnavailable));
3325
final canToggle = hasCapability || community.pushNotificationsEnabled;
34-
final subtitle = optOutPending
35-
? 'Waiting for relay confirmation; notifications may continue'
36-
: !community.pushNotificationsEnabled
37-
? 'Off for this community'
38-
: !hasCapability
39-
? 'Push support unavailable; you can still turn notifications off'
40-
: switch (status) {
41-
BuzzPushAuthorizationStatus.notDetermined =>
42-
'Waiting for iOS notification permission',
43-
BuzzPushAuthorizationStatus.denied =>
44-
'Enabled in Buzz, but disabled in iOS Settings',
45-
BuzzPushAuthorizationStatus.authorized ||
46-
BuzzPushAuthorizationStatus.provisional ||
47-
BuzzPushAuthorizationStatus.ephemeral =>
48-
'Receive message notifications from this community',
49-
null when authorization.isLoading =>
50-
'Checking iOS notification permission',
51-
null => 'Enabled in Buzz; iOS permission status unavailable',
52-
};
5326

5427
return AppListCard(
55-
label: 'Notifications',
5628
verticalPadding: Grid.twelve,
5729
children: [
5830
AppListRow(
5931
key: const ValueKey('push-notifications-enabled'),
60-
icon: BuzzIcons.bell,
61-
title: 'Push notifications',
62-
subtitle: subtitle,
63-
subtitleStyle: showSettingsRecovery
64-
? context.textTheme.bodySmall?.copyWith(
65-
color: context.colors.error,
66-
)
67-
: null,
32+
title: 'Notifications',
6833
trailing: Switch.adaptive(
6934
value: community.pushNotificationsEnabled,
7035
onChanged: !canToggle
@@ -86,15 +51,6 @@ class _NotificationsSection extends ConsumerWidget {
8651
),
8752
),
8853
),
89-
if (showSettingsRecovery)
90-
AppListRow(
91-
key: const ValueKey('push-notifications-open-settings'),
92-
icon: BuzzIcons.settings,
93-
title: 'Open iOS Notification Settings',
94-
onTap: () => unawaited(
95-
ref.read(buzzPushNotificationSettingsOpenerProvider)(),
96-
),
97-
),
9854
],
9955
);
10056
}

‎mobile/test/features/settings/notification_recovery_test.dart‎

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ void main() {
6161
final pending = Completer<BuzzPushLeaseDescriptor?>();
6262
final snapshots = <List<Community>>[];
6363
final tombstones = <int?>[];
64-
var settingsOpened = 0;
6564
var relayAvailable = false;
6665
await tester.pumpWidget(
6766
ProviderScope(
@@ -90,12 +89,6 @@ void main() {
9089
buzzPushAuthorizationStatusReaderProvider.overrideWithValue(
9190
() async => BuzzPushAuthorizationStatus.denied,
9291
),
93-
buzzPushNotificationSettingsOpenerProvider.overrideWithValue(
94-
() async {
95-
settingsOpened++;
96-
return true;
97-
},
98-
),
9992
],
10093
child: MaterialApp(
10194
theme: AppTheme.light(),
@@ -117,36 +110,16 @@ void main() {
117110
'${container.read(activeCommunityProvider)} / ${container.read(communityListProvider)}',
118111
);
119112
expect(tester.widget<Switch>(find.byType(Switch)).value, isTrue);
120-
expect(
121-
find.text(
122-
'Push support unavailable; you can still turn notifications off',
123-
),
124-
findsOneWidget,
125-
);
126-
await tester.tap(
127-
find.byKey(const ValueKey('push-notifications-open-settings')),
128-
);
129-
await tester.pump();
130-
expect(settingsOpened, 1);
131113
await tester.tap(find.byType(Switch));
132114
await tester.pumpAndSettle();
133115
final stored = (await storage.loadAll()).single;
134116
expect(stored.pushNotificationsEnabled, isFalse);
135117
expect(stored.pushSubscriptionState.pendingTombstoneGeneration, 8);
136118
expect(tombstones, [8]);
137119
expect(snapshots.last.single.pushNotificationsEnabled, isFalse);
138-
expect(
139-
find.text('Waiting for relay confirmation; notifications may continue'),
140-
findsOneWidget,
141-
);
142120
final offSwitch = tester.widget<Switch>(find.byType(Switch));
143121
expect(offSwitch.value, isFalse);
144122
expect(offSwitch.onChanged, isNull);
145-
await tester.tap(
146-
find.byKey(const ValueKey('push-notifications-open-settings')),
147-
);
148-
await tester.pump();
149-
expect(settingsOpened, 2);
150123
relayAvailable = true;
151124
await container
152125
.read(communityListProvider.notifier)

‎mobile/test/features/settings/settings_page_test.dart‎

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -194,109 +194,6 @@ void main() {
194194
debugDefaultTargetPlatformOverride = null;
195195
});
196196

197-
testWidgets('shows denied display permission and opens iOS settings', (
198-
tester,
199-
) async {
200-
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
201-
addTearDown(() => debugDefaultTargetPlatformOverride = null);
202-
SharedPreferences.setMockInitialValues({});
203-
final prefs = await SharedPreferences.getInstance();
204-
final community = Community.create(
205-
name: 'Team',
206-
relayUrl: 'wss://relay.example',
207-
).copyWith(pushNotificationsEnabled: true);
208-
var openSettingsCalls = 0;
209-
210-
await tester.pumpWidget(
211-
ProviderScope(
212-
overrides: [
213-
savedPrefsProvider.overrideWithValue(prefs),
214-
activeCommunityProvider.overrideWith((ref) async => community),
215-
currentRelayPushDescriptorProvider.overrideWith(
216-
(ref) async => _pushDescriptor,
217-
),
218-
appLifecycleProvider.overrideWith(_SettingsLifecycleNotifier.new),
219-
buzzPushAuthorizationStatusReaderProvider.overrideWithValue(
220-
() async => BuzzPushAuthorizationStatus.denied,
221-
),
222-
buzzPushNotificationSettingsOpenerProvider.overrideWithValue(
223-
() async {
224-
openSettingsCalls += 1;
225-
return true;
226-
},
227-
),
228-
],
229-
child: MaterialApp(
230-
theme: AppTheme.light(),
231-
home: SettingsPage(
232-
profileHeader: const SizedBox.shrink(),
233-
identityRecoveryPageBuilder: (_) => const SizedBox.shrink(),
234-
),
235-
),
236-
),
237-
);
238-
await tester.pumpAndSettle();
239-
240-
expect(tester.widget<Switch>(find.byType(Switch)).value, isTrue);
241-
expect(
242-
find.text('Enabled in Buzz, but disabled in iOS Settings'),
243-
findsOneWidget,
244-
);
245-
await tester.tap(
246-
find.byKey(const ValueKey('push-notifications-open-settings')),
247-
);
248-
await tester.pump();
249-
expect(openSettingsCalls, 1);
250-
debugDefaultTargetPlatformOverride = null;
251-
});
252-
253-
testWidgets('shows permission lookup errors with settings recovery', (
254-
tester,
255-
) async {
256-
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
257-
addTearDown(() => debugDefaultTargetPlatformOverride = null);
258-
SharedPreferences.setMockInitialValues({});
259-
final prefs = await SharedPreferences.getInstance();
260-
final community = Community.create(
261-
name: 'Team',
262-
relayUrl: 'wss://relay.example',
263-
).copyWith(pushNotificationsEnabled: true);
264-
265-
await tester.pumpWidget(
266-
ProviderScope(
267-
overrides: [
268-
savedPrefsProvider.overrideWithValue(prefs),
269-
activeCommunityProvider.overrideWith((ref) async => community),
270-
currentRelayPushDescriptorProvider.overrideWith(
271-
(ref) async => _pushDescriptor,
272-
),
273-
appLifecycleProvider.overrideWith(_SettingsLifecycleNotifier.new),
274-
buzzPushAuthorizationStatusReaderProvider.overrideWithValue(
275-
() async => throw StateError('authorization unavailable'),
276-
),
277-
],
278-
child: MaterialApp(
279-
theme: AppTheme.light(),
280-
home: SettingsPage(
281-
profileHeader: const SizedBox.shrink(),
282-
identityRecoveryPageBuilder: (_) => const SizedBox.shrink(),
283-
),
284-
),
285-
),
286-
);
287-
await tester.pumpAndSettle();
288-
289-
expect(
290-
find.text('Enabled in Buzz; iOS permission status unavailable'),
291-
findsOneWidget,
292-
);
293-
expect(
294-
find.byKey(const ValueKey('push-notifications-open-settings')),
295-
findsOneWidget,
296-
);
297-
debugDefaultTargetPlatformOverride = null;
298-
});
299-
300197
for (final brightness in Brightness.values) {
301198
testWidgets(
302199
'shows status above profile editing and routes photo directly in ${brightness.name}',

0 commit comments

Comments
 (0)