Files
buzz/mobile/ios/Runner/ConcentricSheetSurface.swift
klopez4212 39b8b2b6a6 feat(mobile): unify Messages navigation with Solo and Team filters (#8649)
## Summary

Unify mobile conversations in Messages with All / Solo / Team filters, a
collapsing header, and separate Search, New, and default-agent
shortcuts. Move workspace actions into the community menu and keep
collapsed sections intact across filters.

Align Inbox and list typography, spacing, and muted controls. Preserve
native glass layering through navigation and give every filtered list
enough clearance above the footer. The default-agent shortcut reads the
shared encrypted preference and opens an existing chat immediately. When
unset, it opens Agents; a star action selects the default through a
production signed, self-encrypted preference writer. Save failures
remain visible and retryable.

Android now uses rounded navigation controls and filters, optically
balanced search icons, and expanding New/community menus with leading
Tabler icons matching iOS. Preset avatars retain transparent WebM
animation through an Android WebView renderer, with lifecycle pausing
and poster fallback.

### Related issue

None found in searches for mobile navigation issues and open PRs.

### Testing

- Android follow-up: ARM64 debug build, Dart analysis, and emulator
checks passed for menu placement, selection, icon alignment, search, and
avatar playback/pause/resume. The avatar implementation passed 3,840
Flutter tests and native Android tests before subsequent styling
iterations. Automated tests for the later menu/icon iterations were
skipped at the author’s request; those earlier results do not cover the
final styling changes.

- Mobile formatting/analysis and full test suite (3,838 passed, 23
skipped, plus 4 push-configuration tests); regression journey covers
filtering, collapse retention, and scrolling the last Solo row above the
footer.
- iPhone 18 Pro simulator (Honeycomb): filters, menus, Inbox,
Invite/Back, Switch Community, and default-agent chat/Back exercised.
iOS release build and Pairing Preview install/launch passed during
iteration, preserving the saved profile.
- P1 follow-up: production writer-to-reader widget journey covers
selection, publish failure/retry, and the unset footer opening Agents.
Simulator Agents open/close passes; its saved community has no
selectable agents, so live selection was not verified there.
- Independent agent review completed; its Solo footer-clearance finding
is fixed. The final clearance adjustment is covered by widget tests;
physical-device acceptance of that adjustment and hosted CI remain
pending.

Final Messages layout:

![Messages with All, Solo and Team filters and separate bottom
shortcuts](https://github.com/user-attachments/assets/562ddc3e-945b-4945-bd58-217a2c62b570)

Switcher layering during iteration (before → after):

| Before: filter edge showing through | After: Home hidden behind
switcher |
| --- | --- |
| ![Filter edge visible beside Switch
Community](https://github.com/user-attachments/assets/b32a0157-8b17-4f01-9a23-29b12ce3b1af)
| ![Clean Switch Community
screen](https://github.com/user-attachments/assets/222956e4-9989-4c8f-a162-65de45029845)
|

---------

Signed-off-by: kenny lopez <klopez4212@gmail.com>
Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz>
2026-10-29 14:27:22 +00:00

214 lines
6.5 KiB
Swift

import Flutter
import UIKit
final class ConcentricSheetSurfaceFactory: NSObject, FlutterPlatformViewFactory {
private let messenger: FlutterBinaryMessenger
init(messenger: FlutterBinaryMessenger) {
self.messenger = messenger
super.init()
}
func createArgsCodec() -> FlutterMessageCodec & NSObjectProtocol {
FlutterStandardMessageCodec.sharedInstance()
}
func create(
withFrame frame: CGRect,
viewIdentifier viewId: Int64,
arguments args: Any?
) -> FlutterPlatformView {
ConcentricSheetSurfacePlatformView(
frame: frame,
viewIdentifier: viewId,
messenger: messenger,
arguments: args
)
}
}
final class ConcentricSheetSurfacePlatformView: NSObject, FlutterPlatformView {
private let rootView: UIView
private let surfaceView: UIView
private let channel: FlutterMethodChannel
private let corners: String
private let usesGlass: Bool
private let topRadius: Double?
init(
frame: CGRect,
viewIdentifier viewId: Int64,
messenger: FlutterBinaryMessenger,
arguments args: Any?
) {
let arguments = args as? [String: Any]
let colorValue = (arguments?["color"] as? NSNumber)?.uint32Value ?? 0xFFFF_FFFF
let backdropColorValue = (arguments?["backdropColor"] as? NSNumber)?.uint32Value
let minimumRadius = (arguments?["minimumRadius"] as? NSNumber)?.doubleValue ?? 24
corners = arguments?["corners"] as? String ?? "all"
topRadius = (arguments?["topRadius"] as? NSNumber)?.doubleValue
usesGlass = (arguments?["usesGlass"] as? NSNumber)?.boolValue == true
rootView = UIView(frame: frame)
rootView.isUserInteractionEnabled = false
rootView.isOpaque = !usesGlass && backdropColorValue != nil
rootView.backgroundColor = backdropColorValue.map { Self.color(from: $0) } ?? .clear
if #available(iOS 26.0, *), usesGlass {
let effect = UIGlassEffect(style: .regular)
effect.isInteractive = false
surfaceView = UIVisualEffectView(effect: effect)
} else {
surfaceView = UIView()
}
surfaceView.frame = rootView.bounds
surfaceView.isUserInteractionEnabled = false
surfaceView.isOpaque = !usesGlass
surfaceView.clipsToBounds = true
surfaceView.layer.cornerCurve = .continuous
surfaceView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
rootView.addSubview(surfaceView)
channel = FlutterMethodChannel(
name: "buzz/concentric_sheet_surface/\(viewId)",
binaryMessenger: messenger
)
super.init()
updateColors(
colorValue: colorValue,
backdropColorValue: backdropColorValue,
glassTintColorValue: (arguments?["glassTintColor"] as? NSNumber)?.uint32Value
)
applyInterfaceStyle(from: arguments?["brightness"])
applyCornerConfiguration(minimumRadius: minimumRadius)
channel.setMethodCallHandler { [weak self] call, result in
guard let self else {
result(nil)
return
}
switch call.method {
case "updateColors":
guard
let arguments = call.arguments as? [String: Any],
let colorValue = arguments["color"] as? NSNumber
else {
result(
FlutterError(
code: "invalid_arguments",
message: "Expected a surface color.",
details: nil
)
)
return
}
self.updateColors(
colorValue: colorValue.uint32Value,
backdropColorValue: (arguments["backdropColor"] as? NSNumber)?.uint32Value,
glassTintColorValue: (arguments["glassTintColor"] as? NSNumber)?.uint32Value
)
result(nil)
case "updateGeometry":
guard
let arguments = call.arguments as? [String: Any],
let minimumRadius = arguments["minimumRadius"] as? NSNumber
else {
result(
FlutterError(
code: "invalid_arguments",
message: "Expected a minimum corner radius.",
details: nil
)
)
return
}
self.applyInterfaceStyle(from: arguments["brightness"])
self.applyCornerConfiguration(
minimumRadius: minimumRadius.doubleValue
)
result(nil)
default:
result(FlutterMethodNotImplemented)
}
}
}
deinit {
channel.setMethodCallHandler(nil)
}
func view() -> UIView {
rootView
}
private func updateColors(
colorValue: UInt32,
backdropColorValue: UInt32?,
glassTintColorValue: UInt32?
) {
let surfaceColor = Self.color(from: colorValue)
if let glassView = surfaceView as? UIVisualEffectView {
if #available(iOS 26.0, *), let effect = glassView.effect as? UIGlassEffect {
effect.tintColor = glassTintColorValue.map { Self.color(from: $0) }
glassView.effect = effect
}
glassView.backgroundColor = .clear
glassView.contentView.backgroundColor = surfaceColor.withAlphaComponent(min(surfaceColor.cgColor.alpha, 0.12))
} else {
surfaceView.backgroundColor = surfaceColor
}
rootView.isOpaque = !usesGlass && backdropColorValue != nil
rootView.backgroundColor = backdropColorValue.map { Self.color(from: $0) } ?? .clear
}
private func applyCornerConfiguration(minimumRadius: CGFloat) {
if #available(iOS 26.0, *) {
let radius = UICornerRadius.containerConcentric(minimum: minimumRadius)
surfaceView.cornerConfiguration =
corners == "bottom"
? .uniformBottomRadius(
radius,
topLeftRadius: nil,
topRightRadius: nil
)
: topRadius.map {
.uniformBottomRadius(
radius,
topLeftRadius: .fixed($0),
topRightRadius: .fixed($0)
)
} ?? .uniformCorners(radius: radius)
} else {
surfaceView.layer.cornerRadius = minimumRadius
if corners == "bottom" {
surfaceView.layer.maskedCorners = [
.layerMinXMaxYCorner,
.layerMaxXMaxYCorner,
]
}
}
}
private func applyInterfaceStyle(from value: Any?) {
switch value as? String {
case "dark":
rootView.overrideUserInterfaceStyle = .dark
case "light":
rootView.overrideUserInterfaceStyle = .light
default:
rootView.overrideUserInterfaceStyle = .unspecified
}
}
private static func color(from value: UInt32) -> UIColor {
let alpha = CGFloat((value >> 24) & 0xFF) / 255
let red = CGFloat((value >> 16) & 0xFF) / 255
let green = CGFloat((value >> 8) & 0xFF) / 255
let blue = CGFloat(value & 0xFF) / 255
return UIColor(red: red, green: green, blue: blue, alpha: alpha)
}
}