1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- import WidgetKit
- import SwiftUI
- struct FilesWidgetProvider: TimelineProvider {
- typealias Entry = FilesDataEntry
- func placeholder(in context: Context) -> Entry {
- let filesItems = getFilesItems(displaySize: context.displaySize)
- let datasPlaceholder = Array(filesDatasTest[0...filesItems - 1])
- let title = getTitleFilesWidget()
- return Entry(date: Date(), datas: datasPlaceholder, isPlaceholder: true, tile: title, footerImage: "checkmark.icloud", footerText: NCBrandOptions.shared.brand + " files")
- }
- func getSnapshot(in context: Context, completion: @escaping (Entry) -> Void) {
- getFilesDataEntry(isPreview: false, displaySize: context.displaySize) { entry in
- completion(entry)
- }
- }
- func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> Void) {
- getFilesDataEntry(isPreview: context.isPreview, displaySize: context.displaySize) { entry in
- let timeLine = Timeline(entries: [entry], policy: .atEnd)
- completion(timeLine)
- }
- }
- }
|