Skip to content

Commit 4aa7576

Browse files
committed
file preview improvements
1 parent 8822807 commit 4aa7576

File tree

1 file changed

+45
-11
lines changed

1 file changed

+45
-11
lines changed

Django Files/Views/Preview.swift

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,11 @@ struct PreviewFileInfo: View {
208208
HStack {
209209
Image(systemName: "document")
210210
.frame(width: 20, height: 20)
211+
.foregroundColor(.teal)
211212
Text("\(file.mime)")
213+
.foregroundColor(.teal)
212214
}
215+
213216
if file.password != "" {
214217
Image(systemName: "key")
215218
.frame(width: 20, height: 20)
@@ -229,6 +232,12 @@ struct PreviewFileInfo: View {
229232
Text("Max Views: \(String(file.maxv))")
230233
}
231234
}
235+
if let width = file.meta?["PILImageWidth"]?.value as? Int,
236+
let height = file.meta?["PILImageHeight"]?.value as? Int {
237+
Spacer()
238+
Text("\(width)×\(height)")
239+
.foregroundColor(.secondary)
240+
}
232241
}
233242
HStack {
234243
HStack {
@@ -252,34 +261,41 @@ struct PreviewFileInfo: View {
252261

253262
HStack {
254263
Image(systemName: "calendar")
255-
.frame(width: 20, height: 20)
264+
.frame(width: 15, height: 15)
256265
Text("\(file.formattedDate())")
257266
}
258267

259268
// Photo Information Section
260269
if let dateTime = file.exif?["DateTimeOriginal"]?.value as? String {
261270
HStack {
262271
Image(systemName: "camera")
263-
.frame(width: 20, height: 20)
272+
.frame(width: 15, height: 15)
273+
.font(.caption)
264274
Text("Captured: \(formatExifDate(dateTime))")
275+
.font(.caption)
265276
}
277+
.foregroundColor(.secondary)
266278
}
267279

268280
if let gpsArea = file.meta?["GPSArea"]?.value as? String {
269281
HStack {
270282
Image(systemName: "location")
271-
.frame(width: 20, height: 20)
283+
.frame(width: 15, height: 15)
272284
Text(gpsArea)
285+
.font(.caption)
273286
}
287+
.foregroundColor(.secondary)
274288
}
275289

276290
if let elevation = file.exif?["GPSInfo"]?.value as? [String: Any],
277291
let altitude = elevation["6"] as? Double {
278292
HStack{
279-
Image(systemName: "mountain.2")
280-
.frame(width: 20, height: 20)
293+
Image(systemName: "mountain.2.circle")
294+
.frame(width: 15, height: 15)
281295
Text(String(format: "Elevation: %.1f m", altitude))
296+
.font(.caption)
282297
}
298+
.foregroundColor(.secondary)
283299
}
284300

285301
// Camera Information Section
@@ -289,62 +305,80 @@ struct PreviewFileInfo: View {
289305
let cameraName = make.isEmpty || model.contains(make) ? model : "\(make) \(model)"
290306
HStack {
291307
Image(systemName: "camera.aperture")
292-
.frame(width: 20, height: 20)
308+
.frame(width: 15, height: 15)
293309
Text("Camera: \(cameraName)")
310+
.font(.caption)
294311
}
312+
.foregroundColor(.secondary)
295313
}
296314

297315
if let lens = file.exif?["LensModel"]?.value as? String {
298316
HStack {
299317
Image(systemName: "camera.aperture")
300-
.frame(width: 20, height: 20)
318+
.frame(width: 15, height: 15)
301319
Text("Lens: \(lens)")
320+
.font(.caption)
302321
}
322+
.foregroundColor(.secondary)
303323
}
304324

325+
305326
if let focalLength = file.exif?["FocalLength"]?.value as? Double {
306327
HStack {
307328
Image(systemName: "camera.aperture")
308-
.frame(width: 20, height: 20)
329+
.frame(width: 15, height: 15)
309330
Text(String(format: "Focal Length: %.0fmm", focalLength))
331+
.font(.caption)
310332
}
333+
.foregroundColor(.secondary)
311334
}
312335

313336
if let fNumber = file.exif?["FNumber"]?.value as? Double {
314337
HStack {
315338
Image(systemName: "camera.aperture")
316-
.frame(width: 20, height: 20)
339+
.frame(width: 15, height: 15)
317340
Text(String(format: "Aperture: 𝑓%.1f", fNumber))
341+
.font(.caption)
318342
}
343+
.foregroundColor(.secondary)
319344
}
320345

321346
if let iso = file.exif?["ISOSpeedRatings"]?.value as? Int {
322347
HStack {
323348
Image(systemName: "camera.aperture")
324349
.frame(width: 20, height: 20)
325350
Text("ISO: \(iso)")
351+
.font(.caption)
326352
}
353+
.foregroundColor(.secondary)
354+
327355
}
328356

329357
if let exposureTime = file.exif?["ExposureTime"]?.value as? String {
330358
HStack {
331359
Image(systemName: "camera.aperture")
332-
.frame(width: 20, height: 20)
360+
.frame(width: 15, height: 15)
333361
Text("Exposure: \(formatExposureTime(exposureTime))s")
362+
.font(.caption)
334363
}
364+
.foregroundColor(.secondary)
335365
}
336366

337367
if let software = file.exif?["Software"]?.value as? String {
338368
HStack {
339369
Image(systemName: "app")
340-
.frame(width: 20, height: 20)
370+
.frame(width: 15, height: 15)
341371
Text("Software: \(software)")
372+
.font(.caption)
342373
}
374+
.foregroundColor(.secondary)
343375
}
344376
}
345377

346378
if !file.info.isEmpty {
347379
Text(file.info)
380+
.font(.caption)
381+
.foregroundColor(.secondary)
348382
}
349383
}
350384
.padding(40)

0 commit comments

Comments
 (0)