feat: add live draw feature and clean up docs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
jjbruntonandClaude Opus 4.5 committed 2026-02-01 14:35:16 +00:00
1 parent 520d0a8444
commit 4c18afaeae
63 files changed
+6728 -12854

No files matched your search

@@ -0,0 +1,6 @@
{
"info": {
"version": 1,
"author": "xcode"
}
}
+11
View File
@@ -0,0 +1,11 @@
<?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>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.widgetkit-extension</string>
</dict>
</dict>
</plist>
@@ -0,0 +1,83 @@
import WidgetKit
import SwiftUI
struct LiveDrawEntry: TimelineEntry {
let date: Date
let image: UIImage?
}
struct LiveDrawProvider: TimelineProvider {
let suiteName = "group.com.sauci.app"
let dataKey = "LiveDrawImage"
func placeholder(in context: Context) -> LiveDrawEntry {
LiveDrawEntry(date: Date(), image: nil)
}
func getSnapshot(in context: Context, completion: @escaping (LiveDrawEntry) -> Void) {
completion(getEntry())
}
func getTimeline(in context: Context, completion: @escaping (Timeline<LiveDrawEntry>) -> Void) {
let entry = getEntry()
let nextUpdate = Calendar.current.date(byAdding: .minute, value: 30, to: Date())!
let timeline = Timeline(entries: [entry], policy: .after(nextUpdate))
completion(timeline)
}
private func getEntry() -> LiveDrawEntry {
guard let suite = UserDefaults(suiteName: suiteName),
let base64 = suite.string(forKey: dataKey),
let imageData = Data(base64Encoded: base64),
let image = UIImage(data: imageData)
else {
return LiveDrawEntry(date: Date(), image: nil)
}
return LiveDrawEntry(date: Date(), image: image)
}
}
struct LiveDrawWidgetEntryView: View {
var entry: LiveDrawProvider.Entry
var body: some View {
if let image = entry.image {
Image(uiImage: image)
.resizable()
.aspectRatio(contentMode: .fill)
.clipShape(RoundedRectangle(cornerRadius: 16))
} else {
ZStack {
Color(red: 26/255, green: 26/255, blue: 46/255)
VStack(spacing: 8) {
Image(systemName: "pencil.tip.crop.circle")
.font(.system(size: 32))
.foregroundColor(.white.opacity(0.5))
Text("Draw together")
.font(.caption)
.foregroundColor(.white.opacity(0.5))
}
}
}
}
}
struct LiveDrawWidget: Widget {
let kind: String = "LiveDrawWidget"
var body: some WidgetConfiguration {
StaticConfiguration(kind: kind, provider: LiveDrawProvider()) { entry in
if #available(iOS 17.0, *) {
LiveDrawWidgetEntryView(entry: entry)
.widgetURL(URL(string: "app.sauci://live-draw"))
.containerBackground(Color(red: 26/255, green: 26/255, blue: 46/255), for: .widget)
} else {
LiveDrawWidgetEntryView(entry: entry)
.widgetURL(URL(string: "app.sauci://live-draw"))
}
}
.configurationDisplayName("Live Draw")
.description("See your shared drawing with your partner.")
.supportedFamilies([.systemSmall, .systemMedium])
}
}
@@ -0,0 +1,12 @@
/** @type {import('@bacons/apple-targets').ConfigFunction} */
module.exports = (config) => ({
type: "widget",
name: "LiveDrawWidget",
deploymentTarget: "16.0",
entitlements: {
"com.apple.security.application-groups":
config.ios?.entitlements?.["com.apple.security.application-groups"] ?? [
"group.com.sauci.app",
],
},
});
@@ -0,0 +1,10 @@
<?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>com.apple.security.application-groups</key>
<array>
<string>group.com.sauci.app</string>
</array>
</dict>
</plist>
+9
View File
@@ -0,0 +1,9 @@
import WidgetKit
import SwiftUI
@main
struct exportWidgets: WidgetBundle {
var body: some Widget {
LiveDrawWidget()
}
}