Переглянути джерело

Improve

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 роки тому
батько
коміт
c4c1543d1b

+ 3 - 1
Widget/Lockscreen/LockscreenData.swift

@@ -107,8 +107,10 @@ func getLockscreenDataEntry(configuration: AccountIntent?, isPreview: Bool, fami
                         if let title = item.title {  activity = title }
                         if let itemLink = item.link, let url = URL(string: itemLink) { link = url }
                     }
+                    completion(LockscreenData(date: Date(), isPlaceholder: false, activity: activity, link: link, quotaRelative: 0, quotaUsed: "", quotaTotal: "", error: false))
+                } else {
+                    completion(LockscreenData(date: Date(), isPlaceholder: false, activity: "", link: URL(string: "https://")!, quotaRelative: 0, quotaUsed: "", quotaTotal: "", error: true))
                 }
-                completion(LockscreenData(date: Date(), isPlaceholder: false, activity: activity, link: link, quotaRelative: 0, quotaUsed: "", quotaTotal: "", error: false))
             }
         }
     }

+ 10 - 2
Widget/Lockscreen/LockscreenWidgetView.swift

@@ -66,8 +66,16 @@ struct LockscreenWidgetView: View {
                         .fontWeight(.heavy)
                         .foregroundColor(.gray)
                 }
-                Text(entry.activity)
-                    .font(.system(size: 12)).bold()
+                if entry.error {
+                    VStack(spacing: 1) {
+                        Image(systemName: "xmark.icloud")
+                            .font(.system(size: 25.0))
+                            .frame(maxWidth: .infinity, alignment: .center)
+                    }.padding(8)
+                } else {
+                    Text(entry.activity)
+                        .font(.system(size: 12)).bold()
+                }
             }
             .widgetURL(entry.link)
             .redacted(reason: entry.isPlaceholder ? .placeholder : [])