-
-
Notifications
You must be signed in to change notification settings - Fork 264
feat: add support for multiple Google Calendar accounts #911
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
base: master
Are you sure you want to change the base?
Changes from all commits
7ca2600
6eb345c
df75974
59b9cc4
4332a5a
a1d7362
4ac4289
05f3e9a
5144e65
dc104e5
b944ec9
693f3ae
dbcf6d7
77bbaeb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| // | ||
| // GoogleAccount.swift | ||
| // MeetingBar | ||
| // | ||
| // Created for multi-account Google Calendar support. | ||
| // Copyright © 2026 Andrii Leitsius. All rights reserved. | ||
| // | ||
|
|
||
| import Defaults | ||
| import Foundation | ||
|
|
||
| public struct GoogleAccount: Identifiable, Codable, Hashable, Sendable, Defaults.Serializable { | ||
| public let id: String | ||
| public let email: String | ||
|
|
||
| public init(id: String, email: String) { | ||
| self.id = id | ||
| self.email = email | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,7 +8,6 @@ | |||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| import EventKit | ||||||||||||||||||||||||||
| import SwiftUI | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| import Defaults | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| struct CalendarsTab: View { | ||||||||||||||||||||||||||
|
|
@@ -20,13 +19,29 @@ struct CalendarsTab: View { | |||||||||||||||||||||||||
| ProviderPicker(eventManager: eventManager) | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| .padding(.bottom, 5) | ||||||||||||||||||||||||||
| Label("preferences_calendars_select_calendars_title".loco(), systemImage: "calendar").padding(5) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if Defaults[.eventStoreProvider] == .googleCalendar { | ||||||||||||||||||||||||||
| GroupBox(label: Label("preferences_calendars_google_accounts_title", systemImage: "person.3")) { | ||||||||||||||||||||||||||
| GoogleAccountsSection(eventManager: eventManager) | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| .padding(.bottom, 5) | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Label("preferences_calendars_select_calendars_title", systemImage: "calendar").padding(5) | ||||||||||||||||||||||||||
| List { | ||||||||||||||||||||||||||
| if eventManager.calendars.isEmpty { | ||||||||||||||||||||||||||
| if Defaults[.eventStoreProvider] == .macOSEventKit { | ||||||||||||||||||||||||||
| AccessDeniedBanner() | ||||||||||||||||||||||||||
| } else if Defaults[.googleAccounts].isEmpty { | ||||||||||||||||||||||||||
| Text("preferences_calendars_no_accounts_connected") | ||||||||||||||||||||||||||
| .foregroundColor(.secondary) | ||||||||||||||||||||||||||
| .padding() | ||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||
| Text("preferences_calendars_no_calendars_available") | ||||||||||||||||||||||||||
| .foregroundColor(.secondary) | ||||||||||||||||||||||||||
| .padding() | ||||||||||||||||||||||||||
|
Comment on lines
+39
to
+42
|
||||||||||||||||||||||||||
| } else { | |
| Text("No accounts connected. Add a Google account to get started.") | |
| .foregroundColor(.secondary) | |
| .padding() | |
| } else if Defaults[.googleAccounts].isEmpty { | |
| Text("No accounts connected. Add a Google account to get started.") | |
| .foregroundColor(.secondary) | |
| .padding() | |
| } else { | |
| Text("No calendars available. Try refreshing or check account access.") | |
| .foregroundColor(.secondary) | |
| .padding() |
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.
"No calendars available" may be misleading for failed auth states.
When Defaults[.googleAccounts] is non-empty but calendars is empty, this could mean:
- The account genuinely has no calendars
- Auth state restoration failed (phantom account)
- Network error during fetch
The message "no calendars available" doesn't guide users to re-authenticate if their session is invalid. Consider showing account-specific status or prompting to remove and re-add accounts that fail to load.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@MeetingBar/UI/Views/Preferences/CalendarsTab.swift` around lines 35 - 43,
When Defaults[.googleAccounts] is non-empty but the calendars list is empty,
change the UI branch to distinguish between "no calendars" and load/auth
failures: detect per-account fetch/auth state (e.g. an
account.calendarFetchError or account.authRestored flag provided by your
calendar loading logic) and, for accounts with auth or network failures, show an
account-specific message like "Couldn't load calendars for {account.email} —
re-authenticate or remove account" plus Buttons that call existing or new
handlers such as reauthenticateAccount(account) and
removeGoogleAccount(account); only fall back to the generic "no calendars
available" message when the account is healthy and truly has no calendars.
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.
New UI strings in this file are hard-coded (e.g., "Google Accounts", "No accounts connected…", "Add Google Account", "Connected", "Remove Account", etc.) while the surrounding Preferences UI uses localized strings via
.loco(). Please switch these new user-facing strings to the localization system so they participate in translations.