Skip to content

Commit 0b51a63

Browse files
committed
fix: hide notes toggle when not using Google Calendar, strengthen nil tests
Use a gated Binding so the toggle visually shows off when the event store provider is not Google Calendar (while preserving the stored preference for when the user switches back). Use XCTUnwrap in nil-asserting tests so a parser regression that returns nil is caught rather than silently passing.
1 parent f27095d commit 0b51a63

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

MeetingBar/UI/Views/Preferences/LinksTab.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,13 @@ struct LinksTab: View {
5858
}
5959
}
6060

61-
Toggle("preferences_services_meet_open_notes_on_join".loco(), isOn: $openGoogleMeetingNotesOnJoin)
62-
.frame(maxWidth: .infinity, alignment: .leading)
63-
.disabled(eventStoreProvider != .googleCalendar)
64-
.help("preferences_services_meet_open_notes_on_join_help".loco())
61+
Toggle("preferences_services_meet_open_notes_on_join".loco(), isOn: Binding(
62+
get: { eventStoreProvider == .googleCalendar && openGoogleMeetingNotesOnJoin },
63+
set: { openGoogleMeetingNotesOnJoin = $0 }
64+
))
65+
.frame(maxWidth: .infinity, alignment: .leading)
66+
.disabled(eventStoreProvider != .googleCalendar)
67+
.help("preferences_services_meet_open_notes_on_join_help".loco())
6568

6669
Picker(
6770
selection: $zoomBrowser,

MeetingBarTests/GCEventStoreTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ final class GCEventStoreTests: XCTestCase {
3535
"https://docs.google.com/document/d/abc123/edit")
3636
}
3737

38-
func testIgnoresNonDocumentAttachment() {
38+
func testIgnoresNonDocumentAttachment() throws {
3939
var item = baseItem()
4040
item["attachments"] = [
4141
[
@@ -46,14 +46,14 @@ final class GCEventStoreTests: XCTestCase {
4646
]
4747
]
4848

49-
let event = GCEventStore.GCParser.event(from: item, calendar: calendar)
49+
let event = try XCTUnwrap(GCEventStore.GCParser.event(from: item, calendar: calendar))
5050

51-
XCTAssertNil(event?.meetingNotesDocLink)
51+
XCTAssertNil(event.meetingNotesDocLink)
5252
}
5353

54-
func testNoAttachmentsLeavesMeetingNotesNil() {
55-
let event = GCEventStore.GCParser.event(from: baseItem(), calendar: calendar)
54+
func testNoAttachmentsLeavesMeetingNotesNil() throws {
55+
let event = try XCTUnwrap(GCEventStore.GCParser.event(from: baseItem(), calendar: calendar))
5656

57-
XCTAssertNil(event?.meetingNotesDocLink)
57+
XCTAssertNil(event.meetingNotesDocLink)
5858
}
5959
}

0 commit comments

Comments
 (0)