19 lines
642 B
Swift
19 lines
642 B
Swift
import Foundation
|
|
|
|
/// A file attached to a Bitable attachment field (e.g. 相关截图).
|
|
struct BugAttachment: Equatable, Hashable {
|
|
let fileToken: String
|
|
let name: String
|
|
let size: Int
|
|
let mimeType: String?
|
|
/// Record the attachment belongs to — required to build the `extra`
|
|
/// auth parameter when downloading from permissioned Bitables.
|
|
let recordId: String
|
|
|
|
var isImage: Bool {
|
|
if let mimeType, mimeType.hasPrefix("image/") { return true }
|
|
let ext = (name as NSString).pathExtension.lowercased()
|
|
return ["png", "jpg", "jpeg", "gif", "webp", "bmp", "heic"].contains(ext)
|
|
}
|
|
}
|