mirror of
https://github.com/block/buzz.git
synced 2026-11-01 23:11:58 +00:00
## Summary - combine channel identity, actions, member previews, and lifecycle controls in one navigable mobile details page - add compact member management and desktop-aligned channel editing - smooth the profile entrance transition and standardize settings-group spacing - align Huddle lifecycle rows with regular message author and body spacing ## Testing - `just mobile-check` - `just mobile-test` — 1,477 tests - Pixel 10 debug build, install, and interaction review ## Snapshots ### Channel header  ### Combined channel details  ### Manage channel  --------- Signed-off-by: kenny lopez <klopez4212@gmail.com> Signed-off-by: Fast Fizz <2df81cb51f05a9d5387ef24d7b9ecb8fcdfcd1c70ffabc67061c9596e1b5b1c4@buzz.block.builderlab.xyz> Co-authored-by: Fast Fizz <2df81cb51f05a9d5387ef24d7b9ecb8fcdfcd1c70ffabc67061c9596e1b5b1c4@buzz.block.builderlab.xyz>
91 lines
2.9 KiB
Dart
91 lines
2.9 KiB
Dart
import 'package:buzz/features/profile/profile_provider.dart';
|
|
import 'package:buzz/shared/profile/user_profile.dart';
|
|
import 'package:buzz/shared/relay/relay.dart';
|
|
import 'package:buzz/shared/theme/theme.dart';
|
|
import 'package:flutter/widgets.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(
|
|
'manual presence persists until Online restores automatic mode',
|
|
() async {
|
|
SharedPreferences.setMockInitialValues({});
|
|
final prefs = await SharedPreferences.getInstance();
|
|
var container = _buildContainer(prefs);
|
|
|
|
expect(
|
|
await container
|
|
.read(presenceProvider.future)
|
|
.timeout(
|
|
const Duration(seconds: 2),
|
|
onTimeout: () =>
|
|
throw StateError('initial presence did not resolve'),
|
|
),
|
|
'online',
|
|
);
|
|
await container
|
|
.read(presenceProvider.notifier)
|
|
.setPresence('away')
|
|
.timeout(
|
|
const Duration(seconds: 2),
|
|
onTimeout: () => throw StateError('setting Away did not resolve'),
|
|
);
|
|
expect(container.read(presenceProvider).value, 'away');
|
|
expect(prefs.getString('buzz_presence_preference_aabb'), 'away');
|
|
|
|
container.dispose();
|
|
container = _buildContainer(prefs);
|
|
addTearDown(container.dispose);
|
|
expect(
|
|
await container
|
|
.read(presenceProvider.future)
|
|
.timeout(
|
|
const Duration(seconds: 2),
|
|
onTimeout: () =>
|
|
throw StateError('stored presence did not resolve'),
|
|
),
|
|
'away',
|
|
);
|
|
|
|
await container
|
|
.read(presenceProvider.notifier)
|
|
.setPresence('online')
|
|
.timeout(
|
|
const Duration(seconds: 2),
|
|
onTimeout: () => throw StateError('setting Online did not resolve'),
|
|
);
|
|
expect(container.read(presenceProvider).value, 'online');
|
|
expect(prefs.getString('buzz_presence_preference_aabb'), 'auto');
|
|
},
|
|
);
|
|
}
|
|
|
|
ProviderContainer _buildContainer(SharedPreferences prefs) => ProviderContainer(
|
|
overrides: [
|
|
savedPrefsProvider.overrideWithValue(prefs),
|
|
myPubkeyProvider.overrideWithValue('aabb'),
|
|
profileProvider.overrideWith(_FakeProfileNotifier.new),
|
|
relaySessionProvider.overrideWith(_DisconnectedRelaySession.new),
|
|
appLifecycleProvider.overrideWith(_ResumedLifecycle.new),
|
|
],
|
|
);
|
|
|
|
class _FakeProfileNotifier extends ProfileNotifier {
|
|
@override
|
|
Future<UserProfile?> build() async =>
|
|
const UserProfile(pubkey: 'aabb', displayName: 'Test');
|
|
}
|
|
|
|
class _DisconnectedRelaySession extends RelaySessionNotifier {
|
|
@override
|
|
SessionState build() =>
|
|
const SessionState(status: SessionStatus.disconnected);
|
|
}
|
|
|
|
class _ResumedLifecycle extends AppLifecycleNotifier {
|
|
@override
|
|
AppLifecycleState build() => AppLifecycleState.resumed;
|
|
}
|