Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue with opening torrent/magnet links with Fetch in iOS 12 #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions Fetch/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,43 @@ class AppDelegate: UIResponder, UIApplicationDelegate, PutioDelegate {
}

}

// MARK: - Support IOS 10+ open function

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {


if Putio.accessToken != nil {

let sb: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let sb2: UIStoryboard = UIStoryboard(name: "Transfers", bundle: nil)

// Setup the root view controller
let rvc: UITabBarController = sb.instantiateInitialViewController() as! UITabBarController

// Set the selected tab to transfers
rvc.selectedIndex = 2
self.window?.rootViewController = rvc

// Setup add files to be vc
let vc: UINavigationController = sb2.instantiateViewController(withIdentifier: "addFiles") as! UINavigationController
let childView: AddFilesViewController = vc.viewControllers[0] as! AddFilesViewController

// Move the url reference to the controller
childView.magnetLink = url.absoluteString

// Present

DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: {
self.window?.rootViewController?.present(vc, animated: true, completion: nil)
})

return true

}

return false
}


// MARK: - Add New Files
Expand Down