Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/ios.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Widget/Toolbar/ToolbarData.swift')
-rw-r--r--Widget/Toolbar/ToolbarData.swift16
1 files changed, 13 insertions, 3 deletions
diff --git a/Widget/Toolbar/ToolbarData.swift b/Widget/Toolbar/ToolbarData.swift
index 00efdb9fd..67146ea5d 100644
--- a/Widget/Toolbar/ToolbarData.swift
+++ b/Widget/Toolbar/ToolbarData.swift
@@ -26,19 +26,29 @@ import WidgetKit
struct ToolbarDataEntry: TimelineEntry {
let date: Date
let isPlaceholder: Bool
+ let userId: String
+ let url: String
let footerImage: String
let footerText: String
}
func getToolbarDataEntry(isPreview: Bool, completion: @escaping (_ entry: ToolbarDataEntry) -> Void) {
+ var userId = ""
+ var url = ""
+
+ if let account = NCManageDatabase.shared.getActiveAccount() {
+ userId = account.userId
+ url = account.urlBase
+ }
+
if isPreview {
- return completion(ToolbarDataEntry(date: Date(), isPlaceholder: true, footerImage: "checkmark.icloud", footerText: NCBrandOptions.shared.brand + " toolbar"))
+ return completion(ToolbarDataEntry(date: Date(), isPlaceholder: true, userId: userId, url: url, footerImage: "checkmark.icloud", footerText: NCBrandOptions.shared.brand + " toolbar"))
}
if NCManageDatabase.shared.getActiveAccount() == nil {
- return completion(ToolbarDataEntry(date: Date(), isPlaceholder: true, footerImage: "xmark.icloud", footerText: NSLocalizedString("_no_active_account_", value: "No account found", comment: "")))
+ return completion(ToolbarDataEntry(date: Date(), isPlaceholder: true, userId: userId, url: url, footerImage: "xmark.icloud", footerText: NSLocalizedString("_no_active_account_", value: "No account found", comment: "")))
}
- completion(ToolbarDataEntry(date: Date(), isPlaceholder: false, footerImage: "checkmark.icloud", footerText: NCBrandOptions.shared.brand + " toolbar"))
+ completion(ToolbarDataEntry(date: Date(), isPlaceholder: false, userId: userId, url: url, footerImage: "checkmark.icloud", footerText: NCBrandOptions.shared.brand + " toolbar"))
}