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

Action Controller images #2135

Merged
merged 8 commits into from
Sep 24, 2018
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion Classes/Issues/IssuesViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import MessageViewController
import Squawk
import ContextMenu
import GitHubAPI
import ImageAlertAction

extension ListDiffable {
var needsSpacer: Bool {
Expand Down Expand Up @@ -267,6 +268,7 @@ final class IssuesViewController:
return action(
owner: model.owner,
repo: model.repo,
icon: #imageLiteral(resourceName: "repo"),
branch: result.defaultBranch,
issuesEnabled: result.hasIssuesEnabled,
client: client
Expand Down Expand Up @@ -368,7 +370,7 @@ final class IssuesViewController:
@objc func onNavigationTitle(sender: UIView) {
let alert = UIAlertController.configured(preferredStyle: .actionSheet)
alert.addActions([
action(owner: model.owner),
action(owner: model.owner, icon: #imageLiteral(resourceName: "organization")),
viewRepoAction(),
AlertAction.cancel()
])
Expand Down
3 changes: 2 additions & 1 deletion Classes/Notifications/NotificationSectionController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,11 @@ final class NotificationSectionController: ListSwiftSectionController<Notificati
guard let value = self.value else { return }
let alert = UIAlertController.configured(preferredStyle: .actionSheet)
alert.addActions([
viewController?.action(owner: value.owner),
viewController?.action(owner: value.owner, icon: #imageLiteral(resourceName: "organization")),
viewController?.action(
owner: value.owner,
repo: value.repo,
icon: #imageLiteral(resourceName: "repo"),
branch: value.branch,
issuesEnabled: value.issuesEnabled,
client: modelController.githubClient
Expand Down
2 changes: 1 addition & 1 deletion Classes/Repository/RepositoryViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ NewIssueTableViewControllerDelegate {
weak var weakSelf = self
alert.addActions([
AlertAction(AlertActionBuilder { $0.rootViewController = weakSelf })
.view(owner: repo.owner),
.view(owner: repo.owner, icon: #imageLiteral(resourceName: "organization")),
AlertAction.cancel()
])
alert.popoverPresentationController?.setSourceView(sender)
Expand Down
8 changes: 4 additions & 4 deletions Classes/Utility/AlertAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ struct AlertAction {
}
}

func view(client: GithubClient, repo: RepositoryDetails) -> UIAlertAction {
return UIAlertAction(title: repo.name, style: .default) { _ in
func view(client: GithubClient, repo: RepositoryDetails, icon: UIImage) -> UIAlertAction {
return UIAlertAction(title: repo.name, image: icon, style: .default) { _ in
let repoViewController = RepositoryViewController(client: client, repo: repo)
self.rootViewController?.show(repoViewController, sender: nil)
}
}

func view(owner: String) -> UIAlertAction {
return UIAlertAction(title: "@\(owner)", style: .default) { _ in
func view(owner: String, icon: UIImage) -> UIAlertAction {
return UIAlertAction(title: "@\(owner)", image: icon, style: .default) { _ in
guard let url = URL(string: "https://github.com/\(owner)") else { return }
self.rootViewController?.presentSafari(url: url)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ import UIKit

extension UIViewController {

func action(owner: String) -> UIAlertAction? {
func action(owner: String, icon: UIImage = UIImage()) -> UIAlertAction? {
weak var weakSelf = self
return AlertAction(AlertActionBuilder { $0.rootViewController = weakSelf })
.view(owner: owner)
.view(owner: owner, icon: icon)
}

func action(
owner: String,
repo: String,
icon: UIImage,
branch: String,
issuesEnabled: Bool,
client: GithubClient
Expand All @@ -31,7 +32,7 @@ extension UIViewController {
)
weak var weakSelf = self
return AlertAction(AlertActionBuilder { $0.rootViewController = weakSelf })
.view(client: client, repo: repo)
.view(client: client, repo: repo, icon: icon)
}

}
4 changes: 4 additions & 0 deletions Freetime.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2466,6 +2466,7 @@
"${BUILT_PRODUCTS_DIR}/HTMLString/HTMLString.framework",
"${BUILT_PRODUCTS_DIR}/Highlightr/Highlightr.framework",
"${BUILT_PRODUCTS_DIR}/IGListKit/IGListKit.framework",
"${BUILT_PRODUCTS_DIR}/ImageAlertAction/ImageAlertAction.framework",
"${BUILT_PRODUCTS_DIR}/MessageViewController/MessageViewController.framework",
"${BUILT_PRODUCTS_DIR}/NYTPhotoViewer/NYTPhotoViewer.framework",
"${BUILT_PRODUCTS_DIR}/Pageboy/Pageboy.framework",
Expand Down Expand Up @@ -2496,6 +2497,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/HTMLString.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Highlightr.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IGListKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ImageAlertAction.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MessageViewController.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NYTPhotoViewer.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Pageboy.framework",
Expand Down Expand Up @@ -2596,6 +2598,7 @@
"${BUILT_PRODUCTS_DIR}/HTMLString/HTMLString.framework",
"${BUILT_PRODUCTS_DIR}/Highlightr/Highlightr.framework",
"${BUILT_PRODUCTS_DIR}/IGListKit/IGListKit.framework",
"${BUILT_PRODUCTS_DIR}/ImageAlertAction/ImageAlertAction.framework",
"${BUILT_PRODUCTS_DIR}/MessageViewController/MessageViewController.framework",
"${BUILT_PRODUCTS_DIR}/NYTPhotoViewer/NYTPhotoViewer.framework",
"${BUILT_PRODUCTS_DIR}/Pageboy/Pageboy.framework",
Expand Down Expand Up @@ -2627,6 +2630,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/HTMLString.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Highlightr.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/IGListKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ImageAlertAction.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MessageViewController.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NYTPhotoViewer.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Pageboy.framework",
Expand Down
1 change: 1 addition & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def testing_pods
pod 'Fabric'
pod 'Crashlytics'
pod 'Tabman', '~> 1.8'
pod 'ImageAlertAction'
pod 'FMDB'

# prerelease pods
Expand Down
10 changes: 7 additions & 3 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ PODS:
- IGListKit/Diffing (3.3.0)
- IGListKit/Swift (3.3.0):
- IGListKit/Default
- ImageAlertAction (1.0.0)
- MessageViewController (0.2.1)
- NYTPhotoViewer (1.1.0):
- NYTPhotoViewer/AnimatedGifSupport (= 1.1.0)
Expand Down Expand Up @@ -74,6 +75,7 @@ DEPENDENCIES:
- Highlightr (from `https://github.com/GitHawkApp/Highlightr.git`, branch `master`)
- HTMLString (~> 4.0.1)
- IGListKit/Swift (from `https://github.com/Instagram/IGListKit.git`, branch `swift`)
- ImageAlertAction
- MessageViewController (from `https://github.com/GitHawkApp/MessageViewController.git`, branch `master`)
- NYTPhotoViewer (~> 1.1.0)
- SDWebImage/GIF (~> 4.0.0)
Expand All @@ -87,7 +89,7 @@ DEPENDENCIES:
- TUSafariActivity (~> 1.0.0)

SPEC REPOS:
https://github.com/cocoapods/specs.git:
https://github.com/CocoaPods/Specs.git:
- Alamofire
- AlamofireNetworkActivityIndicator
- Apollo
Expand All @@ -99,6 +101,7 @@ SPEC REPOS:
- FLEX
- FMDB
- HTMLString
- ImageAlertAction
- NYTPhotoViewer
- Pageboy
- SDWebImage
Expand Down Expand Up @@ -189,6 +192,7 @@ SPEC CHECKSUMS:
Highlightr: 70c4df19e4aa55aa1b4387fb98182abce1dec9da
HTMLString: 8d9a8a8aaf63dd52c5b8cd9a38e14da52f753210
IGListKit: 7edb98afdb8401245d8bea0b733ebd4ac5e67caf
ImageAlertAction: a32a5053978ef2cffbc96f192d4ca2a24c774dd5
MessageViewController: 63ef2719d82c91d949ad52e101f049028a5a0611
NYTPhotoViewer: e80e8767f3780d2df37c6f72cbab15d6c7232911
Pageboy: f0295ea949f0b0123a1b486fd347ea892d0078e0
Expand All @@ -202,6 +206,6 @@ SPEC CHECKSUMS:
Tabman: 69ce69b44cec1ad693b82c24cdbdf0c45915668c
TUSafariActivity: afc55a00965377939107ce4fdc7f951f62454546

PODFILE CHECKSUM: d7d1d2a1ad293a10c7c265ff7a0414b271f10c59
PODFILE CHECKSUM: 62ba9e300989cc352848de4583c67cac4da97783

COCOAPODS: 1.5.3
COCOAPODS: 1.5.0
33 changes: 33 additions & 0 deletions Pods/ContextMenu/ContextMenu/CGRect+DominantCorner.swift

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions Pods/ImageAlertAction/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

95 changes: 95 additions & 0 deletions Pods/ImageAlertAction/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading