feat: Kisani UI overhaul — brand identity, gallery, visual polish

- Rename app to Kisani (CFBundleDisplayName, xcodeproj → Kisani.xcodeproj)
- BackupView: kisani. wordmark + SwiftUI-drawn server logo mark (no asset,
  adaptive ink/bg), 206pt progress ring with active-state glow, 4-page
  swipeable ring (progress/pending/failed/uploaded), 4-metric stats strip,
  friendly NAS card (Home Server label), hamburger → AppMenuView sheet
- GalleryView: new NAS + local photo grid with source picker chip, 3-col
  lazy grid, ThumbnailCache, sync-status dots (green = backed up)
- MainTabView: Browse tab → Gallery tab; tab bar uses ultraThinMaterial
  blur background (systemGray3 icons, 9.5pt labels)
- All app icon sizes regenerated from 1024pt source via sips
- LANMonitor: nasReachable Bool?, checkNASReachability(host:port:) TCP ping
- project.yml: photo library usage description updated to Kisani branding

Co-Authored-By: Kutesir <kutesir@provoc.ug>
Co-Authored-By: Sentry <sentry@provoc.ug>
This commit is contained in:
Robin Kutesa
2026-05-17 11:17:13 +03:00
parent 6cad8d9d6c
commit 59bdad803f
32 changed files with 983 additions and 227 deletions

View File

@@ -33,8 +33,12 @@ final class LANMonitor: ObservableObject {
if path.status == .satisfied {
await self.checkSSID()
if let conn = ConnectionStore.shared.savedConnection {
await self.checkNASReachability(host: conn.host, port: conn.port)
}
} else {
self.currentSSID = nil
self.nasReachable = nil
}
}
}

View File

@@ -80,6 +80,14 @@ final class SFTPService: NASTransferProtocol {
}
}
func downloadData(at remotePath: String) async throws -> Data {
guard let sftp else { throw BackupError.connectionFailed("Not connected") }
return try await sftp.withFile(filePath: remotePath, flags: [.read]) { file in
let buf = try await file.readAll()
return Data(buf.readableBytesView)
}
}
func upload(localURL: URL, remotePath: String, progress: @escaping (Int64, Int64) -> Void) async throws {
guard let sftp else { throw BackupError.connectionFailed("Not connected") }
let filename = localURL.lastPathComponent

View File

@@ -79,6 +79,13 @@ final class SMBService: NASTransferProtocol {
return files.contains { $0.name == filename }
}
func downloadData(at remotePath: String) async throws -> Data {
guard let client else { throw BackupError.connectionFailed("Not connected") }
let (share, rel) = splitPath(remotePath)
try await client.connectShare(share)
return try await client.download(path: rel)
}
func upload(localURL: URL, remotePath: String, progress: @escaping (Int64, Int64) -> Void) async throws {
guard let client else { throw BackupError.connectionFailed("Not connected") }
let (share, rel) = splitPath(remotePath)

View File

@@ -0,0 +1,50 @@
import UIKit
final class ThumbnailCache {
static let shared = ThumbnailCache()
private let memory = NSCache<NSString, UIImage>()
private let diskDir: URL
private init() {
let caches = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask)[0]
diskDir = caches.appendingPathComponent("NASThumb", isDirectory: true)
try? FileManager.default.createDirectory(at: diskDir, withIntermediateDirectories: true)
memory.countLimit = 300
memory.totalCostLimit = 80 * 1024 * 1024 // 80 MB
}
func get(for path: String) -> UIImage? {
let key = cacheKey(path)
if let img = memory.object(forKey: key as NSString) { return img }
let url = diskDir.appendingPathComponent(key)
guard let data = try? Data(contentsOf: url),
let img = UIImage(data: data) else { return nil }
memory.setObject(img, forKey: key as NSString, cost: data.count)
return img
}
func set(_ image: UIImage, for path: String) {
let key = cacheKey(path)
let data = image.jpegData(compressionQuality: 0.7) ?? Data()
memory.setObject(image, forKey: key as NSString, cost: data.count)
let url = diskDir.appendingPathComponent(key)
try? data.write(to: url, options: .atomic)
}
private func cacheKey(_ path: String) -> String {
path
.replacingOccurrences(of: "/", with: "_")
.replacingOccurrences(of: ":", with: "-")
}
}
extension UIImage {
func thumbnailScaled(to size: CGFloat) -> UIImage {
let scale = min(size / self.size.width, size / self.size.height)
guard scale < 1 else { return self }
let newSize = CGSize(width: self.size.width * scale, height: self.size.height * scale)
let renderer = UIGraphicsImageRenderer(size: newSize)
return renderer.image { _ in self.draw(in: CGRect(origin: .zero, size: newSize)) }
}
}