aboutsummaryrefslogtreecommitdiff
path: root/Hotline/macOS
diff options
context:
space:
mode:
Diffstat (limited to 'Hotline/macOS')
-rw-r--r--Hotline/macOS/Chat/ServerAgreementView.swift15
-rw-r--r--Hotline/macOS/ConnectView.swift9
-rw-r--r--Hotline/macOS/Files/FilesView.swift13
-rw-r--r--Hotline/macOS/ServerView.swift13
-rw-r--r--Hotline/macOS/Trackers/TrackerItemView.swift13
-rw-r--r--Hotline/macOS/Trackers/TrackerView.swift5
6 files changed, 47 insertions, 21 deletions
diff --git a/Hotline/macOS/Chat/ServerAgreementView.swift b/Hotline/macOS/Chat/ServerAgreementView.swift
index c65a1cb..b69c582 100644
--- a/Hotline/macOS/Chat/ServerAgreementView.swift
+++ b/Hotline/macOS/Chat/ServerAgreementView.swift
@@ -52,20 +52,7 @@ struct ServerAgreementView: View {
withAnimation(.easeOut(duration: 0.15)) {
expanded = true
}
- },
- label: {
- Color.black
- .opacity(0.00001)
- .frame(width: 32, height: 32)
- .overlay(
- Image(systemName: "arrow.up.left.and.arrow.down.right")
- .resizable()
- .scaledToFit()
- .fontWeight(.semibold)
- .frame(width: 12, height: 12)
- .foregroundColor(.primary.opacity(0.8)), alignment: .center)
- }
- }, label: {
+ }, label: {
Image(systemName: "arrow.up.and.down.circle.fill")
.resizable()
.scaledToFit()
diff --git a/Hotline/macOS/ConnectView.swift b/Hotline/macOS/ConnectView.swift
index 8419522..de1596e 100644
--- a/Hotline/macOS/ConnectView.swift
+++ b/Hotline/macOS/ConnectView.swift
@@ -12,7 +12,8 @@ struct ConnectView: View {
@State private var bookmarkSheetPresented: Bool = false
@State private var bookmarkName: String = ""
-
+ @State private var autoconnect: Bool = false
+
private enum FocusFields {
case address
case login
@@ -112,6 +113,7 @@ struct ConnectView: View {
TextField("Bookmark Name", text: self.$bookmarkName)
.textFieldStyle(.roundedBorder)
.controlSize(.large)
+ Toggle("Connect on Startup", isOn: $autoconnect)
}
.frame(width: 250)
.padding()
@@ -135,7 +137,7 @@ struct ConnectView: View {
let password: String? = self.password.isBlank ? nil : self.password
if !host.isEmpty {
- let newBookmark = Bookmark(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, autoconnect: autoconnect)
Bookmark.add(newBookmark, context: modelContext)
}
}
@@ -143,5 +145,8 @@ struct ConnectView: View {
}
}
}
+ .onAppear {
+ autoconnect = false
+ }
}
}
diff --git a/Hotline/macOS/Files/FilesView.swift b/Hotline/macOS/Files/FilesView.swift
index c9c4c24..07ea641 100644
--- a/Hotline/macOS/Files/FilesView.swift
+++ b/Hotline/macOS/Files/FilesView.swift
@@ -15,6 +15,14 @@ struct FilesView: View {
@State private var confirmDeleteShown: Bool = false
@State private var newFolderShown: Bool = false
+ // Friendship Quest Remix
+ private func isInHomeFolder(_ file: FileInfo?) -> Bool {
+ if let file {
+ return file.path.first == "~" && file.path.count > 1
+ }
+ return false
+ }
+
var body: some View {
NavigationStack {
List(self.displayedFiles, id: \.self, selection: self.$selection) { file in
@@ -92,7 +100,10 @@ struct FilesView: View {
}
.disabled(selectedFile == nil || (selectedFile != nil && !selectedFile!.isPreviewable))
- if model.access?.contains(.canDeleteFiles) == true {
+ if model.access?.contains(.canDeleteFiles) == true
+ // Friendship Quest Remix
+ || isInHomeFolder(selectedFile)
+ {
Divider()
Button {
diff --git a/Hotline/macOS/ServerView.swift b/Hotline/macOS/ServerView.swift
index 4026e92..d490c1b 100644
--- a/Hotline/macOS/ServerView.swift
+++ b/Hotline/macOS/ServerView.swift
@@ -92,7 +92,6 @@ struct ServerView: View {
@State private var connectionDisplayed: Bool = false
// @State private var accountsShown: Bool = false
- @State private var autoconnect: Bool = false
static var menuItems: [ServerMenuItem] = [
ServerMenuItem(type: .chat, name: "Chat", image: "Section Chat"),
ServerMenuItem(type: .board, name: "Board", image: "Section Board"),
@@ -239,6 +238,15 @@ struct ServerView: View {
.focusedSceneValue(\.activeServerState, state)
}
+ private func startReconnectTimer() {
+ reconnectTimer = Task {
+ while !Task.isCancelled {
+ connectToServer()
+ try? await Task.sleep(for: .seconds(5))
+ }
+ }
+ }
+
private var connectForm: some View {
ConnectView(address: self.$connectAddress, login: self.$connectLogin, password: self.$connectPassword) {
self.connectToServer()
@@ -255,9 +263,6 @@ struct ServerView: View {
.onChange(of: self.connectPassword) {
self.server.password = self.connectPassword
}
- .onAppear {
- autoconnect = false
- }
}
private var navigationList: some View {
diff --git a/Hotline/macOS/Trackers/TrackerItemView.swift b/Hotline/macOS/Trackers/TrackerItemView.swift
index 37093d2..cff0a8b 100644
--- a/Hotline/macOS/Trackers/TrackerItemView.swift
+++ b/Hotline/macOS/Trackers/TrackerItemView.swift
@@ -62,6 +62,19 @@ struct TrackerItemView: View {
.opacity(0.75)
.padding(.leading, 3)
.padding(.trailing, 2)
+ Image(systemName: "bolt.fill")
+ .resizable()
+ .renderingMode(.template)
+ .aspectRatio(contentMode: .fit)
+ .frame(width: 13, height: 13, alignment: .center)
+ .opacity(0.5)
+ .padding(.leading, 3)
+ .padding(.trailing, 2)
+ .foregroundStyle(bookmark.autoconnect ? Color.accentColor : Color.gray)
+ .onTapGesture {
+ bookmark.autoconnect.toggle()
+ try? bookmark.modelContext?.save()
+ }
Image("Server")
.resizable()
.scaledToFit()
diff --git a/Hotline/macOS/Trackers/TrackerView.swift b/Hotline/macOS/Trackers/TrackerView.swift
index e0ca87d..0f598ca 100644
--- a/Hotline/macOS/Trackers/TrackerView.swift
+++ b/Hotline/macOS/Trackers/TrackerView.swift
@@ -157,6 +157,11 @@ struct TrackerView: View {
) {
self.toggleExpanded(for: bookmark)
}
+ .onAppear {
+ if bookmark.autoconnect, let server = bookmark.server {
+ openWindow(id: "server", value: server)
+ }
+ }
.tag(TrackerSelection.bookmark(bookmark))
if bookmark.type == .tracker && self.expandedTrackers.contains(bookmark) {