Renamed the Model and ModelIdentifiable protocols for the Browse module as FileSystemItem and FileSystemItemIdentifiable respectively.
This commit is contained in:
parent
627698e1bf
commit
9a3b9049c7
@ -25,9 +25,9 @@ public struct Folder {
|
||||
|
||||
}
|
||||
|
||||
// MARK: - ModelIdentifiable
|
||||
// MARK: - FileSystemIdIdentifiable
|
||||
|
||||
extension Folder: ModelIdentifiable {}
|
||||
extension Folder: FileSystemIdIdentifiable {}
|
||||
|
||||
// MARK: - Equatable
|
||||
|
||||
|
@ -1,16 +1,16 @@
|
||||
//
|
||||
// Model.swift
|
||||
// FileSystemItem.swift
|
||||
// Browse
|
||||
//
|
||||
// Created by Javier Cicchelli on 13/12/2022.
|
||||
// Copyright © 2022 Röck+Cöde. All rights reserved.
|
||||
//
|
||||
|
||||
protocol Model {
|
||||
protocol FileSystemItem {
|
||||
var id: String { get }
|
||||
var name: String { get }
|
||||
}
|
||||
|
||||
// MARK: - Type aliases
|
||||
|
||||
typealias ModelIdentifiable = Model & Identifiable
|
||||
typealias FileSystemIdIdentifiable = FileSystemItem & Identifiable
|
@ -22,7 +22,7 @@ struct GetItemsUseCase {
|
||||
id: String,
|
||||
username: String,
|
||||
password: String
|
||||
) async throws -> [any ModelIdentifiable] {
|
||||
) async throws -> [any FileSystemIdIdentifiable] {
|
||||
let items = try await apiService.getItems(
|
||||
id: id,
|
||||
credentials: .init(
|
||||
@ -32,16 +32,19 @@ struct GetItemsUseCase {
|
||||
)
|
||||
|
||||
return items
|
||||
.compactMap { item -> any ModelIdentifiable in
|
||||
.compactMap { item -> any FileSystemIdIdentifiable in
|
||||
if item.isDirectory {
|
||||
return Folder(
|
||||
id: item.id,
|
||||
name: item.name
|
||||
)
|
||||
} else {
|
||||
return File(
|
||||
return Document(
|
||||
id: item.id,
|
||||
name: item.name
|
||||
name: item.name,
|
||||
contentType: item.contentType ?? "-",
|
||||
size: item.size ?? 0,
|
||||
lastModifiedAt: item.lastModifiedAt
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ struct FolderItem: View {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
let item: Model
|
||||
let item: FileSystemItem
|
||||
let delete: ItemIdClosure
|
||||
|
||||
// MARK: Body
|
||||
|
Loading…
x
Reference in New Issue
Block a user