フォルダ内の写真から、中身が同じものと見た目が似ているものを検出して グループにまとめ、残す1枚を選んでほかをゴミ箱へ送れるようにする。 検出は安い判定から順に4段: - ファイルサイズが同じものだけ SHA-256 でバイト一致を確定 - dHash(知覚ハッシュ)のハミング距離で候補ペアを抽出 - 候補に出てくる画像だけ Vision の feature print で精査 - Union-Find で連結成分をグループ化 判定のしきい値は実写画像で距離を実測して決めた(docs/calibration.md)。 tools/release-update.sh で Gitea のリリースを更新する。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
58 lines
2.1 KiB
Swift
58 lines
2.1 KiB
Swift
import SwiftUI
|
|
|
|
struct GroupDetailView: View {
|
|
@Bindable var model: ScanViewModel
|
|
let group: SimilarityGroup
|
|
|
|
private let columns = [GridItem(.adaptive(minimum: 168, maximum: 168), spacing: 18, alignment: .top)]
|
|
|
|
var body: some View {
|
|
ScrollView {
|
|
LazyVGrid(columns: columns, alignment: .leading, spacing: 20) {
|
|
ForEach(group.members) { member in
|
|
PhotoTileView(
|
|
member: member,
|
|
isRepresentative: member.id == group.representativeID,
|
|
isMarked: model.markedForDeletion.contains(member.id),
|
|
canMark: model.canMark(member.id, in: group),
|
|
onToggle: { model.toggleMark(member.id, in: group) }
|
|
)
|
|
}
|
|
}
|
|
.padding(20)
|
|
}
|
|
.safeAreaInset(edge: .top) { header }
|
|
.navigationTitle(group.representative.fileName)
|
|
.navigationSubtitle("\(group.members.count) 枚")
|
|
}
|
|
|
|
private var header: some View {
|
|
VStack(alignment: .leading, spacing: 4) {
|
|
HStack(spacing: 8) {
|
|
Text(group.kindText)
|
|
.font(.caption.weight(.semibold))
|
|
.padding(.horizontal, 7)
|
|
.padding(.vertical, 2)
|
|
.background(
|
|
group.isAllExact ? Color.orange.opacity(0.22) : Color.accentColor.opacity(0.18),
|
|
in: Capsule()
|
|
)
|
|
Text("\(group.members.count) 枚・合計 \(group.totalBytesText)")
|
|
Text("1枚残すと \(group.reclaimableBytesText) 削減")
|
|
.foregroundStyle(.secondary)
|
|
}
|
|
.font(.callout)
|
|
|
|
Text(group.representative.url.deletingLastPathComponent().path)
|
|
.font(.caption)
|
|
.foregroundStyle(.tertiary)
|
|
.lineLimit(1)
|
|
.truncationMode(.head)
|
|
}
|
|
.frame(maxWidth: .infinity, alignment: .leading)
|
|
.padding(.horizontal, 20)
|
|
.padding(.vertical, 10)
|
|
.background(.bar)
|
|
}
|
|
}
|