Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Added video download option when long press on youtube links

  • Loading branch information
mahmoud-adam85 authored and Tim Palade committed Mar 27, 2018
1 parent 335c160 commit 370631a1dc8f8648fe6170e06d62d7774e0917f7
@@ -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)

0 comments on commit 370631a

Please sign in to comment.