diff --git a/Classes/Repository/RepositoryViewController.swift b/Classes/Repository/RepositoryViewController.swift index c2132482b..4f82d81ff 100644 --- a/Classes/Repository/RepositoryViewController.swift +++ b/Classes/Repository/RepositoryViewController.swift @@ -159,6 +159,20 @@ ContextMenuDelegate { .newIssue(issueController: newIssueViewController) } + func workingCopyAction() -> UIAlertAction? { + guard let remote = self.repoUrl.absoluteString.addingPercentEncoding(withAllowedCharacters: CharacterSet.alphanumerics) else { return nil} + + guard let url = URL(string: "working-copy://show?remote=\(remote)") else { return nil } + guard UIApplication.shared.canOpenURL(url) else { return nil } + + let title = NSLocalizedString("Working Copy", comment: "") + let action = UIAlertAction(title: title, style: .default, + handler: { _ in + UIApplication.shared.open(url) + }) + return action + } + @objc func onMore(sender: UIButton) { let alertTitle = "\(repo.owner)/\(repo.name):\(branch)" let alert = UIAlertController.configured(title: alertTitle, preferredStyle: .actionSheet) @@ -173,6 +187,7 @@ ContextMenuDelegate { $0.popoverPresentationController?.setSourceView(sender) }, switchBranchAction, + workingCopyAction(), AlertAction.cancel() ]) alert.popoverPresentationController?.setSourceView(sender) diff --git a/Resources/Info.plist b/Resources/Info.plist index 249ff7d5b..3903f9daf 100644 --- a/Resources/Info.plist +++ b/Resources/Info.plist @@ -52,6 +52,7 @@ LSApplicationQueriesSchemes org-appextension-feature-password-management + working-copy LSRequiresIPhoneOS