Add Quick Look Preview and Thumbnail extensions for .casera files
- Add CaseraQLPreview extension to show custom preview with contractor details and import instructions when viewing .casera files - Add CaseraQLThumbnail extension to display teal icon in Messages and Files app instead of generic white box - Update UTExportedTypeDeclarations to conform to public.content for better system file type recognition 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
38
iosApp/CaseraQLThumbnail/Info.plist
Normal file
38
iosApp/CaseraQLThumbnail/Info.plist
Normal file
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Casera Thumbnail</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>NSExtension</key>
|
||||
<dict>
|
||||
<key>NSExtensionAttributes</key>
|
||||
<dict>
|
||||
<key>QLSupportedContentTypes</key>
|
||||
<array>
|
||||
<string>com.casera.contractor</string>
|
||||
</array>
|
||||
<key>QLThumbnailMinimumDimension</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>NSExtensionPrincipalClass</key>
|
||||
<string>$(PRODUCT_MODULE_NAME).ThumbnailProvider</string>
|
||||
<key>NSExtensionPointIdentifier</key>
|
||||
<string>com.apple.quicklook.thumbnail</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
38
iosApp/CaseraQLThumbnail/ThumbnailProvider.swift
Normal file
38
iosApp/CaseraQLThumbnail/ThumbnailProvider.swift
Normal file
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// ThumbnailProvider.swift
|
||||
// CaseraQLThumbnail
|
||||
//
|
||||
// Created by Trey Tartt on 12/6/25.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import QuickLookThumbnailing
|
||||
|
||||
class ThumbnailProvider: QLThumbnailProvider {
|
||||
|
||||
override func provideThumbnail(for request: QLFileThumbnailRequest, _ handler: @escaping (QLThumbnailReply?, Error?) -> Void) {
|
||||
|
||||
let thumbnailSize = request.maximumSize
|
||||
|
||||
handler(QLThumbnailReply(contextSize: thumbnailSize, currentContextDrawing: { () -> Bool in
|
||||
// Draw background
|
||||
let backgroundColor = UIColor(red: 7/255, green: 160/255, blue: 195/255, alpha: 1)
|
||||
backgroundColor.setFill()
|
||||
UIRectFill(CGRect(origin: .zero, size: thumbnailSize))
|
||||
|
||||
// Draw icon
|
||||
let config = UIImage.SymbolConfiguration(pointSize: min(thumbnailSize.width, thumbnailSize.height) * 0.5, weight: .regular)
|
||||
if let icon = UIImage(systemName: "person.crop.rectangle.stack", withConfiguration: config) {
|
||||
let tintedIcon = icon.withTintColor(.white, renderingMode: .alwaysOriginal)
|
||||
let iconSize = tintedIcon.size
|
||||
let iconOrigin = CGPoint(
|
||||
x: (thumbnailSize.width - iconSize.width) / 2,
|
||||
y: (thumbnailSize.height - iconSize.height) / 2
|
||||
)
|
||||
tintedIcon.draw(at: iconOrigin)
|
||||
}
|
||||
|
||||
return true
|
||||
}), nil)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user