[Mobile]:Add share card entry points to mobile forecast details#3668
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughA new ChangesCentralized Air Quality Share Sheet
Sequence Diagram(s)sequenceDiagram
actor User
participant ForecastOverviewPage
participant AnalyticsSpecifics
participant showAirQualityShareSheet
participant AirQualityShareSheet
participant AirQualityShareService
rect rgba(100, 149, 237, 0.5)
Note over ForecastOverviewPage: Via share icon in header
User->>ForecastOverviewPage: taps share icon
ForecastOverviewPage->>ForecastOverviewPage: _openShareSheet() computes RenderBox rect
ForecastOverviewPage->>showAirQualityShareSheet: call with measurement + sharePositionOrigin
end
rect rgba(144, 238, 144, 0.5)
Note over AnalyticsSpecifics: Via share button in analytics
User->>AnalyticsSpecifics: taps share button
AnalyticsSpecifics->>AnalyticsSpecifics: _shareAirQuality() computes RenderBox rect
AnalyticsSpecifics->>showAirQualityShareSheet: call with measurement + sharePositionOrigin
end
showAirQualityShareSheet->>AirQualityShareSheet: present modal bottom sheet
User->>AirQualityShareSheet: taps share card button
AirQualityShareSheet->>AirQualityShareSheet: _captureCard() → RepaintBoundary → PNG bytes
AirQualityShareSheet->>AirQualityShareService: shareMeasurementCard(bytes, measurement, location, origin)
AirQualityShareService-->>AirQualityShareSheet: complete
AirQualityShareSheet->>AirQualityShareSheet: finally reset _isSharingCard
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/mobile/lib/src/app/dashboard/pages/forecast_overview_page.dart (1)
165-169: ⚡ Quick winPass
fallbackLocationNameto keep share text/card location consistent.When
measurement.siteDetailsnaming fields are absent, the share payload falls back to generic text. Forwardwidget.siteNamehere to preserve location quality.Proposed fix
await showAirQualityShareSheet( context, measurement: measurement, + fallbackLocationName: widget.siteName, sharePositionOrigin: shareOrigin, );🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/mobile/lib/src/app/dashboard/pages/forecast_overview_page.dart` around lines 165 - 169, The showAirQualityShareSheet function call is missing the fallbackLocationName parameter, which causes the share payload to fall back to generic text when measurement.siteDetails naming fields are absent. Add the fallbackLocationName parameter with the value widget.siteName to the showAirQualityShareSheet call to preserve location quality in the share text and card.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/mobile/lib/src/app/dashboard/widgets/air_quality_share_sheet.dart`:
- Around line 58-77: The try/finally block starting with _captureCard() and
AirQualityShareService.shareMeasurementCard() lacks exception handling, so if
either method throws an error, the user receives no feedback. Add a catch block
between the try block and the finally keyword that captures any exception,
checks if the widget is still mounted using the same pattern as the existing
null check, and displays a SnackBar with an appropriate error message to inform
the user that sharing failed.
---
Nitpick comments:
In `@src/mobile/lib/src/app/dashboard/pages/forecast_overview_page.dart`:
- Around line 165-169: The showAirQualityShareSheet function call is missing the
fallbackLocationName parameter, which causes the share payload to fall back to
generic text when measurement.siteDetails naming fields are absent. Add the
fallbackLocationName parameter with the value widget.siteName to the
showAirQualityShareSheet call to preserve location quality in the share text and
card.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c37e6894-9031-4c85-8a83-1e9a29aa52dd
📒 Files selected for processing (3)
src/mobile/lib/src/app/dashboard/pages/forecast_overview_page.dartsrc/mobile/lib/src/app/dashboard/widgets/air_quality_share_sheet.dartsrc/mobile/lib/src/app/dashboard/widgets/analytics_specifics.dart
There was a problem hiding this comment.
Pull request overview
This PR updates the mobile forecast details experience to route sharing through a reusable “share card” bottom sheet, so users share the visual air quality card (image) rather than plain text.
Changes:
- Replaces the analytics share flow with a reusable
showAirQualityShareSheet(...)entry point. - Adds a new
AirQualityShareSheetbottom sheet that previews and shares the air quality card as an image. - Replaces the forecast details close button with a share action when a
measurementis available.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/mobile/lib/src/app/dashboard/widgets/analytics_specifics.dart | Switches share action to the new reusable share-sheet entry point and updates the share icon. |
| src/mobile/lib/src/app/dashboard/widgets/air_quality_share_sheet.dart | Introduces the reusable bottom sheet that renders, captures, and shares the air quality share card image. |
| src/mobile/lib/src/app/dashboard/pages/forecast_overview_page.dart | Adds a share entry point in forecast details (using the reusable share sheet) when a measurement is present. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Replaces the close button in the mobile forecast details view with the AirQo share action, routes sharing through a reusable share-card bottom sheet, and removes the plain-text share option so users share the visual air quality card only.
Summary by CodeRabbit
Release Notes
New Features
Improvements