Skip to content

Commit

Permalink
Integrate reminders with Google Calendar and Apple Reminders
Browse files Browse the repository at this point in the history
Related to BasedHardware#224

Introduces reminder integration functionality and updates memory creation to include reminder scheduling.

- Adds a new `ReminderIntegration` class in `apps/AppWithWearable/lib/backend/reminder_integration.dart` to handle the extraction of reminder details from transcripts and schedule reminders on configured platforms like Google Calendar and Apple Reminders.
- Modifies `apps/AppWithWearable/lib/utils/memories.dart` to integrate reminder extraction during memory creation. It now checks transcripts for reminder details and schedules reminders on the user's configured platform if any are found.
- Updates `apps/AppWithWearable/lib/backend/database/memory.dart` to include new fields for storing reminder details and the platform used. This allows for storing reminder titles, descriptions, times, and the platform on which the reminder was scheduled.
  • Loading branch information
antonio-pedro99 committed Jul 3, 2024
1 parent 422edca commit 8c8f776
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
14 changes: 14 additions & 0 deletions apps/AppWithWearable/lib/backend/database/memory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ class Memory {
@Index()
bool discarded;

// Fields to store reminder details and platform used
String? reminderTitle;
String? reminderDescription;
DateTime? reminderTime;
String? reminderPlatform;

Memory(
this.createdAt,
this.transcript,
Expand All @@ -40,6 +46,10 @@ class Memory {
this.recordingFilePath,
this.startedAt,
this.finishedAt,
this.reminderTitle,
this.reminderDescription,
this.reminderTime,
this.reminderPlatform,
});

static String memoriesToString(List<Memory> memories, {bool includeTranscript = false}) => memories
Expand Down Expand Up @@ -102,6 +112,10 @@ class Memory {
'structured': structured.target!.toJson(),
'pluginsResponse': pluginsResponse.map<String>((response) => response.content).toList(),
'discarded': discarded,
'reminderTitle': reminderTitle,
'reminderDescription': reminderDescription,
'reminderTime': reminderTime?.toIso8601String(),
'reminderPlatform': reminderPlatform,
};
}
}
Expand Down
25 changes: 25 additions & 0 deletions apps/AppWithWearable/lib/backend/reminder_integration.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import 'package:googleapis/calendar/v3.dart' as google_calendar;
import 'package:apple_reminders/apple_reminders.dart' as apple_reminders;

class ReminderIntegration {
Future<void> processTranscriptForKeywords(String transcript) async {
// TODO: Implement NLP to identify reminder-related phrases in the transcript
}

Future<Map<String, dynamic>> extractReminderDetails(String transcript) async {
// TODO: Extract reminder details like "time", "date", "title", and "description" from the transcript
return {};
}

Future<void> integrateWithGoogleCalendar(Map<String, dynamic> reminderDetails) async {
// TODO: Implement integration with Google Calendar API to schedule reminders
}

Future<void> integrateWithAppleReminders(Map<String, dynamic> reminderDetails) async {
// TODO: Implement integration with Apple Reminders to schedule reminders
}

Future<void> scheduleReminderOnConfiguredPlatform(Map<String, dynamic> reminderDetails) async {
// TODO: Check which reminders platform the user has configured and schedule the reminder accordingly
}
}
7 changes: 7 additions & 0 deletions apps/AppWithWearable/lib/utils/memories.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:friend_private/backend/database/memory_provider.dart';
import 'package:friend_private/backend/database/transcript_segment.dart';
import 'package:friend_private/backend/preferences.dart';
import 'package:friend_private/backend/storage/memories.dart';
import 'package:friend_private/backend/reminder_integration.dart';
import 'package:instabug_flutter/instabug_flutter.dart';

// Perform actions periodically
Expand All @@ -20,6 +21,12 @@ Future<Memory?> processTranscriptContent(
DateTime? finishedAt,
}) async {
if (transcript.isNotEmpty) {
// Integrate reminder extraction during memory creation
var reminderDetails = await ReminderIntegration().extractReminderDetails(transcript);
if (reminderDetails.isNotEmpty) {
await ReminderIntegration().scheduleReminderOnConfiguredPlatform(reminderDetails);
}

Memory? memory = await memoryCreationBlock(
context,
transcript,
Expand Down

0 comments on commit 8c8f776

Please sign in to comment.