Skip to content

Commit

Permalink
api modifications for multi-select feature (#621)
Browse files Browse the repository at this point in the history
#REF: #MOBILEAPPS-2041
  • Loading branch information
ankitgoyalgloballogic authored Aug 18, 2023
1 parent ab677ce commit 0085e0b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ContentApp/BusinessLayer/Lists/Models/FavoritesModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class FavoritesModel: ListComponentModelProtocol {
APIConstants.Include.allowableOperations,
APIConstants.Include.properties],
fields: nil) { (result, error) in

var listNodes: [ListNode] = []
if let entries = result?.list {
listNodes = FavoritesNodeMapper.map(entries.entries)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@ struct FavoritesNodeMapper {
static func map(_ entries: [FavoriteEntry]) -> [ListNode] {
var nodes: [ListNode] = []
for entry in entries {
let allowableOperations = entry.entry.allowableOperations ?? []
if let nodeFile = entry.entry.target.file {
nodes.append(self.create(from: nodeFile))
nodes.append(self.create(from: nodeFile, allowableOperations: allowableOperations))
} else if let nodeFolder = entry.entry.target.folder {
nodes.append(self.create(from: nodeFolder))
nodes.append(self.create(from: nodeFolder, allowableOperations: allowableOperations))
} else if let nodeSite = entry.entry.target.site {
nodes.append(self.create(from: nodeSite))
}
}
return nodes
}

private static func create(from node: FavoriteTargetNode) -> ListNode {
private static func create(from node: FavoriteTargetNode, allowableOperations: [String]) -> ListNode {
let path = node.path?.elements?.compactMap({ $0.name })
.joined(separator: " \u{203A} ") ?? ""
var mimeType = node.content?.mimeType
Expand All @@ -43,14 +44,19 @@ struct FavoritesNodeMapper {
mimeType = "cm:folder"
nodeType = NodeType.folder
}

var operations = node.allowableOperations ?? []
if operations.isEmpty {
operations = allowableOperations
}
return ListNode(guid: node._id,
mimeType: mimeType,
title: node.name,
path: path,
modifiedAt: node.modifiedAt,
nodeType: nodeType,
favorite: true,
allowableOperations: node.allowableOperations ?? [],
allowableOperations: operations,
isFile: node.isFile,
isFolder: node.isFolder)
}
Expand Down
2 changes: 1 addition & 1 deletion ContentApp/BusinessLayer/Search/Models/SearchModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ extension SearchModel: ListComponentModelProtocol {
facetIntervals: self.facetIntervals,
paginationRequest: requestPagination,
completionHandler: completionHandler)
case .live :
case .live:
self.performLiveSearch(for: string,
with: self.facetFields,
facetQueries: self.facetQueries,
Expand Down

0 comments on commit 0085e0b

Please sign in to comment.