Skip to content

Conversation

@digRabbit
Copy link

@digRabbit digRabbit commented Nov 10, 2025

Overview

This PR adds one-way synchronization from Obsidian Full Calendar to Google Calendar, allowing users to automatically sync their Obsidian calendar events to their Google Calendar.

Features

  • OAuth 2.0 Authentication: Secure authentication with Google Calendar API
  • Automatic Periodic Syncing: Configurable sync interval (default: 5 minutes)
  • Manual Sync: Hotkey and UI button for on-demand syncing
  • Event Operations: Full support for create, update, and delete operations
  • Offline Deletion Tracking: Queues deletions when offline, processes on next sync
  • Orphaned Event Cleanup: Automatically removes events from Google Calendar when deleted in Obsidian
  • Rate Limit Protection: Parallel batch processing with delays to respect API limits
  • Duplicate Prevention: Race condition handling to prevent duplicate events
  • State Persistence: Sync state persists across plugin restarts

Technical Implementation

New Files

  • src/calendars/GoogleCalendar.ts - Google Calendar implementation extending EditableCalendar
  • src/sync/GoogleCalendarSync.ts - Core sync service for Google Calendar API interactions
  • src/sync/SyncScheduler.ts - Automatic periodic sync scheduler
  • docs/calendars/google-calendar-sync.md - User setup guide

Modified Files

  • src/main.ts - Plugin integration and lifecycle management
  • src/ui/components/CalendarSetting.tsx - UI for OAuth and sync controls
  • src/ui/components/AddCalendarSource.tsx - Google Calendar source addition
  • src/ui/settings.ts - Settings schema updates
  • src/types/calendar_settings.ts - Type definitions for Google Calendar
  • src/core/EventCache.ts - Event cache integration

Dependencies

  • googleapis - Google Calendar API client
  • google-auth-library - OAuth 2.0 authentication

Testing

The feature has been tested with:

  • Event creation, update, and deletion
  • Offline deletion tracking
  • Orphaned event cleanup
  • Rate limit handling
  • Duplicate event prevention
  • Multiple calendar instances

Documentation

Setup guide available at docs/calendars/google-calendar-sync.md

Breaking Changes

None - this is a purely additive feature.

Checklist

  • Code follows project style guidelines
  • TypeScript types are properly defined
  • Error handling is comprehensive
  • Documentation is included
  • No console.log statements (only errors/warnings)
  • All linter checks pass
  • Build succeeds without errors

This PR adds one-way synchronization from Obsidian Full Calendar to Google Calendar.

Features:
- OAuth 2.0 authentication with Google Calendar API
- Automatic periodic syncing (configurable interval)
- Manual sync via hotkey and UI button
- Event creation, update, and deletion sync
- Offline deletion tracking with pending deletions queue
- Orphaned event cleanup (removes events deleted in Obsidian from Google Calendar)
- Parallel batch processing with rate limit protection
- Duplicate event prevention with race condition handling
- Sync state persistence across plugin restarts

Technical implementation:
- New GoogleCalendar class extending EditableCalendar
- GoogleCalendarSync service for API interactions
- SyncScheduler for automatic periodic syncing
- UI integration in CalendarSetting component
- Settings schema updates for OAuth config and sync state

Documentation:
- Setup guide moved to docs/calendars/google-calendar-sync.md
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