mirror of
https://github.com/block/buzz.git
synced 2026-11-03 07:51:22 +00:00
## Summary Deletes mobile code that no longer has a user-reachable path and has no counterpart in buzz-app, so it is unlikely to come back for parity. Net: 104 files, about 5,500 lines removed. No intended behavior change. - **iOS native message menu and action surface:** `NativeMessageMenu.swift` and `NativeMessageActionSurface.swift`, the `message`/`supportsMessage` coordinator branches, and the Dart selection hook. Dart stopped creating this view in [#8280](https://github.com/block/buzz/pull/8280). The native reactions sheet in the same coordinator is kept. - **Old home quick-actions launcher and `ComposeMorphIcon`:** only instantiated in tests since the nav-bar creation actions replaced them. - **Retired local theme stack:** `ThemeNotifier`, `AccentNotifier`, `SchemeNotifier`, `adaptive_theme.dart`, `AccentPickerPage`, the appearance-mode sheet and their helpers. These predate per-community theme sync. The legacy prefs migration in `community_theme_preference.dart` is kept. - **Unused widgets:** `ProfileAvatar` and `MaskedAvatarBadge`. - **Push permission-status plumbing:** the iOS `notificationAuthorizationStatus`/`openNotificationSettings` handlers, plus the uncalled strict age-gate snapshot registration and its Swift `syncAgeGatePushSnapshot` path. - **Orphaned files** with no importer: `profile_text_edit_sheet`, `editor_option_button`, `retained_page_transition`, `tappable_flapping_bee`, `agent_model_info`, `community_bot_profiles`, `sheet_divider`, `success_haptic`. - **Uncalled helpers:** the `pickAndUpload*`/camera helpers in `media_upload.dart`, unused `NostrFilters` builders, `mediaGetHeadersFor*`, and about 20 other uncalled functions, providers and styles. - **Removed-UI leftovers:** the never-wired invite directory providers, `AuthNotifier.signOut` and `removeActiveCommunityForSignOut` (the Sign out row is gone), `renameCommunity`, `HomePage.profilePageBuilder`/`SettingsPage.embedded`, and the create-forum branches of the create-channel sheet. Forum viewing is unchanged. Tests that only covered deleted code are removed. Tests of surviving code that used deleted helpers as drivers were repointed to the surviving API. An audit of `mobile/android` found no dead Kotlin, resources, manifest entries or Gradle dependencies, so Android code is unchanged. ## Validation - `flutter analyze`: no issues. - After rebasing onto main ([93b8b8f](https://github.com/block/buzz/commit/93b8b8febc)), `just mobile-check` is clean (format and analyze), and `just mobile-test` passes (4,070 passed, 35 skipped, 0 failed, plus the push-unconfigured and secp256k1 suites). - `dart format`: clean. - Android: `just mobile-build-android` builds the debug APK, and `./gradlew :app:testDebugUnitTest` passes. - iOS: `build-for-testing` succeeds and BuzzPushKit `swift test` passes (65 tests). In RunnerTests, 97 of 98 pass. `testNativeNavigationTitleExpandsAgainAtTop` fails, but it fails the same way on unmodified `main` (acf56fff6f) on the same machine (Xcode 27, iPhone 17 Pro simulator), so it is not caused by this change. - Agent review of the diff ran. Its one blocker (stale `project.pbxproj` entries for the deleted Swift files) is fixed. - In-app smoke run at [66141c1](66141c10b9): a debug build on a fresh iPhone 17 Pro simulator (iOS 27), signed in to the internal community. The following flows all worked with no errors: - Home: the New menu (channel, DM, workspace, chat) and the create-channel sheet, including its channel-type options. - A chat, with the message action sheet (reactions row, Reply, Copy link, Remind me, Mark unread, Copy text, Edit and Delete). - Appearance: the previews, and cycling the System and Light modes. - Settings: the profile header, the display name editor, and Edit photo (Image and Emoji tabs). - The Agents directory. - Search, including the Channels filter, plus opening a team channel from the results. - Tapping a reaction summary, which opens the native iOS Reactions sheet. - The recording isn't attached here because it shows internal channels and messages. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Tom Brow <tomb@squareup.com> Co-authored-by: Tom Brow <tomb@squareup.com> Co-authored-by: studio <dc2fc481343672df31a689840c09299972e704dac592e0da6f18486646a7ee3e@buzz.block.builderlab.xyz> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
155 lines
5.0 KiB
Dart
155 lines
5.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:buzz/shared/theme/theme.dart';
|
|
import 'package:buzz/shared/widgets/frosted_app_bar.dart';
|
|
import 'package:buzz/shared/widgets/frosted_scaffold.dart';
|
|
import 'package:buzz/shared/widgets/navigation_backdrop.dart';
|
|
|
|
const _buzzGradient = LinearGradient(
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
colors: [Color(0xFFE6E6B6), Color(0xFFC4D0DA)],
|
|
);
|
|
|
|
void main() {
|
|
group('Buzz theme catalog entries', () {
|
|
test('both halves are in the catalog', () {
|
|
expect(findTheme(buzzThemeName), isNotNull);
|
|
expect(findTheme(buzzDarkThemeName), isNotNull);
|
|
});
|
|
|
|
test('borrow the GitHub palettes', () {
|
|
final buzz = findTheme(buzzThemeName)!;
|
|
final github = findTheme('github-light')!;
|
|
expect(buzz.bg, github.bg);
|
|
expect(buzz.fg, github.fg);
|
|
expect(buzz.comment, github.comment);
|
|
|
|
final buzzDark = findTheme(buzzDarkThemeName)!;
|
|
final githubDark = findTheme('github-dark')!;
|
|
expect(buzzDark.bg, githubDark.bg);
|
|
expect(buzzDark.fg, githubDark.fg);
|
|
expect(buzzDark.comment, githubDark.comment);
|
|
});
|
|
|
|
test('are a light/dark pair', () {
|
|
expect(findTheme(buzzThemeName)!.isDark, isFalse);
|
|
expect(findTheme(buzzDarkThemeName)!.isDark, isTrue);
|
|
expect(themePairFor(buzzThemeName), buzzDarkThemeName);
|
|
expect(themePairFor(buzzDarkThemeName), buzzThemeName);
|
|
});
|
|
|
|
test('appear as a single System-mode option labelled "Buzz"', () {
|
|
final paired = themeGroups().paired.map((t) => t.name);
|
|
expect(paired, contains(buzzThemeName));
|
|
expect(paired, isNot(contains(buzzDarkThemeName)));
|
|
expect(pairedThemeLabel(buzzThemeName), 'Buzz');
|
|
});
|
|
|
|
test('resolve across brightnesses like any other pair', () {
|
|
expect(
|
|
effectiveTheme(buzzThemeName, ThemeMode.dark)?.name,
|
|
buzzDarkThemeName,
|
|
);
|
|
expect(
|
|
effectiveTheme(buzzDarkThemeName, ThemeMode.light)?.name,
|
|
buzzThemeName,
|
|
);
|
|
});
|
|
});
|
|
|
|
group('theme threading', () {
|
|
Widget harness(ThemeData theme) => MaterialApp(
|
|
theme: theme,
|
|
home: Builder(
|
|
builder: (context) => FrostedScaffold(
|
|
backgroundGradient: context.appColors.topSectionGradient,
|
|
appBar: const FrostedAppBar(title: Text('Home'), alwaysFrosted: true),
|
|
body: const SizedBox.expand(),
|
|
),
|
|
),
|
|
);
|
|
|
|
testWidgets('AppTheme carries the gradient to the top section', (
|
|
tester,
|
|
) async {
|
|
await tester.pumpWidget(
|
|
harness(AppTheme.light(topSectionGradient: _buzzGradient)),
|
|
);
|
|
|
|
final background = tester.widget<DecoratedBox>(
|
|
find.byKey(const ValueKey('frosted-scaffold-pinned-gradient')),
|
|
);
|
|
expect((background.decoration as BoxDecoration).gradient, isNotNull);
|
|
expect(find.byType(NavigationBackdrop), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('non-Buzz themes keep the frosted surface fill', (
|
|
tester,
|
|
) async {
|
|
await tester.pumpWidget(harness(AppTheme.light()));
|
|
|
|
expect(
|
|
find.byKey(const ValueKey('frosted-scaffold-pinned-gradient')),
|
|
findsNothing,
|
|
);
|
|
expect(find.byType(NavigationBackdrop), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('Buzz section labels use 80% neutral foreground', (
|
|
tester,
|
|
) async {
|
|
await tester.pumpWidget(
|
|
harness(AppTheme.light(topSectionGradient: _buzzGradient)),
|
|
);
|
|
|
|
final context = tester.element(find.text('Home'));
|
|
expect(
|
|
navigationSectionForeground(context),
|
|
Colors.black.withValues(alpha: 0.8),
|
|
);
|
|
});
|
|
|
|
testWidgets('navigation roles inherit non-Buzz theme tokens', (
|
|
tester,
|
|
) async {
|
|
const primaryForeground = Color(0xFF123456);
|
|
const secondaryForeground = Color(0xFF789ABC);
|
|
const searchSurface = Color(0xFFDEF012);
|
|
final theme = ThemeData(
|
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.purple).copyWith(
|
|
onSurface: primaryForeground,
|
|
onSurfaceVariant: secondaryForeground,
|
|
surfaceContainerHighest: searchSurface,
|
|
),
|
|
);
|
|
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
theme: theme,
|
|
home: const Scaffold(body: SizedBox()),
|
|
),
|
|
);
|
|
|
|
final context = tester.element(find.byType(SizedBox));
|
|
expect(navigationPrimaryForeground(context), primaryForeground);
|
|
expect(navigationSecondaryForeground(context), secondaryForeground);
|
|
expect(navigationSectionForeground(context), secondaryForeground);
|
|
expect(navigationSearchSurface(context), const Color(0xFFF0F0F0));
|
|
expect(
|
|
navigationDivider(context, 0.15),
|
|
primaryForeground.withValues(alpha: 0.15),
|
|
);
|
|
});
|
|
});
|
|
|
|
group('isBuzzTheme', () {
|
|
test('matches only the Buzz pair', () {
|
|
expect(isBuzzTheme(buzzThemeName), isTrue);
|
|
expect(isBuzzTheme(buzzDarkThemeName), isTrue);
|
|
expect(isBuzzTheme('github-light'), isFalse);
|
|
expect(isBuzzTheme(''), isFalse);
|
|
});
|
|
});
|
|
}
|