Skip to content

Commit

Permalink
"Use deck" is working again
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Michotte <bmichotte@gmail.com>
  • Loading branch information
bmichotte committed Dec 28, 2016
1 parent 95f6237 commit adff6ae
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 27 deletions.
2 changes: 1 addition & 1 deletion HSTracker/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1382</string>
<string>1383</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.entertainment</string>
<key>LSMinimumSystemVersion</key>
Expand Down
46 changes: 20 additions & 26 deletions HSTracker/UIs/DeckManager/DeckManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -306,21 +306,19 @@ class DeckManager: NSWindowController {
}
}

@IBAction func useDeck(_ sender: AnyObject?) {
if (sender as? NSToolbarItem) != nil {
self.useDeck(currentDeck)
} else if let menuitem = sender as? NSMenuItem {
if let menu = menuitem.menu {
if let deckmenu = menu as? DeckContextMenu {
if deckmenu.clickedrow >= 0 {
self.useDeck(sortedFilteredDecks()[deckmenu.clickedrow])
}
}
}
@IBAction func useDeck(_ sender: Any?) {
if let _ = sender as? NSToolbarItem,
let deck = currentDeck {
useDeck(deck: deck)
} else if let menuitem = sender as? NSMenuItem,
let menu = menuitem.menu,
let deckmenu = menu as? DeckContextMenu,
deckmenu.clickedrow >= 0 {
useDeck(deck: sortedFilteredDecks()[deckmenu.clickedrow])
}
}
private func useDeck(_ deck: Deck) {

private func useDeck(deck: Deck) {
if !deck.isActive {
do {
let realm = try Realm()
Expand All @@ -338,21 +336,17 @@ class DeckManager: NSWindowController {
}

@IBAction func deleteDeck(_ sender: AnyObject?) {
if (sender as? NSToolbarItem) != nil {
if let deck = currentDeck {
deleteDeck(deck)
}
} else if let menuitem = sender as? NSMenuItem {
if let menu = menuitem.menu {
if let deckmenu = menu as? DeckContextMenu {
if deckmenu.clickedrow >= 0 {
deleteDeck(sortedFilteredDecks()[deckmenu.clickedrow])
}
}
}
if let _ = sender as? NSToolbarItem,
let deck = currentDeck {
deleteDeck(deck)
} else if let menuitem = sender as? NSMenuItem,
let menu = menuitem.menu,
let deckmenu = menu as? DeckContextMenu,
deckmenu.clickedrow >= 0 {
deleteDeck(sortedFilteredDecks()[deckmenu.clickedrow])
}
}

private func deleteDeck(_ deck: Deck) {
let message = String(format: NSLocalizedString("Are you sure you want to delete "
+ "the deck %@ ?", comment: ""), deck.name)
Expand Down
3 changes: 3 additions & 0 deletions versions.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ Starting from this version, HSTracker is signed with my Apple developper account
## New:
- Add a jade counter

## Fixes:
- The "Use deck" in the deck manager is working again

# 0.18.5
## Fixes:
- HSTracker now correctly save the opponent deck on game end
Expand Down

0 comments on commit adff6ae

Please sign in to comment.