Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Added video download option when long press on youtube links
Loading branch information
@@ -2470,6 +2470,15 @@ extension BrowserViewController: ContextMenuHelperDelegate {
}
actionSheetController.addAction (openNewPrivateTabAction)
// Cliqz: Added Action handler for the long press to download Youtube videos
if url.isYoutubeURL () {
let downloadVideoTitle = NSLocalizedString (" Download youtube video" , tableName : " Cliqz" , comment : " Context menu item for opening a link in a new tab" )
let downloadVideo = UIAlertAction (title : downloadVideoTitle, style : UIAlertActionStyle.default ) { (action : UIAlertAction) in
self .downloadVideoFromURL (dialogTitle! , sourceRect : CGRect (origin : touchPoint, size : touchSize))
}
actionSheetController.addAction (downloadVideo)
}
let copyTitle = NSLocalizedString (" Copy Link" , comment : " Context menu item for copying a link URL to the clipboard" )
let copyAction = UIAlertAction (title : copyTitle, style : .default ) { (action : UIAlertAction) -> Void in
UIPasteboard.general .url = url as URL
@@ -16,7 +16,7 @@ extension BrowserViewController {
}
}
private func downloadVideoFromURL (_ url : String , sourceRect : CGRect) {
func downloadVideoFromURL (_ url : String , sourceRect : CGRect) {
let hudMessage = NSLocalizedString (" Retrieving video information" , tableName : " Cliqz" , comment : " [VidoeDownloader] HUD message displayed while youtube downloader grabing the download URLs of the video" )
FeedbackUI.showLoadingHUD (hudMessage)
Toggle all file notes
Toggle all file annotations