1234567891011121314151617181920212223242526272829303132333435 |
- //
- // SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
- // SPDX-License-Identifier: GPL-3.0-or-later
- //
- import Foundation
- @objcMembers public class NCChatFileStatus: NSObject {
- public var fileId: String
- public var fileName: String
- public var filePath: String
- public var fileLocalPath: String?
- public var isDownloading: Bool = false
- public var canReportProgress: Bool = false
- public var downloadProgress: Float = 0
- init(fileId: String, fileName: String, filePath: String) {
- self.fileId = fileId
- self.fileName = fileName
- self.filePath = filePath
- }
- public func isStatus(for messageFileParameter: NCMessageFileParameter) -> Bool {
- return self.fileId == messageFileParameter.parameterId && self.filePath == messageFileParameter.path
- }
- public static func getStatus(from notification: Notification, for messageFileParameter: NCMessageFileParameter) -> NCChatFileStatus? {
- guard let receivedStatus = notification.userInfo?["fileStatus"] as? NCChatFileStatus,
- receivedStatus.isStatus(for: messageFileParameter)
- else { return nil }
- return receivedStatus
- }
- }
|