qstatus/qStatus/App/AppState.swift
Paweł Orzech c27437b33c
Initial implementation of qStatus macOS menubar app
Native macOS app for posting to Mastodon, WordPress (self-hosted), and Micro.blog.
Features: global hotkey (Ctrl+Option+Cmd+T), multiple accounts with selection,
image attachments (up to 4, drag-and-drop), floating panel UI, Keychain storage.
2026-02-27 23:40:51 +01:00

39 lines
840 B
Swift

import SwiftUI
@Observable
@MainActor
final class AppState {
var inputText: String = ""
var attachedImages: [ImageAttachment] = []
var selectedAccountIDs: Set<UUID> = []
var isSubmitting: Bool = false
var isPanelVisible: Bool = false
var statusMessage: StatusMessage?
static let maxImages = 4
var canPost: Bool {
!inputText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
&& !selectedAccountIDs.isEmpty
&& !isSubmitting
}
func reset() {
inputText = ""
attachedImages = []
statusMessage = nil
}
}
struct ImageAttachment: Identifiable {
let id = UUID()
let image: NSImage
let data: Data
let filename: String
}
struct StatusMessage: Identifiable {
let id = UUID()
let text: String
let isError: Bool
}