-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add Apple Calendar and Notes export integration #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Extends action item export functionality to support Apple Calendar and Notes in addition to existing Reminders support. New features: - Export dropdown for selecting destination (Reminders/Calendar/Notes) - Apple Calendar integration via EventKit - Apple Notes integration via share sheet - Persistent storage of user's export preference Implementation: - Added AppleCalendarService.swift and AppleNotesService.swift for iOS - Created Dart service wrappers for Calendar and Notes - Extended ActionItemTileWidget with dropdown export UI - Added ActionItemIntegration enum for managing destinations - Updated AppDelegate to register new method channels
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR extends the existing Apple Reminders integration by adding Apple Calendar and Notes export functionality for action items. Users can now select their preferred export destination through a dropdown interface, with their choice being persisted across sessions.
Key changes include:
- Added Apple Calendar integration using EventKit to create calendar events
- Added Apple Notes integration using iOS share sheet functionality
- Implemented export destination selection UI with persistent user preferences
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
app/lib/services/apple_notes_service.dart |
Dart service wrapper for Apple Notes share sheet integration |
app/lib/services/apple_calendar_service.dart |
Dart service wrapper for Apple Calendar EventKit integration |
app/lib/pages/action_items/widgets/action_item_tile_widget.dart |
Updated widget to support multiple export destinations with dropdown UI |
app/lib/models/action_item_integration.dart |
Enum defining available export destinations and their display properties |
app/lib/backend/preferences_export_extension.dart |
Extension for persisting user's export destination preference |
app/ios/Runner/AppleNotesService.swift |
Native iOS service for Notes share sheet functionality |
app/ios/Runner/AppleCalendarService.swift |
Native iOS service for Calendar event creation using EventKit |
app/ios/Runner/AppDelegate.swift |
Updated to register new method channels for Notes and Calendar services |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
| final formattedContent = ''' | ||
| Action Item: $description | ||
| Created: ${DateTime.now().toLocal()} |
Copilot
AI
Aug 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The DateTime formatting is inconsistent between services. Consider using a consistent format across all services or creating a shared utility function for date formatting.
|
|
||
| class _ActionItemTileWidgetState extends State<ActionItemTileWidget> { | ||
| // Track which integration is currently selected for export. This defaults | ||
| // to Apple Reminders but is loaded from saved preferences on init. |
Copilot
AI
Aug 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The comment mentions defaulting to Apple Reminders, but the actual default assignment is on line 43. Consider moving the comment closer to the assignment or combining them for clarity.
| // to Apple Reminders but is loaded from saved preferences on init. | |
| // Track which integration is currently selected for export. | |
| // Defaults to Apple Reminders but is loaded from saved preferences on init. |
app/lib/pages/action_items/widgets/action_item_tile_widget.dart
Outdated
Show resolved
Hide resolved
| result(completed) | ||
| } | ||
| } | ||
| if let controller = UIApplication.shared.keyWindow?.rootViewController { |
Copilot
AI
Aug 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using keyWindow is deprecated in iOS 13+. Consider using UIApplication.shared.connectedScenes to find the active window scene and its root view controller for better compatibility.
| if let controller = UIApplication.shared.keyWindow?.rootViewController { | |
| var rootViewController: UIViewController? | |
| if #available(iOS 13.0, *) { | |
| // Find the active window scene | |
| if let windowScene = UIApplication.shared.connectedScenes | |
| .compactMap({ $0 as? UIWindowScene }) | |
| .first(where: { $0.activationState == .foregroundActive }) { | |
| rootViewController = windowScene.windows | |
| .first(where: { $0.isKeyWindow })?.rootViewController | |
| } | |
| } else { | |
| rootViewController = UIApplication.shared.keyWindow?.rootViewController | |
| } | |
| if let controller = rootViewController { |
| event.notes = notes | ||
| // Default event duration: now + 1 hour | ||
| event.startDate = Date() | ||
| event.endDate = Date().addingTimeInterval(3600) |
Copilot
AI
Aug 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded 3600 seconds (1 hour) should be extracted as a named constant to improve readability and maintainability.
| event.endDate = Date().addingTimeInterval(3600) | |
| event.endDate = Date().addingTimeInterval(Self.defaultEventDurationSeconds) |
- Fixed status indicator colors to match upstream (blue for pending, green for exported) - Added Apple Notes and Calendar icon assets from PR 2770 - Updated ActionItemIntegration to use proper icon assets - Ensures consistent visual design across all export integrations
54b90e9 to
2ce2f00
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bugbot free trial expires on August 31, 2025
Learn more in the Cursor dashboard.
| false; | ||
| } | ||
| return false; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Local State Loss Causes Export Inconsistency
Export state for Apple Notes and Calendar is managed locally and lost on widget rebuilds, unlike Apple Reminders which persists via parent state. This causes Notes and Calendar items to incorrectly show as not exported after navigation or rebuilds, creating an inconsistent user experience.
closes BasedHardware#3241 before: https://github.com/user-attachments/assets/d00d815c-8419-4c1b-96fb-ec20365fba44 logs: ``` flutter: ----------------FIREBASE CRASHLYTICS---------------- flutter: Bad state: No element flutter: #0 ListBase.firstWhere (dart:collection/list.dart:132:5) #1 SharedPreferencesUtil.disableApp (package:omi/backend/preferences.dart:255:22) #2 _AppDetailPageState._toggleApp (package:omi/pages/apps/app_detail/app_detail.dart:1129:13) #3 _AppDetailPageState.build.<anonymous closure> (package:omi/pages/apps/app_detail/app_detail.dart:576:48) #4 _AnimatedLoadingButtonState._handleOnPressed (package:omi/widgets/animated_loading_button.dart:38:27) #5 _InkResponseState.handleTap (package:flutter/src/material/ink_well.dart:1204:21) #6 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:345:24) #7 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:758:11) #8 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:383:5) #9 BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:353:7) #10 GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:173:27) #11 ``` after: https://github.com/user-attachments/assets/26ea5c91-e73a-44f4-ba76-4b804876c5df <img width="1032" height="257" alt="Screenshot 2025-10-18 at 11 15 52 PM" src="https://github.com/user-attachments/assets/44e4e46b-b654-4599-84ee-8ee0920b1cd3" />
Summary
This PR adds Apple Calendar and Notes export functionality to complement the existing Apple Reminders integration for action items.
Features
Implementation Details
New Files Added
app/ios/Runner/AppleCalendarService.swift- EventKit integration for Calendarapp/ios/Runner/AppleNotesService.swift- Share sheet integration for Notesapp/lib/services/apple_calendar_service.dart- Dart wrapper for Calendarapp/lib/services/apple_notes_service.dart- Dart wrapper for Notesapp/lib/models/action_item_integration.dart- Export destination enumapp/lib/backend/preferences_export_extension.dart- Preference storageFiles Modified
app/ios/Runner/AppDelegate.swift- Registered new method channelsapp/lib/pages/action_items/widgets/action_item_tile_widget.dart- Added export dropdown UITesting Instructions
flutter pub getCompatibility