Skip to content

Commit

Permalink
remove old media menu
Browse files Browse the repository at this point in the history
Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
  • Loading branch information
marinofaggiana committed Sep 16, 2024
1 parent 5236f49 commit 3fe6306
Showing 1 changed file with 0 additions and 110 deletions.
110 changes: 0 additions & 110 deletions iOSClient/Media/NCMedia+Command.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,116 +113,6 @@ extension NCMedia {
let layoutTitle = (layout == NCGlobal.shared.mediaLayoutRatio) ? NSLocalizedString("_media_square_", comment: "") : NSLocalizedString("_media_ratio_", comment: "")
let layoutImage = (layout == NCGlobal.shared.mediaLayoutRatio) ? utility.loadImage(named: "square.grid.3x3") : utility.loadImage(named: "rectangle.grid.3x2")

if numberOfColumns >= maxColumns {
self.attributesZoomIn = []
self.attributesZoomOut = .disabled
} else if numberOfColumns <= 1 {
self.attributesZoomIn = .disabled
self.attributesZoomOut = []
} else {
self.attributesZoomIn = []
self.attributesZoomOut = []
}

let viewFilterMenu = UIMenu(title: "", options: .displayInline, children: [
UIAction(title: NSLocalizedString("_media_viewimage_show_", comment: ""), image: utility.loadImage(named: "photo")) { _ in
self.showOnlyImages = true
self.showOnlyVideos = false
self.reloadDataSource()
},
UIAction(title: NSLocalizedString("_media_viewvideo_show_", comment: ""), image: utility.loadImage(named: "video")) { _ in
self.showOnlyImages = false
self.showOnlyVideos = true
self.reloadDataSource()
},
UIAction(title: NSLocalizedString("_media_show_all_", comment: ""), image: utility.loadImage(named: "photo.on.rectangle")) { _ in
self.showOnlyImages = false
self.showOnlyVideos = false
self.reloadDataSource()
}
])
let viewLayoutMenu = UIAction(title: layoutTitle, image: layoutImage) { _ in
if layout == NCGlobal.shared.mediaLayoutRatio {
NCManageDatabase.shared.setLayoutForView(account: self.session.account, key: NCGlobal.shared.layoutViewMedia, serverUrl: "", layout: NCGlobal.shared.mediaLayoutSquare)
self.layoutType = NCGlobal.shared.mediaLayoutSquare
} else {
NCManageDatabase.shared.setLayoutForView(account: self.session.account, key: NCGlobal.shared.layoutViewMedia, serverUrl: "", layout: NCGlobal.shared.mediaLayoutRatio)
self.layoutType = NCGlobal.shared.mediaLayoutRatio
}
self.createMenu()
self.collectionViewReloadData()
}

let viewOptionsMedia = UIMenu(title: "", options: .displayInline, children: [
UIMenu(title: NSLocalizedString("_media_view_options_", comment: ""), children: [viewFilterMenu, viewLayoutMenu]),
UIAction(title: NSLocalizedString("_select_media_folder_", comment: ""), image: utility.loadImage(named: "folder"), handler: { _ in
guard let navigationController = UIStoryboard(name: "NCSelect", bundle: nil).instantiateInitialViewController() as? UINavigationController,
let viewController = navigationController.topViewController as? NCSelect else { return }
viewController.delegate = self
viewController.typeOfCommandView = .select
viewController.type = "mediaFolder"
self.present(navigationController, animated: true)
})
])

let zoomOut = UIAction(title: NSLocalizedString("_zoom_out_", comment: ""), image: utility.loadImage(named: "minus.magnifyingglass"), attributes: self.attributesZoomOut) { _ in
UIView.animate(withDuration: 0.0, animations: {
self.numberOfColumns += 1
NCManageDatabase.shared.setLayoutForView(account: self.session.account, key: NCGlobal.shared.layoutViewMedia, serverUrl: "", columnPhoto: self.numberOfColumns)
self.createMenu()
self.collectionViewReloadData()
})
}

let zoomIn = UIAction(title: NSLocalizedString("_zoom_in_", comment: ""), image: utility.loadImage(named: "plus.magnifyingglass"), attributes: self.attributesZoomIn) { _ in
UIView.animate(withDuration: 0.0, animations: {
self.numberOfColumns -= 1
NCManageDatabase.shared.setLayoutForView(account: self.session.account, key: NCGlobal.shared.layoutViewMedia, serverUrl: "", columnPhoto: self.numberOfColumns)
self.createMenu()
self.collectionViewReloadData()
})
}

let playFile = UIAction(title: NSLocalizedString("_play_from_files_", comment: ""), image: utility.loadImage(named: "play.circle")) { _ in
guard let controller = self.tabBarController as? NCMainTabBarController else { return }
self.documentPickerViewController = NCDocumentPickerViewController(controller: controller, isViewerMedia: true, allowsMultipleSelection: false, viewController: self)
}

let playURL = UIAction(title: NSLocalizedString("_play_from_url_", comment: ""), image: utility.loadImage(named: "link")) { _ in
let alert = UIAlertController(title: NSLocalizedString("_valid_video_url_", comment: ""), message: nil, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("_cancel_", comment: ""), style: .cancel, handler: nil))
alert.addTextField(configurationHandler: { textField in
textField.placeholder = "http://myserver.com/movie.mkv"
})
alert.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: { _ in
guard let stringUrl = alert.textFields?.first?.text, !stringUrl.isEmpty, let url = URL(string: stringUrl) else { return }
let fileName = url.lastPathComponent
let metadata = self.database.createMetadata(fileName: fileName,
fileNameView: fileName,
ocId: NSUUID().uuidString,
serverUrl: "",
url: stringUrl,
contentType: "",
session: self.session,
sceneIdentifier: self.controller?.sceneIdentifier)
self.database.addMetadata(metadata)
NCViewer().view(viewController: self, metadata: metadata, metadatas: [metadata])
}))
self.present(alert, animated: true)
}

menuButton.menu = UIMenu(title: "", children: [zoomOut, zoomIn, viewOptionsMedia, playFile, playURL])
}

func createMenuNEW() {
let layoutForView = database.getLayoutForView(account: session.account, key: NCGlobal.shared.layoutViewMedia, serverUrl: "")
var layout = layoutForView?.layout ?? NCGlobal.shared.mediaLayoutRatio
/// Overwrite default value
if layout == NCGlobal.shared.layoutList { layout = NCGlobal.shared.mediaLayoutRatio }
///
let layoutTitle = (layout == NCGlobal.shared.mediaLayoutRatio) ? NSLocalizedString("_media_square_", comment: "") : NSLocalizedString("_media_ratio_", comment: "")
let layoutImage = (layout == NCGlobal.shared.mediaLayoutRatio) ? utility.loadImage(named: "square.grid.3x3") : utility.loadImage(named: "rectangle.grid.3x2")

let viewFilterMenu = UIMenu(title: "", options: .displayInline, children: [
UIAction(title: NSLocalizedString("_media_viewimage_show_", comment: ""), image: utility.loadImage(named: "photo")) { _ in
self.showOnlyImages = true
Expand Down

0 comments on commit 3fe6306

Please sign in to comment.