Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Nextcloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,6 @@
F78026102E9CFA3700B63436 /* NCTransfersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F780260F2E9CF9DE00B63436 /* NCTransfersView.swift */; };
F78026122E9CFA6300B63436 /* NCTransfersModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F78026112E9CFA6000B63436 /* NCTransfersModel.swift */; };
F7802B322BD5584F00D74270 /* NCMedia+DragDrop.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7802B312BD5584F00D74270 /* NCMedia+DragDrop.swift */; };
F7814E962F3B5F170074DA3A /* NCSVGRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7814E952F3B5F170074DA3A /* NCSVGRenderer.swift */; };
F7814E972F3B5F170074DA3A /* NCSVGRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7814E952F3B5F170074DA3A /* NCSVGRenderer.swift */; };
F7816EF22C2C3E1F00A52517 /* NCPushNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7816EF12C2C3E1F00A52517 /* NCPushNotification.swift */; };
F7817CF829801A3500FFBC65 /* Data+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7817CF729801A3500FFBC65 /* Data+Extension.swift */; };
Expand Down Expand Up @@ -4243,7 +4242,6 @@
F799DF832C4B7DCC003410B5 /* NCSectionFooter.swift in Sources */,
AF22B218277D196700DAB0CC /* NCShareExtension+Files.swift in Sources */,
F799DF862C4B7E56003410B5 /* NCSectionHeader.swift in Sources */,
F7814E962F3B5F170074DA3A /* NCSVGRenderer.swift in Sources */,
F702F2D025EE5B5C008F8E80 /* NCGlobal.swift in Sources */,
F72437802C10B92400C7C68D /* NCSharePermissions.swift in Sources */,
F7EDE4DB262D7BA200414FE6 /* NCCellProtocol.swift in Sources */,
Expand Down Expand Up @@ -5749,7 +5747,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = NKUJUXUJ3B;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand Down Expand Up @@ -5815,7 +5813,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = NKUJUXUJ3B;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down
36 changes: 20 additions & 16 deletions Widget/Dashboard/DashboardData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,22 @@ struct DashboardData: Identifiable, Hashable {
let subTitle: String
let link: URL
let icon: UIImage
let avatar: Bool
let circle: Bool
let imageSystem: Bool
let imageColor: UIColor?
}

let dashboardDatasTest: [DashboardData] = [
.init(id: 0, title: "title0", subTitle: "subTitle-description0", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(systemName: "circle.fill")!, avatar: false, imageColor: nil),
.init(id: 1, title: "title1", subTitle: "subTitle-description1", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(systemName: "circle.fill")!, avatar: false, imageColor: nil),
.init(id: 2, title: "title2", subTitle: "subTitle-description2", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(systemName: "circle.fill")!, avatar: false, imageColor: nil),
.init(id: 3, title: "title3", subTitle: "subTitle-description3", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(systemName: "circle.fill")!, avatar: false, imageColor: nil),
.init(id: 4, title: "title4", subTitle: "subTitle-description4", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(systemName: "circle.fill")!, avatar: false, imageColor: nil),
.init(id: 5, title: "title5", subTitle: "subTitle-description5", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(systemName: "circle.fill")!, avatar: false, imageColor: nil),
.init(id: 6, title: "title6", subTitle: "subTitle-description6", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(systemName: "circle.fill")!, avatar: false, imageColor: nil),
.init(id: 7, title: "title7", subTitle: "subTitle-description7", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(systemName: "circle.fill")!, avatar: false, imageColor: nil),
.init(id: 8, title: "title8", subTitle: "subTitle-description8", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(systemName: "circle.fill")!, avatar: false, imageColor: nil),
.init(id: 9, title: "title9", subTitle: "subTitle-description9", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(systemName: "circle.fill")!, avatar: false, imageColor: nil)
.init(id: 0, title: "title0", subTitle: "subTitle-description0", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(systemName: "document")!, circle: false, imageSystem: true, imageColor: nil),
.init(id: 1, title: "title1", subTitle: "subTitle-description1", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(systemName: "document")!, circle: false, imageSystem: true, imageColor: nil),
.init(id: 2, title: "title2", subTitle: "subTitle-description2", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(systemName: "document")!, circle: true, imageSystem: false, imageColor: nil),
.init(id: 3, title: "title3", subTitle: "subTitle-description3", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(systemName: "document")!, circle: false, imageSystem: false, imageColor: nil),
.init(id: 4, title: "title4", subTitle: "subTitle-description4", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(systemName: "circle.fill")!, circle: false, imageSystem: false, imageColor: nil),
.init(id: 5, title: "title5", subTitle: "subTitle-description5", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(systemName: "circle.fill")!, circle: false, imageSystem: false, imageColor: nil),
.init(id: 6, title: "title6", subTitle: "subTitle-description6", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(systemName: "circle.fill")!, circle: false, imageSystem: false, imageColor: nil),
.init(id: 7, title: "title7", subTitle: "subTitle-description7", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(systemName: "circle.fill")!, circle: false, imageSystem: false, imageColor: nil),
.init(id: 8, title: "title8", subTitle: "subTitle-description8", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(systemName: "circle.fill")!, circle: false, imageSystem: false, imageColor: nil),
.init(id: 9, title: "title9", subTitle: "subTitle-description9", link: URL(string: "https://nextcloud.com/")!, icon: UIImage(systemName: "circle.fill")!, circle: false, imageSystem: false, imageColor: nil)
]

