-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from nextcloud/split-nkmodel
Split NKModel.swift
- Loading branch information
Showing
15 changed files
with
376 additions
and
304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// SPDX-FileCopyrightText: Nextcloud GmbH | ||
// SPDX-FileCopyrightText: 2019 Marino Faggiana | ||
// SPDX-FileCopyrightText: 2023 Claudio Cambra | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
import Foundation | ||
|
||
public class NKActivity: NSObject { | ||
public var app = "" | ||
public var date = Date() | ||
public var idActivity: Int = 0 | ||
public var icon = "" | ||
public var link = "" | ||
public var message = "" | ||
public var messageRich: Data? | ||
public var objectId: Int = 0 | ||
public var objectName = "" | ||
public var objectType = "" | ||
public var previews: Data? | ||
public var subject = "" | ||
public var subjectRich: Data? | ||
public var type = "" | ||
public var user = "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// SPDX-FileCopyrightText: Nextcloud GmbH | ||
// SPDX-FileCopyrightText: 2019 Marino Faggiana | ||
// SPDX-FileCopyrightText: 2023 Claudio Cambra | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
import Foundation | ||
|
||
public class NKComments: NSObject { | ||
public var actorDisplayName = "" | ||
public var actorId = "" | ||
public var actorType = "" | ||
public var creationDateTime = Date() | ||
public var isUnread: Bool = false | ||
public var message = "" | ||
public var messageId = "" | ||
public var objectId = "" | ||
public var objectType = "" | ||
public var path = "" | ||
public var verb = "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// SPDX-FileCopyrightText: Nextcloud GmbH | ||
// SPDX-FileCopyrightText: 2019 Marino Faggiana | ||
// SPDX-FileCopyrightText: 2023 Claudio Cambra | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
import Foundation | ||
|
||
public class NKEditorDetailsCreators: NSObject { | ||
public var editor = "" | ||
public var ext = "" | ||
public var identifier = "" | ||
public var mimetype = "" | ||
public var name = "" | ||
public var templates: Int = 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-FileCopyrightText: Nextcloud GmbH | ||
// SPDX-FileCopyrightText: 2019 Marino Faggiana | ||
// SPDX-FileCopyrightText: 2023 Claudio Cambra | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
import Foundation | ||
|
||
public class NKEditorDetailsEditors: NSObject { | ||
public var mimetypes: [String] = [] | ||
public var name = "" | ||
public var optionalMimetypes: [String] = [] | ||
public var secure: Int = 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// SPDX-FileCopyrightText: Nextcloud GmbH | ||
// SPDX-FileCopyrightText: 2019 Marino Faggiana | ||
// SPDX-FileCopyrightText: 2023 Claudio Cambra | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
import Foundation | ||
|
||
public class NKEditorTemplates: NSObject { | ||
public var delete = "" | ||
public var ext = "" | ||
public var identifier = "" | ||
public var name = "" | ||
public var preview = "" | ||
public var type = "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// SPDX-FileCopyrightText: Nextcloud GmbH | ||
// SPDX-FileCopyrightText: 2019 Marino Faggiana | ||
// SPDX-FileCopyrightText: 2023 Claudio Cambra | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
import Foundation | ||
|
||
public class NKExternalSite: NSObject { | ||
public var icon = "" | ||
public var idExternalSite: Int = 0 | ||
public var lang = "" | ||
public var name = "" | ||
public var order: Int = 0 | ||
public var type = "" | ||
public var url = "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// SPDX-FileCopyrightText: Nextcloud GmbH | ||
// SPDX-FileCopyrightText: 2019 Marino Faggiana | ||
// SPDX-FileCopyrightText: 2023 Claudio Cambra | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
import Foundation | ||
|
||
public class NKFile: NSObject { | ||
public var account = "" | ||
public var classFile = "" | ||
public var commentsUnread: Bool = false | ||
public var contentType = "" | ||
public var checksums = "" | ||
public var creationDate: Date? | ||
public var dataFingerprint = "" | ||
public var date = Date() | ||
public var directory: Bool = false | ||
public var downloadURL = "" | ||
public var e2eEncrypted: Bool = false | ||
public var etag = "" | ||
public var favorite: Bool = false | ||
public var fileId = "" | ||
public var fileName = "" | ||
public var hasPreview: Bool = false | ||
public var iconName = "" | ||
public var mountType = "" | ||
public var name = "" | ||
public var note = "" | ||
public var ocId = "" | ||
public var ownerId = "" | ||
public var ownerDisplayName = "" | ||
public var lock = false | ||
public var lockOwner = "" | ||
public var lockOwnerEditor = "" | ||
public var lockOwnerType = 0 | ||
public var lockOwnerDisplayName = "" | ||
public var lockTime: Date? | ||
public var lockTimeOut: Date? | ||
public var path = "" | ||
public var permissions = "" | ||
public var quotaUsedBytes: Int64 = 0 | ||
public var quotaAvailableBytes: Int64 = 0 | ||
public var resourceType = "" | ||
public var richWorkspace: String? | ||
public var sharePermissionsCollaborationServices: Int = 0 | ||
public var sharePermissionsCloudMesh: [String] = [] | ||
public var shareType: [Int] = [] | ||
public var size: Int64 = 0 | ||
public var serverUrl = "" | ||
public var tags: [String] = [] | ||
public var trashbinFileName = "" | ||
public var trashbinOriginalLocation = "" | ||
public var trashbinDeletionTime = Date() | ||
public var uploadDate: Date? | ||
public var urlBase = "" | ||
public var user = "" | ||
public var userId = "" | ||
public var latitude: Double = 0 | ||
public var longitude: Double = 0 | ||
public var altitude: Double = 0 | ||
public var height: Double = 0 | ||
public var width: Double = 0 | ||
public var hidden = false | ||
/// If this is not empty, the media is a live photo. New media gets this straight from server, but old media needs to be detected as live photo (look isFlaggedAsLivePhotoByServer) | ||
public var livePhotoFile = "" | ||
/// Indicating if the file is sent as a live photo from the server, or if we should detect it as such and convert it client-side | ||
public var isFlaggedAsLivePhotoByServer = false | ||
/// | ||
public var datePhotosOriginal: Date? | ||
/// | ||
public struct ChildElement { | ||
let name: String | ||
let text: String? | ||
} | ||
public var exifPhotos = [[String: String?]]() | ||
public var placePhotos: String? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-FileCopyrightText: Nextcloud GmbH | ||
// SPDX-FileCopyrightText: 2019 Marino Faggiana | ||
// SPDX-FileCopyrightText: 2023 Claudio Cambra | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
import Foundation | ||
|
||
public class NKFileProperty: NSObject { | ||
public var classFile: String = "" | ||
public var iconName: String = "" | ||
public var name: String = "" | ||
public var ext: String = "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// SPDX-FileCopyrightText: Nextcloud GmbH | ||
// SPDX-FileCopyrightText: 2019 Marino Faggiana | ||
// SPDX-FileCopyrightText: 2023 Claudio Cambra | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
public enum NKProperties: String, CaseIterable { | ||
/// DAV | ||
case displayname = "<d:displayname />" | ||
case getlastmodified = "<d:getlastmodified />" | ||
case getetag = "<d:getetag />" | ||
case getcontenttype = "<d:getcontenttype />" | ||
case resourcetype = "<d:resourcetype />" | ||
case quotaavailablebytes = "<d:quota-available-bytes />" | ||
case quotausedbytes = "<d:quota-used-bytes />" | ||
case getcontentlength = "<d:getcontentlength />" | ||
/// owncloud.org | ||
case permissions = "<permissions xmlns=\"http://owncloud.org/ns\"/>" | ||
case id = "<id xmlns=\"http://owncloud.org/ns\"/>" | ||
case fileid = "<fileid xmlns=\"http://owncloud.org/ns\"/>" | ||
case size = "<size xmlns=\"http://owncloud.org/ns\"/>" | ||
case favorite = "<favorite xmlns=\"http://owncloud.org/ns\"/>" | ||
case sharetypes = "<share-types xmlns=\"http://owncloud.org/ns\"/>" | ||
case ownerid = "<owner-id xmlns=\"http://owncloud.org/ns\"/>" | ||
case ownerdisplayname = "<owner-display-name xmlns=\"http://owncloud.org/ns\"/>" | ||
case commentsunread = "<comments-unread xmlns=\"http://owncloud.org/ns\"/>" | ||
case checksums = "<checksums xmlns=\"http://owncloud.org/ns\"/>" | ||
case downloadURL = "<downloadURL xmlns=\"http://owncloud.org/ns\"/>" | ||
case datafingerprint = "<data-fingerprint xmlns=\"http://owncloud.org/ns\"/>" | ||
/// nextcloud.org | ||
case creationtime = "<creation_time xmlns=\"http://nextcloud.org/ns\"/>" | ||
case uploadtime = "<upload_time xmlns=\"http://nextcloud.org/ns\"/>" | ||
case isencrypted = "<is-encrypted xmlns=\"http://nextcloud.org/ns\"/>" | ||
case haspreview = "<has-preview xmlns=\"http://nextcloud.org/ns\"/>" | ||
case mounttype = "<mount-type xmlns=\"http://nextcloud.org/ns\"/>" | ||
case richworkspace = "<rich-workspace xmlns=\"http://nextcloud.org/ns\"/>" | ||
case note = "<note xmlns=\"http://nextcloud.org/ns\"/>" | ||
case lock = "<lock xmlns=\"http://nextcloud.org/ns\"/>" | ||
case lockowner = "<lock-owner xmlns=\"http://nextcloud.org/ns\"/>" | ||
case lockownereditor = "<lock-owner-editor xmlns=\"http://nextcloud.org/ns\"/>" | ||
case lockownerdisplayname = "<lock-owner-displayname xmlns=\"http://nextcloud.org/ns\"/>" | ||
case lockownertype = "<lock-owner-type xmlns=\"http://nextcloud.org/ns\"/>" | ||
case locktime = "<lock-time xmlns=\"http://nextcloud.org/ns\"/>" | ||
case locktimeout = "<lock-timeout xmlns=\"http://nextcloud.org/ns\"/>" | ||
case systemtags = "<system-tags xmlns=\"http://nextcloud.org/ns\"/>" | ||
case filemetadatasize = "<file-metadata-size xmlns=\"http://nextcloud.org/ns\"/>" | ||
case filemetadatagps = "<file-metadata-gps xmlns=\"http://nextcloud.org/ns\"/>" | ||
case metadataphotosexif = "<metadata-photos-exif xmlns=\"http://nextcloud.org/ns\"/>" | ||
case metadataphotosgps = "<metadata-photos-gps xmlns=\"http://nextcloud.org/ns\"/>" | ||
case metadataphotosoriginaldatetime = "<metadata-photos-original_date_time xmlns=\"http://nextcloud.org/ns\"/>" | ||
case metadataphotoplace = "<metadata-photos-place xmlns=\"http://nextcloud.org/ns\"/>" | ||
case metadataphotossize = "<metadata-photos-size xmlns=\"http://nextcloud.org/ns\"/>" | ||
case metadatafileslivephoto = "<metadata-files-live-photo xmlns=\"http://nextcloud.org/ns\"/>" | ||
case hidden = "<hidden xmlns=\"http://nextcloud.org/ns\"/>" | ||
/// open-collaboration-services.org | ||
case sharepermissionscollaboration = "<share-permissions xmlns=\"http://open-collaboration-services.org/ns\"/>" | ||
/// open-cloud-mesh.org | ||
case sharepermissionscloudmesh = "<share-permissions xmlns=\"http://open-cloud-mesh.org/ns\"/>" | ||
|
||
static func properties(createProperties: [NKProperties]?, removeProperties: [NKProperties] = []) -> String { | ||
var properties = allCases.map { $0.rawValue }.joined() | ||
if let createProperties { | ||
properties = "" | ||
properties = createProperties.map { $0.rawValue }.joined(separator: "") | ||
} | ||
for removeProperty in removeProperties { | ||
properties = properties.replacingOccurrences(of: removeProperty.rawValue, with: "") | ||
} | ||
return properties | ||
} | ||
|
||
static func trashProperties() -> String { | ||
let properties: [String] = [displayname.rawValue, getcontenttype.rawValue, resourcetype.rawValue, id.rawValue, fileid.rawValue, size.rawValue, haspreview.rawValue, "<trashbin-filename xmlns=\"http://nextcloud.org/ns\"/>", "<trashbin-original-location xmlns=\"http://nextcloud.org/ns\"/>", "<trashbin-deletion-time xmlns=\"http://nextcloud.org/ns\"/>"] | ||
return properties.joined() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// SPDX-FileCopyrightText: Nextcloud GmbH | ||
// SPDX-FileCopyrightText: 2019 Marino Faggiana | ||
// SPDX-FileCopyrightText: 2023 Claudio Cambra | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
import Foundation | ||
|
||
public class NKRichdocumentsTemplate: NSObject { | ||
public var delete = "" | ||
public var ext = "" | ||
public var name = "" | ||
public var preview = "" | ||
public var templateId: Int = 0 | ||
public var type = "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// SPDX-FileCopyrightText: Nextcloud GmbH | ||
// SPDX-FileCopyrightText: 2019 Marino Faggiana | ||
// SPDX-FileCopyrightText: 2023 Claudio Cambra | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
import Foundation | ||
|
||
public class NKSharee: NSObject { | ||
public var circleInfo = "" | ||
public var circleOwner = "" | ||
public var label = "" | ||
public var name = "" | ||
public var shareType: Int = 0 | ||
public var shareWith = "" | ||
public var uuid = "" | ||
public var userClearAt: Date? | ||
public var userIcon = "" | ||
public var userMessage = "" | ||
public var userStatus = "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-FileCopyrightText: Nextcloud GmbH | ||
// SPDX-FileCopyrightText: 2019 Marino Faggiana | ||
// SPDX-FileCopyrightText: 2023 Claudio Cambra | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
import Foundation | ||
|
||
public class NKTrash: NSObject { | ||
public var contentType = "" | ||
public var date = Date() | ||
public var directory: Bool = false | ||
public var fileId = "" | ||
public var fileName = "" | ||
public var filePath = "" | ||
public var hasPreview: Bool = false | ||
public var iconName = "" | ||
public var size: Int64 = 0 | ||
public var classFile = "" | ||
public var trashbinFileName = "" | ||
public var trashbinOriginalLocation = "" | ||
public var trashbinDeletionTime = Date() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// SPDX-FileCopyrightText: Nextcloud GmbH | ||
// SPDX-FileCopyrightText: 2019 Marino Faggiana | ||
// SPDX-FileCopyrightText: 2023 Claudio Cambra | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
import Foundation | ||
|
||
public class NKUserProfile: NSObject { | ||
public var address = "" | ||
public var backend = "" | ||
public var backendCapabilitiesSetDisplayName: Bool = false | ||
public var backendCapabilitiesSetPassword: Bool = false | ||
public var displayName = "" | ||
public var email = "" | ||
public var enabled: Bool = false | ||
public var groups: [String] = [] | ||
public var language = "" | ||
public var lastLogin: Int64 = 0 | ||
public var locale = "" | ||
public var organisation = "" | ||
public var phone = "" | ||
public var quota: Int64 = 0 | ||
public var quotaFree: Int64 = 0 | ||
public var quotaRelative: Double = 0 | ||
public var quotaTotal: Int64 = 0 | ||
public var quotaUsed: Int64 = 0 | ||
public var storageLocation = "" | ||
public var subadmin: [String] = [] | ||
public var twitter = "" | ||
public var userId = "" | ||
public var website = "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// SPDX-FileCopyrightText: Nextcloud GmbH | ||
// SPDX-FileCopyrightText: 2019 Marino Faggiana | ||
// SPDX-FileCopyrightText: 2023 Claudio Cambra | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
import Foundation | ||
|
||
public class NKUserStatus: NSObject { | ||
public var clearAt: Date? | ||
public var clearAtTime: String? | ||
public var clearAtType: String? | ||
public var icon: String? | ||
public var id: String? | ||
public var message: String? | ||
public var predefined: Bool = false | ||
public var status: String? | ||
public var userId: String? | ||
} |
Oops, something went wrong.