Switches the project from AGPL to a source-available license that restricts commercial use — selling oAI or any part of it, standalone or bundled into another product/service, now requires a separate commercial license from the copyright holder. Noncommercial use, study, modification, and sharing remain fully permitted. Updates: LICENSE (canonical PolyForm Noncommercial 1.0.0 text + commercial licensing contact note), SPDX headers and file-header boilerplate across all Swift source files, the in-app About dialog's license link (+ its localization catalog entry), README.md and DEVELOPMENT.md license sections. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
52 lines
1.5 KiB
Swift
52 lines
1.5 KiB
Swift
//
|
|
// HistoryEntry.swift
|
|
// oAI
|
|
//
|
|
// Command history entry model
|
|
//
|
|
// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
|
|
// Copyright (C) 2026 Rune Olsen
|
|
//
|
|
// This file is part of oAI.
|
|
//
|
|
// oAI is licensed under the PolyForm Noncommercial License 1.0.0.
|
|
// You may use, study, modify, and share it for any noncommercial
|
|
// purpose. Commercial use — including selling oAI or any part of
|
|
// it, standalone or bundled into another product or service —
|
|
// requires a separate commercial license from the copyright holder.
|
|
//
|
|
// See the LICENSE file or
|
|
// <https://polyformproject.org/licenses/noncommercial/1.0.0> for
|
|
// the full license text. For commercial licensing, contact Rune
|
|
// Olsen via <https://mac.oai.pm>.
|
|
|
|
|
|
import Foundation
|
|
|
|
struct HistoryEntry: Identifiable, Equatable {
|
|
let id = UUID()
|
|
let input: String
|
|
let timestamp: Date
|
|
|
|
/// Format timestamp in European format (dd.MM.yyyy HH:mm:ss)
|
|
var formattedDate: String {
|
|
let formatter = DateFormatter()
|
|
formatter.dateFormat = "dd.MM.yyyy HH:mm:ss"
|
|
return formatter.string(from: timestamp)
|
|
}
|
|
|
|
/// Short date without time (dd.MM.yyyy)
|
|
var shortDate: String {
|
|
let formatter = DateFormatter()
|
|
formatter.dateFormat = "dd.MM.yyyy"
|
|
return formatter.string(from: timestamp)
|
|
}
|
|
|
|
/// Just the time (HH:mm:ss)
|
|
var timeOnly: String {
|
|
let formatter = DateFormatter()
|
|
formatter.dateFormat = "HH:mm:ss"
|
|
return formatter.string(from: timestamp)
|
|
}
|
|
}
|