Чат: вертикальное центрирование bubble вложений, tap-to-download аватар и мгновенный показ call-attachment
This commit is contained in:
15
RosettaLiveActivityWidget/CallActivityAttributes.swift
Normal file
15
RosettaLiveActivityWidget/CallActivityAttributes.swift
Normal file
@@ -0,0 +1,15 @@
|
||||
import ActivityKit
|
||||
import Foundation
|
||||
|
||||
struct CallActivityAttributes: ActivityAttributes {
|
||||
/// Fixed data set when the activity starts.
|
||||
let peerName: String
|
||||
let peerPublicKey: String
|
||||
|
||||
/// Dynamic state updated during the call.
|
||||
struct ContentState: Codable, Hashable {
|
||||
let durationSec: Int
|
||||
let isActive: Bool
|
||||
let isMuted: Bool
|
||||
}
|
||||
}
|
||||
37
RosettaLiveActivityWidget/CallLiveActivity.swift
Normal file
37
RosettaLiveActivityWidget/CallLiveActivity.swift
Normal file
@@ -0,0 +1,37 @@
|
||||
import ActivityKit
|
||||
import SwiftUI
|
||||
import WidgetKit
|
||||
|
||||
struct CallLiveActivity: Widget {
|
||||
var body: some WidgetConfiguration {
|
||||
ActivityConfiguration(for: CallActivityAttributes.self) { context in
|
||||
// Lock Screen
|
||||
Text("Rosetta Call: \(context.attributes.peerName)")
|
||||
.foregroundColor(.white)
|
||||
.padding()
|
||||
.activityBackgroundTint(.black)
|
||||
} dynamicIsland: { context in
|
||||
DynamicIsland {
|
||||
DynamicIslandExpandedRegion(.center) {
|
||||
Text(context.attributes.peerName)
|
||||
.foregroundColor(.white)
|
||||
}
|
||||
DynamicIslandExpandedRegion(.bottom) {
|
||||
Text("Encrypted call")
|
||||
.font(.caption2)
|
||||
.foregroundColor(.gray)
|
||||
}
|
||||
} compactLeading: {
|
||||
Image(systemName: "phone.fill")
|
||||
.foregroundColor(.green)
|
||||
} compactTrailing: {
|
||||
Text("Call")
|
||||
.font(.caption2)
|
||||
.foregroundColor(.green)
|
||||
} minimal: {
|
||||
Image(systemName: "phone.fill")
|
||||
.foregroundColor(.green)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
RosettaLiveActivityWidget/Info.plist
Normal file
27
RosettaLiveActivityWidget/Info.plist
Normal file
@@ -0,0 +1,27 @@
|
||||
<?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>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>RosettaLiveActivityWidget</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>$(MARKETING_VERSION)</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSExtension</key>
|
||||
<dict>
|
||||
<key>NSExtensionPointIdentifier</key>
|
||||
<string>com.apple.widgetkit-extension</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -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.rosetta.dev</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,10 @@
|
||||
import ActivityKit
|
||||
import SwiftUI
|
||||
import WidgetKit
|
||||
|
||||
@main
|
||||
struct RosettaLiveActivityWidgetBundle: WidgetBundle {
|
||||
var body: some Widget {
|
||||
CallLiveActivity()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user