Skip to content

Commit

Permalink
Fixed line wrapping of alert updates
Browse files Browse the repository at this point in the history
Related to #9 and #14
  • Loading branch information
sman591 committed May 25, 2015
1 parent a25cdd9 commit 7af5aa1
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions CSH Drink/ItemTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,21 +124,24 @@ class ItemTableViewController: UITableViewController {
}

func drop(item: Item, delay: Int, completion: (() -> (Void))? = nil, failure: (() -> (Void))? = nil) {
var droppingView = DrinkAlertView().show(self.view.window!.rootViewController!, title: "Dropping...", text: "In \(delay) seconds...", buttonText: "Ignore")
let alertView = DrinkAlertView()
let droppingView = alertView.show(self.view.window!.rootViewController!, title: "Dropping...", text: "In \(delay) seconds...", buttonText: "Ignore")

if delay > 0 {
updateCountdown(droppingView.alertview, time: delay - 1) // TODO: this seems broken, could be refactored
}

DrinkAPI.dropItem(item, delay: delay,
completion: { data in
droppingView.alertview.titleLabel.text = "Dropped!"
droppingView.alertview.textView.text = "Item successfully dropped"
droppingView.alertview.buttonLabel.text = "OK"
alertView.closeAction = {
DrinkAlertView().show(self.view.window!.rootViewController!, title: "Dropped!", text: "Item successfully dropped!", buttonText: "OK")
}
alertView.closeView(true)
}, failure: { error, message in
droppingView.alertview.titleLabel.text = "Drop Failed"
droppingView.alertview.textView.text = message ?? "Your item failed to drop"
droppingView.alertview.buttonLabel.text = "OK"
alertView.closeView(true)
alertView.closeAction = {
DrinkAlertView().show(self.view.window!.rootViewController!, title: "Drop Failed", text: message ?? "Your item failed to drop", buttonText: "OK")
}
}
)
}
Expand Down

0 comments on commit 7af5aa1

Please sign in to comment.