aboutsummaryrefslogtreecommitdiff
path: root/Hotline
diff options
context:
space:
mode:
Diffstat (limited to 'Hotline')
-rw-r--r--Hotline/Library/Views/FileIconView.swift3
-rw-r--r--Hotline/MacApp.swift5
-rw-r--r--Hotline/Models/Bookmark.swift2
-rw-r--r--Hotline/Models/Server.swift5
-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
10 files changed, 58 insertions, 25 deletions
diff --git a/Hotline/Library/Views/FileIconView.swift b/Hotline/Library/Views/FileIconView.swift
index 10692e6..157781f 100644
--- a/Hotline/Library/Views/FileIconView.swift
+++ b/Hotline/Library/Views/FileIconView.swift
@@ -40,9 +40,10 @@ struct FileIconView: View {
else {
return Image(systemName: "doc")
}
-
+
return Image(systemName: "doc")
}
+ }
#elseif os(macOS)
private var fileIcon: Image {
let fileExtension = (self.filename as NSString).pathExtension
diff --git a/Hotline/MacApp.swift b/Hotline/MacApp.swift
index 454e9fd..58db743 100644
--- a/Hotline/MacApp.swift
+++ b/Hotline/MacApp.swift
@@ -47,9 +47,12 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
}
+ // Friendship Quest Remix
+ /*
Task {
await AppUpdate.shared.checkForUpdatesOnLaunch()
}
+ */
}
func applicationWillTerminate(_ notification: Notification) {
@@ -82,7 +85,7 @@ struct Application: App {
let cloudKitConfiguration = ModelConfiguration(
schema: Schema([Bookmark.self]),
isStoredInMemoryOnly: false,
- cloudKitDatabase: .private("iCloud.co.goodmake.hotline")
+ cloudKitDatabase: .private("iCloud.pizza.unlimited.hotline")
)
// For records we only need stored locally.
diff --git a/Hotline/Models/Bookmark.swift b/Hotline/Models/Bookmark.swift
index 4c2a28b..8762787 100644
--- a/Hotline/Models/Bookmark.swift
+++ b/Hotline/Models/Bookmark.swift
@@ -71,7 +71,7 @@ final class Bookmark {
return nil
case .server:
- return Server(name: self.name, description: nil, address: self.address, port: self.port, login: self.login, password: self.password)
+ return Server(name: self.name, description: nil, address: self.address, port: self.port, login: self.login, password: self.password, autoconnect: self.autoconnect)
}
}
diff --git a/Hotline/Models/Server.swift b/Hotline/Models/Server.swift
index bcac81f..f0a9524 100644
--- a/Hotline/Models/Server.swift
+++ b/Hotline/Models/Server.swift
@@ -10,6 +10,8 @@ struct Server: Codable {
var login: String
var password: String
+ var autoconnect: Bool
+
var displayAddress: String {
if self.port == HotlinePorts.DefaultServerPort {
return self.address
@@ -24,7 +26,7 @@ struct Server: Codable {
}
}
- init(name: String?, description: String?, address: String, port: Int = HotlinePorts.DefaultServerPort, users: Int = 0, login: String? = nil, password: String? = nil) {
+ init(name: String?, description: String?, address: String, port: Int = HotlinePorts.DefaultServerPort, users: Int = 0, login: String? = nil, password: String? = nil, autoconnect: Bool? = nil) {
self.name = name
self.description = description
self.address = address.lowercased()
@@ -53,6 +55,7 @@ struct Server: Codable {
self.login = url.user(percentEncoded: false) ?? ""
self.password = url.password(percentEncoded: false) ?? ""
+ self.autoconnect = false
}
static func parseServerAddressAndPort(_ address: String) -> (String, Int) {
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) {