diff --git a/ios/AppWidget/AppWidgetBundle.swift b/ios/AppWidget/AppWidgetBundle.swift new file mode 100644 index 0000000..19e1f5e --- /dev/null +++ b/ios/AppWidget/AppWidgetBundle.swift @@ -0,0 +1,16 @@ +// +// AppWidgetBundle.swift +// AppWidget +// +// Created by Cloud Solutions on 15/12/2025. +// + +import WidgetKit +import SwiftUI + +@main +struct AppWidgetBundle: WidgetBundle { + var body: some Widget { + AppWidgetLiveActivity() + } +} diff --git a/ios/AppWidget/AppWidgetLiveActivity.swift b/ios/AppWidget/AppWidgetLiveActivity.swift new file mode 100644 index 0000000..1e6ff4c --- /dev/null +++ b/ios/AppWidget/AppWidgetLiveActivity.swift @@ -0,0 +1,87 @@ +// +// AppWidgetLiveActivity.swift +// AppWidget +// +// Created by Cloud Solutions on 15/12/2025. +// + +import ActivityKit +import WidgetKit +import SwiftUI +struct LiveActivitiesAppAttributes: ActivityAttributes, Identifiable { + public typealias LiveDeliveryData = ContentState // don't forget to add this line, otherwise, live activity will not display it. + + public struct ContentState: Codable, Hashable { } + + var id = UUID() +} +extension LiveActivitiesAppAttributes { + func prefixedKey(_ key: String) -> String { + return "\(id)_\(key)" + } +} + +let sharedDefault = UserDefaults(suiteName: "group.alhabib.pateientApp")! +struct AppWidgetAttributes: ActivityAttributes { + public struct ContentState: Codable, Hashable { + // Dynamic stateful properties about your activity go here! + var emoji: String + } + + // Fixed non-changing properties about your activity go here! + var name: String +} + +struct AppWidgetLiveActivity: Widget { + + var body: some WidgetConfiguration { + ActivityConfiguration(for: LiveActivitiesAppAttributes.self) { context in + // Lock screen/banner UI goes here + VStack { + Text("Hello patient") + } + .activityBackgroundTint(Color.cyan) + .activitySystemActionForegroundColor(Color.black) + + } dynamicIsland: { context in + DynamicIsland { + // Expanded UI goes here. Compose the expanded UI through + // various regions, like leading/trailing/center/bottom + DynamicIslandExpandedRegion(.leading) { + Text("Leading") + } + DynamicIslandExpandedRegion(.trailing) { + Text("Trailing") + } + + } compactLeading: { + Text("Leading") + } compactTrailing: { + Text("trailing") + } minimal: { + Text("minimal") + } + .widgetURL(URL(string: "http://www.apple.com")) + .keylineTint(Color.red) + } + } +} + + + +extension AppWidgetAttributes { + fileprivate static var preview: AppWidgetAttributes { + AppWidgetAttributes(name: "World") + } +} + +extension AppWidgetAttributes.ContentState { + fileprivate static var smiley: AppWidgetAttributes.ContentState { + AppWidgetAttributes.ContentState(emoji: "😀") + } + + fileprivate static var starEyes: AppWidgetAttributes.ContentState { + AppWidgetAttributes.ContentState(emoji: "🤩") + } +} + diff --git a/ios/AppWidgetExtension.entitlements b/ios/AppWidgetExtension.entitlements new file mode 100644 index 0000000..a1ca053 --- /dev/null +++ b/ios/AppWidgetExtension.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.application-groups + + group.alhabib.patientApp + + +