mirror of
https://github.com/block/buzz.git
synced 2026-10-27 12:40:30 +00:00
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](https://github.com/block/buzz/pull/8199#discussion_r4225426842). 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](https://github.com/block/buzz/issues/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 | | --- | --- | |  |  | Signed-off-by: Tom Brow <tomb@block.xyz>
This commit is contained in:
@@ -61,7 +61,6 @@ void main() {
|
||||
final pending = Completer<BuzzPushLeaseDescriptor?>();
|
||||
final snapshots = <List<Community>>[];
|
||||
final tombstones = <int?>[];
|
||||
var settingsOpened = 0;
|
||||
var relayAvailable = false;
|
||||
await tester.pumpWidget(
|
||||
ProviderScope(
|
||||
@@ -90,12 +89,6 @@ void main() {
|
||||
buzzPushAuthorizationStatusReaderProvider.overrideWithValue(
|
||||
() async => BuzzPushAuthorizationStatus.denied,
|
||||
),
|
||||
buzzPushNotificationSettingsOpenerProvider.overrideWithValue(
|
||||
() async {
|
||||
settingsOpened++;
|
||||
return true;
|
||||
},
|
||||
),
|
||||
],
|
||||
child: MaterialApp(
|
||||
theme: AppTheme.light(),
|
||||
@@ -117,17 +110,6 @@ void main() {
|
||||
'${container.read(activeCommunityProvider)} / ${container.read(communityListProvider)}',
|
||||
);
|
||||
expect(tester.widget<Switch>(find.byType(Switch)).value, isTrue);
|
||||
expect(
|
||||
find.text(
|
||||
'Push support unavailable; you can still turn notifications off',
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
await tester.tap(
|
||||
find.byKey(const ValueKey('push-notifications-open-settings')),
|
||||
);
|
||||
await tester.pump();
|
||||
expect(settingsOpened, 1);
|
||||
await tester.tap(find.byType(Switch));
|
||||
await tester.pumpAndSettle();
|
||||
final stored = (await storage.loadAll()).single;
|
||||
@@ -135,18 +117,9 @@ void main() {
|
||||
expect(stored.pushSubscriptionState.pendingTombstoneGeneration, 8);
|
||||
expect(tombstones, [8]);
|
||||
expect(snapshots.last.single.pushNotificationsEnabled, isFalse);
|
||||
expect(
|
||||
find.text('Waiting for relay confirmation; notifications may continue'),
|
||||
findsOneWidget,
|
||||
);
|
||||
final offSwitch = tester.widget<Switch>(find.byType(Switch));
|
||||
expect(offSwitch.value, isFalse);
|
||||
expect(offSwitch.onChanged, isNull);
|
||||
await tester.tap(
|
||||
find.byKey(const ValueKey('push-notifications-open-settings')),
|
||||
);
|
||||
await tester.pump();
|
||||
expect(settingsOpened, 2);
|
||||
relayAvailable = true;
|
||||
await container
|
||||
.read(communityListProvider.notifier)
|
||||
|
||||
@@ -194,109 +194,6 @@ void main() {
|
||||
debugDefaultTargetPlatformOverride = null;
|
||||
});
|
||||
|
||||
testWidgets('shows denied display permission and opens iOS settings', (
|
||||
tester,
|
||||
) async {
|
||||
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
|
||||
addTearDown(() => debugDefaultTargetPlatformOverride = null);
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
final community = Community.create(
|
||||
name: 'Team',
|
||||
relayUrl: 'wss://relay.example',
|
||||
).copyWith(pushNotificationsEnabled: true);
|
||||
var openSettingsCalls = 0;
|
||||
|
||||
await tester.pumpWidget(
|
||||
ProviderScope(
|
||||
overrides: [
|
||||
savedPrefsProvider.overrideWithValue(prefs),
|
||||
activeCommunityProvider.overrideWith((ref) async => community),
|
||||
currentRelayPushDescriptorProvider.overrideWith(
|
||||
(ref) async => _pushDescriptor,
|
||||
),
|
||||
appLifecycleProvider.overrideWith(_SettingsLifecycleNotifier.new),
|
||||
buzzPushAuthorizationStatusReaderProvider.overrideWithValue(
|
||||
() async => BuzzPushAuthorizationStatus.denied,
|
||||
),
|
||||
buzzPushNotificationSettingsOpenerProvider.overrideWithValue(
|
||||
() async {
|
||||
openSettingsCalls += 1;
|
||||
return true;
|
||||
},
|
||||
),
|
||||
],
|
||||
child: MaterialApp(
|
||||
theme: AppTheme.light(),
|
||||
home: SettingsPage(
|
||||
profileHeader: const SizedBox.shrink(),
|
||||
identityRecoveryPageBuilder: (_) => const SizedBox.shrink(),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(tester.widget<Switch>(find.byType(Switch)).value, isTrue);
|
||||
expect(
|
||||
find.text('Enabled in Buzz, but disabled in iOS Settings'),
|
||||
findsOneWidget,
|
||||
);
|
||||
await tester.tap(
|
||||
find.byKey(const ValueKey('push-notifications-open-settings')),
|
||||
);
|
||||
await tester.pump();
|
||||
expect(openSettingsCalls, 1);
|
||||
debugDefaultTargetPlatformOverride = null;
|
||||
});
|
||||
|
||||
testWidgets('shows permission lookup errors with settings recovery', (
|
||||
tester,
|
||||
) async {
|
||||
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
|
||||
addTearDown(() => debugDefaultTargetPlatformOverride = null);
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
final community = Community.create(
|
||||
name: 'Team',
|
||||
relayUrl: 'wss://relay.example',
|
||||
).copyWith(pushNotificationsEnabled: true);
|
||||
|
||||
await tester.pumpWidget(
|
||||
ProviderScope(
|
||||
overrides: [
|
||||
savedPrefsProvider.overrideWithValue(prefs),
|
||||
activeCommunityProvider.overrideWith((ref) async => community),
|
||||
currentRelayPushDescriptorProvider.overrideWith(
|
||||
(ref) async => _pushDescriptor,
|
||||
),
|
||||
appLifecycleProvider.overrideWith(_SettingsLifecycleNotifier.new),
|
||||
buzzPushAuthorizationStatusReaderProvider.overrideWithValue(
|
||||
() async => throw StateError('authorization unavailable'),
|
||||
),
|
||||
],
|
||||
child: MaterialApp(
|
||||
theme: AppTheme.light(),
|
||||
home: SettingsPage(
|
||||
profileHeader: const SizedBox.shrink(),
|
||||
identityRecoveryPageBuilder: (_) => const SizedBox.shrink(),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(
|
||||
find.text('Enabled in Buzz; iOS permission status unavailable'),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.byKey(const ValueKey('push-notifications-open-settings')),
|
||||
findsOneWidget,
|
||||
);
|
||||
debugDefaultTargetPlatformOverride = null;
|
||||
});
|
||||
|
||||
for (final brightness in Brightness.values) {
|
||||
testWidgets(
|
||||
'shows status above profile editing and routes photo directly in ${brightness.name}',
|
||||
|
||||
Reference in New Issue
Block a user