Initial commit — iOS share extension for filing Gitea issues

Two-target Xcode project (xcodegen spec). The GiteaIssue container app
holds the base URL + personal access token in a shared keychain group;
the GiteaIssueShare extension reads them, surfaces a repo picker (with
recents) and a title/notes form, then creates the issue, uploads the
screenshot as an asset, and patches the body to embed it inline.

Min iOS 26.0, signing team V3PF3M6B6U.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude
2026-04-26 23:15:43 -05:00
commit 74e03c4e10
17 changed files with 1451 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
import Foundation
enum RepoCache {
private static let listKey = "repo.list"
private static let listFetchedKey = "repo.list.fetchedAt"
private static let recentsKey = "repo.recents"
private static let recentsCap = 5
static let staleAfter: TimeInterval = 24 * 60 * 60
static var repos: [GiteaRepo] {
get {
guard let data = AppSettings.sharedDefaults.data(forKey: listKey) else { return [] }
let decoder = JSONDecoder()
decoder.dateDecodingStrategy = .iso8601
return (try? decoder.decode([GiteaRepo].self, from: data)) ?? []
}
set {
let encoder = JSONEncoder()
encoder.dateEncodingStrategy = .iso8601
if let data = try? encoder.encode(newValue) {
AppSettings.sharedDefaults.set(data, forKey: listKey)
AppSettings.sharedDefaults.set(Date(), forKey: listFetchedKey)
}
}
}
static var fetchedAt: Date? {
AppSettings.sharedDefaults.object(forKey: listFetchedKey) as? Date
}
static var isStale: Bool {
guard let fetched = fetchedAt else { return true }
return Date().timeIntervalSince(fetched) > staleAfter
}
static var recentFullNames: [String] {
AppSettings.sharedDefaults.stringArray(forKey: recentsKey) ?? []
}
static func touch(_ fullName: String) {
var current = recentFullNames.filter { $0 != fullName }
current.insert(fullName, at: 0)
if current.count > recentsCap { current = Array(current.prefix(recentsCap)) }
AppSettings.sharedDefaults.set(current, forKey: recentsKey)
}
}