func getDashboardItems(displaySize: CGSize, withButton: Bool) -> Int {
Expand Down Expand Up @@ -140,10 +141,10 @@ func getDashboardDataEntry(configuration: DashboardIntent?, isPreview: Bool, dis
let url = URL(string: entryLink) {
link = url
}
var iconImage = UIImage(systemName: "circle.fill") ?? UIImage()

var imageAvatar: Bool = false
var iconImage = UIImage(systemName: "document") ?? UIImage()
var imageCircle: Bool = false
var imageColorized: Bool = false
var imageSystem: Bool = false
var imageColor: UIColor?

if let iconUrl = item.iconUrl, let url = URL(string: iconUrl) {
Expand All @@ -152,7 +153,7 @@ func getDashboardDataEntry(configuration: DashboardIntent?, isPreview: Bool, dis
let pathComponents = path.components(separatedBy: "/")

if pathComponents.contains("avatar") {
imageAvatar = true
imageCircle = true
} else if pathComponents.contains("getCalendarDotSvg") {
imageColorized = true
}
Expand All @@ -162,12 +163,15 @@ func getDashboardDataEntry(configuration: DashboardIntent?, isPreview: Bool, dis
let path = (urlComponents.path as NSString)
let colorString = ((path.lastPathComponent) as NSString).deletingPathExtension
imageColor = UIColor(hex: colorString)
iconImage = UIImage(systemName: "circle.fill") ?? UIImage()
} else {
let results = await NextcloudKit.shared.downloadPreviewAsync(url: url, account: activeTableAccount.account)
if results.error == .success,
let data = results.responseData?.data {
if let image = UIImage(data: data) {
iconImage = image
} else {
imageSystem = true
}
/* NO MEMORY
else if let image = try? await NCSVGRenderer().renderSVGToUIImage(svgData: data) {
Expand All @@ -178,7 +182,7 @@ func getDashboardDataEntry(configuration: DashboardIntent?, isPreview: Bool, dis
}
}

let data = DashboardData(id: counter, title: title, subTitle: subtitle, link: link, icon: iconImage, avatar: imageAvatar, imageColor: imageColor)
let data = DashboardData(id: counter, title: title, subTitle: subtitle, link: link, icon: iconImage, circle: imageCircle, imageSystem: imageSystem, imageColor: imageColor)
datas.append(data)

if datas.count == dashboardItems { break }
Expand Down
15 changes: 11 additions & 4 deletions Widget/Dashboard/DashboardWidgetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,17 @@ struct DashboardWidgetView: View {
Image(uiImage: element.icon)
.renderingMode(.template)
.resizable()
.frame(width: 20, height: 20)
.frame(width: 35, height: 35)
.foregroundColor(Color(color))
.scaleEffect(0.8)
} else if element.imageSystem {
Image(uiImage: element.icon)
.resizable()
.scaledToFit()
.frame(width: 35, height: 35)
.scaleEffect(0.8)
} else {
if entry.dashboard?.itemIconsRound ?? false || element.avatar {
if entry.dashboard?.itemIconsRound ?? false || element.circle {
Image(uiImage: element.icon)
.resizable()
.scaledToFill()
Expand Down Expand Up @@ -137,7 +144,7 @@ struct DashboardWidgetView: View {
.foregroundColor(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.getElement(account: entry.account)))
}
.padding(.horizontal, 15.0)
.frame(maxWidth: geo.size.width, maxHeight: geo.size.height - 2, alignment: .bottomTrailing)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottom)
}
}
.containerBackground(.background, for: .widget)
Expand All @@ -149,7 +156,7 @@ struct DashboardWidget_Previews: PreviewProvider {
let datas = Array(dashboardDatasTest[0...4])
let title = "Dashboard"
let titleImage = UIImage(systemName: "circle.fill")!
let entry = DashboardDataEntry(date: Date(), datas: datas, dashboard: nil, buttons: nil, isPlaceholder: false, isEmpty: true, titleImage: titleImage, title: title, footerImage: "checkmark.icloud", footerText: NCBrandOptions.shared.brand + " widget", account: "")
let entry = DashboardDataEntry(date: Date(), datas: datas, dashboard: nil, buttons: nil, isPlaceholder: false, isEmpty: false, titleImage: titleImage, title: title, footerImage: "checkmark.icloud", footerText: NCBrandOptions.shared.brand + " widget", account: "")
DashboardWidgetView(entry: entry).previewContext(WidgetPreviewContext(family: .systemLarge))
}
}
3 changes: 1 addition & 2 deletions Widget/Files/FilesData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,8 @@ func getFilesDataEntry(configuration: AccountIntent?, isPreview: Bool, displaySi
// URL: nextcloud://open-file?path=Talk/IMG_0000123.jpg&user=marinofaggiana&link=https://cloud.nextcloud.com/f/123
guard var path = utilityFileSystem.getPath(path: file.path, user: file.user, fileName: file.fileName).urlEncoded else { continue }
if path.first == "/" { path = String(path.dropFirst())}
guard let user = file.user.urlEncoded else { continue }
let link = file.urlBase + "/f/" + file.fileId
let urlString = "nextcloud://open-file?path=\(path)&user=\(user)&link=\(link)"
let urlString = "nextcloud://open-file?path=\(path)&user=\(file.userId)&link=\(link)&account=\(file.account)"
guard let url = URL(string: urlString) else { continue }

// IMAGE
Expand Down
2 changes: 1 addition & 1 deletion Widget/Files/FilesWidgetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ struct FilesWidgetView: View {
.lineLimit(1)
.foregroundColor(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.getElement(account: entry.account)))
}
.frame(maxWidth: geo.size.width, maxHeight: geo.size.height, alignment: .bottomTrailing)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottom)
}
}
.containerBackground(.background, for: .widget)
Expand Down
11 changes: 4 additions & 7 deletions Widget/Lockscreen/LockscreenWidgetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import SwiftUI
import WidgetKit

struct LockscreenWidgetView: View {

let entry: LockscreenData
@Environment(\.widgetFamily) private var family

Expand All @@ -23,7 +22,7 @@ struct LockscreenWidgetView: View {
}
)
.gaugeStyle(.accessoryCircularCapacity)
.widgetBackground(Color.clear)
.containerBackground(.clear, for: .widget)
} else {
Gauge(
value: entry.quotaRelative,
Expand All @@ -37,21 +36,19 @@ struct LockscreenWidgetView: View {
)
.gaugeStyle(.accessoryCircular)
.redacted(reason: entry.isPlaceholder ? .placeholder : [])
.widgetBackground(Color.clear)
.containerBackground(.clear, for: .widget)
}
case .accessoryRectangular:
VStack(alignment: .leading, spacing: 1) {
HStack(spacing: 1) {
Image("activity")
Image(systemName: "bolt.fill")
.renderingMode(.template)
.resizable()
.scaledToFill()
.foregroundColor(Color(NCBrandColor.shared.textColor2))
.frame(width: 11, height: 11)
Text(NSLocalizedString("_recent_activity_", comment: ""))
.font(.system(size: 11))
.fontWeight(.heavy)
.foregroundColor(Color(NCBrandColor.shared.textColor2))
}
if entry.error {
VStack(spacing: 1) {
Expand All @@ -66,7 +63,7 @@ struct LockscreenWidgetView: View {
}
.widgetURL(entry.link)
.redacted(reason: entry.isPlaceholder ? .placeholder : [])
.widgetBackground(Color.clear)
.containerBackground(.clear, for: .widget)
default:
Text("Not implemented")
}
Expand Down
2 changes: 1 addition & 1 deletion Widget/Toolbar/ToolbarWidgetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ struct ToolbarWidgetView: View {
.padding(.trailing, 13.0)
.foregroundColor(entry.isPlaceholder ? Color(.systemGray4) : Color(NCBrandColor.shared.getElement(account: entry.account)))
}
.frame(maxWidth: geo.size.width - 5, maxHeight: geo.size.height - 2, alignment: .bottomTrailing)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottom)
}
}
}
Expand Down
21 changes: 6 additions & 15 deletions iOSClient/Files/NCFiles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import SwiftUI

class NCFiles: NCCollectionViewCommon {
internal var fileNameBlink: String?
internal var fileNameOpen: String?

internal var lastOffsetY: CGFloat = 0
internal var lastScrollTime: TimeInterval = 0
internal var accumulatedScrollDown: CGFloat = 0
Expand Down Expand Up @@ -110,10 +108,8 @@ class NCFiles: NCCollectionViewCommon {
super.viewDidAppear(animated)

if !self.dataSource.isEmpty() {
self.blinkCell(fileName: self.fileNameBlink)
self.openFile(fileName: self.fileNameOpen)
self.fileNameBlink = nil
self.fileNameOpen = nil
blinkCell(fileName: self.fileNameBlink)
fileNameBlink = nil
}

Task {
Expand All @@ -140,7 +136,6 @@ class NCFiles: NCCollectionViewCommon {
super.viewDidDisappear(animated)

fileNameBlink = nil
fileNameOpen = nil
}

// MARK: - DataSource
Expand Down Expand Up @@ -380,15 +375,11 @@ class NCFiles: NCCollectionViewCommon {
}
}

func openFile(fileName: String?) {
if let fileName = fileName, let metadata = database.getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileName == %@", session.account, self.serverUrl, fileName)) {
let indexPath = self.dataSource.getIndexPathMetadata(ocId: metadata.ocId)
if let indexPath = indexPath {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
self.collectionView(self.collectionView, didSelectItemAt: indexPath)
}
}
func open(metadata: tableMetadata?) async {
guard let metadata else {
return
}
await didSelectMetadata(metadata, withOcIds: false)
}

// MARK: - NCAccountSettingsModelDelegate
Expand Down
Loading
Loading