Skip to content

Commit

Permalink
👽 Disable file sharing until file provider issue is resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
stoeffn committed Apr 18, 2018
1 parent 2179d7e commit 929e79f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
15 changes: 4 additions & 11 deletions StudApp/Courses/CourseController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -307,21 +307,14 @@ final class CourseController: UITableViewController, Routable {

override func tableView(_: UITableView, canPerformAction action: Selector, forRowAt indexPath: IndexPath,
withSender _: Any?) -> Bool {
guard indexPath.row < fileListViewModel.numberOfRows else { return false }
let file = fileListViewModel[rowAt: indexPath.row]

switch Sections(rawValue: indexPath.section) {
case .info?, .announcements?, .summary?:
return action == #selector(copy(_:))
case .documents?:
guard indexPath.row < fileListViewModel.numberOfRows else { return false }
let file = fileListViewModel[rowAt: indexPath.row]

switch action {
case #selector(CustomMenuItems.share(_:)):
return true
case #selector(CustomMenuItems.remove(_:)):
return file.state.isDownloaded
default:
return false
}
return action == #selector(CustomMenuItems.remove(_:)) && file.state.isDownloaded
case .events?, nil:
return false
}
Expand Down
8 changes: 4 additions & 4 deletions StudApp/Documents/FolderController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ final class FolderController: UITableViewController, Routable {
refreshControl?.addTarget(self, action: #selector(refreshControlTriggered(_:)), for: .valueChanged)

navigationItem.title = viewModel.container.title
navigationItem.rightBarButtonItem = nil

if #available(iOS 11.0, *) {
tableView.dragDelegate = self
Expand Down Expand Up @@ -141,12 +142,11 @@ final class FolderController: UITableViewController, Routable {

override func tableView(_: UITableView, canPerformAction action: Selector, forRowAt indexPath: IndexPath,
withSender _: Any?) -> Bool {
guard indexPath.row < viewModel.numberOfRows else { return false }
let file = viewModel[rowAt: indexPath.row]

switch action {
case #selector(CustomMenuItems.share(_:)):
return true
case #selector(CustomMenuItems.remove(_:)):
guard indexPath.row < viewModel.numberOfRows else { return false }
let file = viewModel[rowAt: indexPath.row]
return file.state.isDownloaded
default:
return false
Expand Down

0 comments on commit 929e79f

Please sign in to comment.