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
|
// MARK: - Equatable
|
||||||
|
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
//
|
//
|
||||||
// Model.swift
|
// FileSystemItem.swift
|
||||||
// Browse
|
// Browse
|
||||||
//
|
//
|
||||||
// Created by Javier Cicchelli on 13/12/2022.
|
// Created by Javier Cicchelli on 13/12/2022.
|
||||||
// Copyright © 2022 Röck+Cöde. All rights reserved.
|
// Copyright © 2022 Röck+Cöde. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
protocol Model {
|
protocol FileSystemItem {
|
||||||
var id: String { get }
|
var id: String { get }
|
||||||
var name: String { get }
|
var name: String { get }
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Type aliases
|
// MARK: - Type aliases
|
||||||
|
|
||||||
typealias ModelIdentifiable = Model & Identifiable
|
typealias FileSystemIdIdentifiable = FileSystemItem & Identifiable
|
@ -22,7 +22,7 @@ struct GetItemsUseCase {
|
|||||||
id: String,
|
id: String,
|
||||||
username: String,
|
username: String,
|
||||||
password: String
|
password: String
|
||||||
) async throws -> [any ModelIdentifiable] {
|
) async throws -> [any FileSystemIdIdentifiable] {
|
||||||
let items = try await apiService.getItems(
|
let items = try await apiService.getItems(
|
||||||
id: id,
|
id: id,
|
||||||
credentials: .init(
|
credentials: .init(
|
||||||
@ -32,16 +32,19 @@ struct GetItemsUseCase {
|
|||||||
)
|
)
|
||||||
|
|
||||||
return items
|
return items
|
||||||
.compactMap { item -> any ModelIdentifiable in
|
.compactMap { item -> any FileSystemIdIdentifiable in
|
||||||
if item.isDirectory {
|
if item.isDirectory {
|
||||||
return Folder(
|
return Folder(
|
||||||
id: item.id,
|
id: item.id,
|
||||||
name: item.name
|
name: item.name
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
return File(
|
return Document(
|
||||||
id: item.id,
|
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
|
// MARK: Properties
|
||||||
|
|
||||||
let item: Model
|
let item: FileSystemItem
|
||||||
let delete: ItemIdClosure
|
let delete: ItemIdClosure
|
||||||
|
|
||||||
// MARK: Body
|
// MARK: Body
|
||||||
|
Loading…
x
Reference in New Issue
Block a user