From 277c4cb65218adb8485bb28560a9bb4cca42da82 Mon Sep 17 00:00:00 2001 From: Dustin Mierau Date: Thu, 16 May 2024 20:57:05 -0700 Subject: Enable CloudKit. Fix saving server bookmarks. Remove old bookmarks code. --- Hotline/macOS/ServerView.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Hotline/macOS/ServerView.swift') diff --git a/Hotline/macOS/ServerView.swift b/Hotline/macOS/ServerView.swift index 64c3fbd..e3f0596 100644 --- a/Hotline/macOS/ServerView.swift +++ b/Hotline/macOS/ServerView.swift @@ -127,11 +127,11 @@ enum ServerNavigationType: Identifiable, Hashable, Equatable { } struct ServerView: View { - @Environment(BookmarksOld.self) private var bookmarks: BookmarksOld @Environment(\.dismiss) var dismiss @Environment(\.colorScheme) private var colorScheme @Environment(\.controlActiveState) private var controlActiveState @Environment(\.scenePhase) private var scenePhase + @Environment(\.modelContext) private var modelContext @State private var model: Hotline = Hotline(trackerClient: HotlineTrackerClient(), client: HotlineClient()) @State private var state: ServerState = ServerState(selection: .chat) @@ -334,7 +334,8 @@ struct ServerView: View { let password: String? = connectPassword.isEmpty ? nil : connectPassword if !host.isEmpty { - let _ = bookmarks.add(BookmarkOld(type: .server, name: name, address: host, port: port, login: login, password: password)) + let newBookmark = Bookmark(type: .server, name: name, address: host, port: port, login: login, password: password) + Bookmark.add(newBookmark, context: modelContext) } } } -- cgit