Skip to content

Commit

Permalink
ASICS container fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
martenrebane committed Apr 14, 2022
1 parent e893bf5 commit dbbfe6f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions MoppApp/MoppApp/ContainerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -443,14 +443,23 @@ extension ContainerViewController : UITableViewDataSource {
let isStatePreviewOrOpened = state == .opened || state == .preview
let isEncryptedDataFiles = !isAsicContainer && isStatePreviewOrOpened && !isDecrypted

guard let dataFile = containerViewDelegate.getDataFileDisplayName(index: indexPath.row) else {
var dataFile = ""
var tapGesture: UITapGestureRecognizer

if isAsicsContainer() && !asicsDataFiles.isEmpty && asicsDataFiles.count >= indexPath.row {
dataFile = asicsDataFiles[indexPath.row].fileName ?? ""
tapGesture = getPreviewTapGesture(dataFile: dataFile, containerPath: asicsNestedContainerPath, isShareButtonNeeded: isDecrypted)
} else {
dataFile = containerViewDelegate.getDataFileDisplayName(index: indexPath.row) ?? ""
tapGesture = getPreviewTapGesture(dataFile: dataFile, containerPath: containerViewDelegate.getContainerPath(), isShareButtonNeeded: isDecrypted)
}

if dataFile.isEmpty {
printLog("Data file not found")
self.errorAlert(message: L(.datafilePreviewFailed))
return cell
}

let tapGesture = getPreviewTapGesture(dataFile: dataFile, containerPath: containerViewDelegate.getContainerPath(), isShareButtonNeeded: isDecrypted)

if !isEncryptedDataFiles {
cell.openPreviewView.addGestureRecognizer(tapGesture)
cell.openPreviewView.isHidden = false
Expand Down

0 comments on commit dbbfe6f

Please sign in to comment.