mirror of
https://github.com/block/buzz.git
synced 2026-11-28 04:01:45 +00:00
Mobile now remembers collapsed Starred, Team, Direct messages, and custom sections across relaunches. Preferences are local to each account and community. New sections start expanded. Fixes [AIDA-2820](https://linear.app/squareup/issue/AIDA-2820). The Flutter regression test passed for rapid toggles, restoration in a fresh provider container, and isolation between scopes. To verify on a phone, collapse Team and one custom section, leave Direct messages expanded, force-quit Buzz, and reopen the same community. All three headers should retain their previous state. --------- Signed-off-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz> Signed-off-by: Tom Brow <tomb@block.xyz> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz> Co-authored-by: Tom Brow <tomb@block.xyz> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@localhost>
35 lines
1.2 KiB
Dart
35 lines
1.2 KiB
Dart
import 'package:buzz/features/channels/channel_sections/collapsed_section_provider.dart';
|
|
import 'package:buzz/shared/theme/theme_provider.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
void main() {
|
|
test(
|
|
'restores toggles across launches and keeps sidebar scopes separate',
|
|
() async {
|
|
SharedPreferences.setMockInitialValues({});
|
|
final prefs = await SharedPreferences.getInstance();
|
|
ProviderContainer launch() {
|
|
final container = ProviderContainer(
|
|
overrides: [savedPrefsProvider.overrideWithValue(prefs)],
|
|
);
|
|
addTearDown(container.dispose);
|
|
return container;
|
|
}
|
|
|
|
final sidebar = collapsedSectionsProvider('relay:account');
|
|
final sections = launch().read(sidebar.notifier);
|
|
await Future.wait([
|
|
sections.toggle('channels'),
|
|
sections.toggle('custom:design'),
|
|
]);
|
|
await sections.toggle('channels');
|
|
|
|
final relaunched = launch();
|
|
expect(relaunched.read(sidebar), {'custom:design'});
|
|
expect(relaunched.read(collapsedSectionsProvider('other')), isEmpty);
|
|
},
|
|
);
|
|
}
|