Skip to content

Fix remaining DevFlow support for Comet apps#68

Open
davidortinau wants to merge 5 commits intofeature/cometfrom
fix/devflow-comet-followups
Open

Fix remaining DevFlow support for Comet apps#68
davidortinau wants to merge 5 commits intofeature/cometfrom
fix/devflow-comet-followups

Conversation

@davidortinau
Copy link
Copy Markdown
Contributor

Summary

This follow-up PR keeps the remaining DevFlow for Comet work separate from the broader Comet feature status.

What it fixes

  • resolves Comet views in DevFlow visual tree inspection
  • supports IApplication/Comet app binding when Application.Current is unavailable
  • improves visibility and bounds reporting for Comet/IView inspection
  • fixes iOS navigation safe-area and toolbar behavior for pushed/reset Comet views

Notes

  • intentionally based on feature/comet so it can move independently of the larger repo-level discussion
  • excludes local Squad/history artifacts from the branch

Validation

  • Comet source generator build
  • Comet library build
  • Comet test project build
  • Comet.Tests currently has one unrelated pre-existing template-surface failure (TemplateCurrentSurfaceValidationTests.SingleProjectTemplateTargetsCurrentMauiAndDropsLegacyDependencies)

davidortinau and others added 5 commits April 6, 2026 19:02
… items on pushed views

FIX 1 — DevFlow VisualTreeWalker IView branch:
- Add ResolveIViewWindowBounds, ResolveIViewPlatformVisibility, PopulateIViewNativeInfo
  virtual methods to VisualTreeWalker (Core) with platform overrides (Agent)
- IView branch now resolves bounds from handler's native view (UIView.ConvertRectToView
  on iOS, GetLocationInWindow on Android, TransformToVisual on Windows)
- Visibility checked via native view Hidden/Alpha/size instead of IView.Visibility alone
- Text extraction checks ILabel, ITextButton, IEntry, IEditor, ISearchBar interfaces
- CometViewResolver.TryExtractText() added for reflection-based text fallback

FIX 2 — CometViewController safe area:
- LoadView() checks ISafeAreaView.IgnoreSafeArea before setting EdgesForExtendedLayout
- ViewWillAppear re-checks safe area and propagates background color to container view
- Eliminates white/black letterboxing when views use .IgnoreSafeArea()

FIX 3 — Toolbar items on pushed views:
- Add View.ToolbarItems() and View.GetToolbarItems() environment-based extensions
- Add EnvironmentKeys.View.ToolbarItems constant
- Extract toolbar creation into reusable ApplyToolbarItems() in NavigationViewHandler
- Pushed views' own toolbar items take priority over NavigationView's items

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
CometApp implements IApplication but not Microsoft.Maui.Controls.Application,
so Application.Current is never set and DevFlow's retry loop always fails.
This left _app=null and ALL DevFlow endpoints returned 'Agent not bound to app'.

Changes:
- Add _iApp field + BoundApplication property (prefers Application, falls back to IApplication)
- Add StartServerOnly() with TryResolveIApplicationFromDI() using IPlatformApplication.Current
- Add BindIApp() for late-binding IApplication instances
- Replace all _app references with BoundApplication in endpoint handlers
- Add IApplication overloads for WalkTree, GetElementById, HitTestByBounds, Query, QueryCss
- Fix HitTestByBounds to safely cast IWindow→Window for Page/Navigation access
- AgentServiceExtensions: fall back to StartServerOnly() when Application.Current stays null
- Add TryBubbleCometGestureTap for walking parent chain to find tap gestures
- Add case IView iViewNoHandler in HandleTap for views without platform handlers

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@davidortinau davidortinau requested a review from Redth April 7, 2026 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant