premium assets + livecard fix
This commit is contained in:
@@ -7,5 +7,7 @@
|
||||
<key>NSExtensionPointIdentifier</key>
|
||||
<string>com.apple.widgetkit-extension</string>
|
||||
</dict>
|
||||
<key>NSSupportsLiveActivities</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -12,16 +12,18 @@ class LessonData {
|
||||
var nextSubject: String
|
||||
var nextRoom: String
|
||||
|
||||
init?(JSONData data:[String: String]) {
|
||||
self.icon = data["icon"]!
|
||||
self.index = data["index"]!
|
||||
self.title = data["title"]!
|
||||
self.subtitle = data["subtitle"]!
|
||||
self.description = data["description"]!
|
||||
self.startDate = Date(timeIntervalSince1970: Double(data["startDate"]!)! / 1000)
|
||||
self.endDate = Date(timeIntervalSince1970: Double(data["endDate"]!)! / 1000)
|
||||
init?() {
|
||||
let sharedDefault = UserDefaults(suiteName: "group.filcnaplo.livecard")!
|
||||
|
||||
self.icon = sharedDefault.string(forKey: "icon")!
|
||||
self.index = sharedDefault.string(forKey: "index")!
|
||||
self.title = sharedDefault.string(forKey: "title")!
|
||||
self.subtitle = sharedDefault.string(forKey: "subtitle")!
|
||||
self.description = sharedDefault.string(forKey: "description")!
|
||||
self.startDate = Date(timeIntervalSince1970: Double(sharedDefault.string(forKey: "startDate")!)! / 1000)
|
||||
self.endDate = Date(timeIntervalSince1970: Double(sharedDefault.string(forKey: "endDate")!)! / 1000)
|
||||
date = self.startDate...self.endDate
|
||||
self.nextSubject = data["nextSubject"]!
|
||||
self.nextRoom = data["nextRoom"]!
|
||||
self.nextSubject = sharedDefault.string(forKey: "nextSubject")!
|
||||
self.nextRoom = sharedDefault.string(forKey: "nextRoom")!
|
||||
}
|
||||
}
|
||||
|
||||
10
filcnaplo/ios/livecard/livecard.entitlements
Normal file
10
filcnaplo/ios/livecard/livecard.entitlements
Normal file
@@ -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.filcnaplo.livecard</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -13,11 +13,7 @@ struct Widgets: WidgetBundle {
|
||||
|
||||
// We need to redefined live activities pipe
|
||||
struct LiveActivitiesAppAttributes: ActivityAttributes, Identifiable {
|
||||
public typealias LiveDeliveryData = ContentState
|
||||
|
||||
public struct ContentState: Codable, Hashable {
|
||||
var data: Dictionary<String, String>
|
||||
}
|
||||
public struct ContentState: Codable, Hashable { }
|
||||
|
||||
var id = UUID()
|
||||
}
|
||||
@@ -27,7 +23,7 @@ struct LiveCardWidget: Widget {
|
||||
var body: some WidgetConfiguration {
|
||||
/// Live Activity Notification
|
||||
ActivityConfiguration(for: LiveActivitiesAppAttributes.self) { context in
|
||||
let lesson = LessonData(JSONData: context.state.data)
|
||||
let lesson = LessonData()
|
||||
|
||||
HStack(alignment: .center) {
|
||||
Image(systemName: lesson!.icon)
|
||||
@@ -66,7 +62,7 @@ struct LiveCardWidget: Widget {
|
||||
}.padding(12)
|
||||
/// Dynamic Island
|
||||
} dynamicIsland: { context in
|
||||
let lesson = LessonData(JSONData: context.state.data)
|
||||
let lesson = LessonData()
|
||||
|
||||
/// Expanded
|
||||
return DynamicIsland {
|
||||
|
||||
Reference in New Issue
Block a user