Skip to content

Conversation

@eulicesl
Copy link
Owner

Summary

This PR merges the Apple Calendar/Notes export features with the changes introduced in PR BasedHardware#2719 (Separate action items fetching from convos).

Features Added

  • Export Dropdown: Added a dropdown menu to ActionItemTileWidget allowing users to select their preferred export destination
  • Apple Calendar Integration: Export action items as calendar events with proper date/time handling
  • Apple Notes Integration: Export action items as formatted notes in Apple Notes app
  • Persistent Preferences: User's export destination choice is saved and remembered across sessions

Implementation Details

New Files

  • app/ios/Runner/AppleCalendarService.swift - EventKit integration for Calendar
  • app/ios/Runner/AppleNotesService.swift - Apple Notes export functionality
  • app/lib/models/action_item_integration.dart - Enum for export destinations
  • app/lib/backend/preferences_export_extension.dart - SharedPreferences extension
  • app/lib/services/apple_calendar_service.dart - Dart service for Calendar
  • app/lib/services/apple_notes_service.dart - Dart service for Notes

Modified Files

  • app/ios/Runner/AppDelegate.swift - Added method channels for new services
  • app/lib/pages/action_items/widgets/action_item_tile_widget.dart - Added export dropdown UI

Export Options

Users can now export action items to:

  1. Apple Reminders (existing functionality)
  2. Apple Calendar (new) - Creates calendar events with:
    • Title from action item
    • Description with full details
    • Scheduled date/time if available
  3. Apple Notes (new) - Creates formatted notes with:
    • Title and description
    • Scheduled time information
    • Creation metadata

Testing

To test this feature:

  1. Run flutter pub get to ensure dependencies are updated
  2. Build and run on iOS device/simulator
  3. Navigate to Action Items page
  4. Use the dropdown to select export destination (Calendar/Notes/Reminders)
  5. Tap the export button to test each integration

Compatibility

  • Requires iOS 10.0+ for EventKit (Calendar)
  • Requires iOS 9.0+ for Apple Notes
  • Fully backward compatible with existing Reminders functionality

This commit merges the Apple Calendar/Notes export features with the changes from PR BasedHardware#2719.

Key changes:
- Added export dropdown to ActionItemTileWidget with Calendar, Notes, and Reminders options
- Implemented AppleCalendarService for EventKit Calendar integration on iOS
- Implemented AppleNotesService for Apple Notes export on iOS
- Added ActionItemIntegration enum for managing export destinations
- Extended SharedPreferences to store user's chosen export destination
- Updated AppDelegate.swift to handle new native method channels

The implementation allows users to export action items directly to:
- Apple Reminders (existing)
- Apple Calendar (new)
- Apple Notes (new)

Users can select their preferred export destination via a dropdown menu
that remembers their choice across sessions.
Copilot AI review requested due to automatic review settings August 17, 2025 15:46
Copy link

Copilot AI left a 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 adds Apple Calendar and Notes export functionality for action items, merging with changes from PR BasedHardware#2719. The implementation provides users with multiple export destinations (Reminders, Notes, Calendar) through a configurable dropdown interface.

  • Adds Apple Calendar integration for creating calendar events from action items
  • Adds Apple Notes integration for sharing action items to the Notes app via native share sheet
  • Implements persistent user preferences for export destination selection

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
app/lib/services/apple_notes_service.dart Dart service wrapper for Apple Notes integration using platform channels
app/lib/services/apple_calendar_service.dart Dart service wrapper for Apple Calendar integration using EventKit
app/lib/pages/action_items/widgets/action_item_tile_widget.dart Converts to StatefulWidget and adds export dropdown UI with multi-destination support
app/lib/models/action_item_integration.dart Enum defining available export destinations with display names and icons
app/lib/backend/preferences_export_extension.dart SharedPreferences extension for persisting export destination choice
app/ios/Runner/AppleNotesService.swift Native iOS implementation for Notes app integration via UIActivityViewController
app/ios/Runner/AppleCalendarService.swift Native iOS implementation for Calendar integration using EventKit framework
app/ios/Runner/AppDelegate.swift Registers method channels for new 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.

cursor[bot]

This comment was marked as outdated.

- Use ISO8601 date formatting instead of manual string splitting
- Add proper error logging with debugPrint instead of catching with underscore
- Replace force unwrapping with guard statements in Swift code
- Make calendar event duration configurable (default 60 minutes)
- Fix export state persistence by lifting state management to parent widget
- Ensure export tracking is consistent across all integrations
if let controller = UIApplication.shared.keyWindow?.rootViewController {
controller.present(activityViewController, animated: true)
} else {
result(false)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Deprecated Key Window Affects Share Sheet

The shareToNotes method uses UIApplication.shared.keyWindow to present the share sheet. This property is deprecated in iOS 13+ and can return nil on newer iOS versions, which prevents the share sheet from presenting.

Fix in Cursor Fix in Web

'reminders': <String>{},
'notes': <String>{},
'calendar': <String>{},
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Export Status Inconsistency and State Loss

The _exportedItems getter in ActionItemTileWidgetState has two issues: when widget.exportedItems is null, it creates a new map on each access, losing local state changes. When widget.exportedItems is provided, it allows direct modification of parent state. This results in inconsistent export status and lost tracking.

Fix in Cursor Fix in Web

@eulicesl
Copy link
Owner Author

✅ All code review feedback has been addressed:

  • Fixed DateTime formatting to use ISO8601
  • Improved error handling with proper logging
  • Replaced force unwrapping with guard statements
  • Made event duration configurable
  • Fixed export state persistence issue

The code is now ready for final review and merge.

@eulicesl eulicesl closed this Aug 17, 2025
eulicesl pushed a commit that referenced this pull request Oct 24, 2025
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"
/>
@eulicesl eulicesl deleted the feat/apple-notes-calendar-export branch October 24, 2025 12:30
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.

2 participants