Skip to content

Commit

Permalink
Merge pull request #11 from Jack-Rouleau/sender-button-action
Browse files Browse the repository at this point in the history
Added the sender object to the action protocol method, if delegate me…
  • Loading branch information
younatics authored Oct 12, 2017
2 parents f12805e + 1a74a03 commit 87bf236
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion MediaBrowser/MediaBrowser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1512,6 +1512,9 @@ public class MediaBrowser: UIViewController, UIScrollViewDelegate, UIActionSheet
if let gc = gridController {
if gc.selectionMode {
self.title = NSLocalizedString("Select Photos", comment: "")
if let ab = actionButton {
self.navigationItem.rightBarButtonItem = ab
}
} else {
let photosText: String

Expand Down Expand Up @@ -2059,7 +2062,8 @@ public class MediaBrowser: UIViewController, UIScrollViewDelegate, UIActionSheet
// If they have defined a delegate method then just message them
// Let delegate handle things
if let d = delegate {
d.actionButtonPressed(at: currentPageIndex, in: self)
d.actionButtonPressed(at: currentPageIndex, in: self, sender: sender)
return
}

// Show activity view controller
Expand Down
4 changes: 2 additions & 2 deletions MediaBrowser/MediaBrowserDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public protocol MediaBrowserDelegate: class {
- Parameter photoIndex: Int
- Parameter mediaBrowser: MediaBrowser
*/
func actionButtonPressed(at photoIndex: Int, in mediaBrowser: MediaBrowser)
func actionButtonPressed(at photoIndex: Int, in mediaBrowser: MediaBrowser, sender: Any?)


/**
Expand Down Expand Up @@ -114,7 +114,7 @@ public extension MediaBrowserDelegate {

func didDisplayMedia(at index: Int, in mediaBrowser: MediaBrowser) { }

func actionButtonPressed(at photoIndex: Int, in mediaBrowser: MediaBrowser) { }
func actionButtonPressed(at photoIndex: Int, in mediaBrowser: MediaBrowser, sender: Any? = nil) { }

func isMediaSelected(at index: Int, in mediaBrowser: MediaBrowser) -> Bool { return false }

Expand Down

0 comments on commit 87bf236

Please sign in to comment.