Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
different share options in issue vc, fixes #17
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Nystrom committed Jun 29, 2017
1 parent 1de117b commit c28cff0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
26 changes: 21 additions & 5 deletions Classes/Issues/IssuesViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import UIKit
import IGListKit
import TUSafariActivity
import SafariServices

final class IssuesViewController: UIViewController, ListAdapterDataSource, FeedDelegate {

Expand Down Expand Up @@ -44,7 +45,7 @@ final class IssuesViewController: UIViewController, ListAdapterDataSource, FeedD
feed.adapter.dataSource = self

let rightItem = UIBarButtonItem(
image: UIImage(named: "bullets"),
image: UIImage(named: "bullets-hollow"),
style: .plain,
target: self,
action: #selector(IssuesViewController.onMore)
Expand All @@ -60,11 +61,26 @@ final class IssuesViewController: UIViewController, ListAdapterDataSource, FeedD
// MARK: Private API

func onMore() {
let alert = UIAlertController()

let path = "https://github.com/\(owner)/\(repo)/issues/\(number)"
let url = URL(string: path)!
let safari = TUSafariActivity()
let activity = UIActivityViewController(activityItems: [url], applicationActivities: [safari])
present(activity, animated: true)
let externalURL = URL(string: path)!

let share = UIAlertAction(title: NSLocalizedString("Share...", comment: ""), style: .default) { _ in
let safariActivity = TUSafariActivity()
let controller = UIActivityViewController(activityItems: [externalURL], applicationActivities: [safariActivity])
self.present(controller, animated: true)
}
let safari = UIAlertAction(title: NSLocalizedString("Open in Safari", comment: ""), style: .default) { _ in
let controller = SFSafariViewController(url: externalURL)
self.present(controller, animated: true)
}
let cancel = UIAlertAction(title: Strings.cancel, style: .cancel, handler: nil)
alert.addAction(share)
alert.addAction(safari)
alert.addAction(cancel)

present(alert, animated: true)
}

// MARK: ListAdapterDataSource
Expand Down
2 changes: 1 addition & 1 deletion Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleVersion</key>
<string>127</string>
<string>128</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>org-appextension-feature-password-management</string>
Expand Down

0 comments on commit c28cff0

Please sign in to comment.