From 2ee799fbda92e0b973e0a33503f2f9350302f222 Mon Sep 17 00:00:00 2001 From: KOH Date: Sun, 28 Jun 2015 13:06:15 +0900 Subject: [PATCH 1/4] hoge --- hamada/iOS-client/My1DayApp/Base.lproj/Main.storyboard | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hamada/iOS-client/My1DayApp/Base.lproj/Main.storyboard b/hamada/iOS-client/My1DayApp/Base.lproj/Main.storyboard index 90d0cb7..05d429f 100644 --- a/hamada/iOS-client/My1DayApp/Base.lproj/Main.storyboard +++ b/hamada/iOS-client/My1DayApp/Base.lproj/Main.storyboard @@ -1,7 +1,7 @@ - + - + @@ -18,15 +18,15 @@ - - - + + + From a99213a11df727290000e836d8bda2e82f8ad83a Mon Sep 17 00:00:00 2001 From: KOH Date: Sun, 28 Jun 2015 13:07:26 +0900 Subject: [PATCH 2/4] hoge --- hamada/web-client/web/index.html | 4 ++-- hamada/web-server/log/api.log | 0 2 files changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 hamada/web-server/log/api.log diff --git a/hamada/web-client/web/index.html b/hamada/web-client/web/index.html index 2a25266..dc325a4 100644 --- a/hamada/web-client/web/index.html +++ b/hamada/web-client/web/index.html @@ -52,11 +52,11 @@

diff --git a/hamada/web-server/log/api.log b/hamada/web-server/log/api.log old mode 100644 new mode 100755 From a3e34a328187cd717f341b6b69b6f0f4d2e59bd3 Mon Sep 17 00:00:00 2001 From: KOH Date: Sun, 28 Jun 2015 13:36:40 +0900 Subject: [PATCH 3/4] hamada mission 1-1 --- hamada/iOS-client/My1DayApp/Base.lproj/Main.storyboard | 9 ++++++++- hamada/iOS-client/My1DayApp/Message.swift | 7 ++++++- hamada/iOS-client/My1DayApp/MessageTableViewCell.swift | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/hamada/iOS-client/My1DayApp/Base.lproj/Main.storyboard b/hamada/iOS-client/My1DayApp/Base.lproj/Main.storyboard index 05d429f..d38cf23 100644 --- a/hamada/iOS-client/My1DayApp/Base.lproj/Main.storyboard +++ b/hamada/iOS-client/My1DayApp/Base.lproj/Main.storyboard @@ -19,7 +19,7 @@ + diff --git a/hamada/iOS-client/My1DayApp/Message.swift b/hamada/iOS-client/My1DayApp/Message.swift index 0956954..eb90160 100644 --- a/hamada/iOS-client/My1DayApp/Message.swift +++ b/hamada/iOS-client/My1DayApp/Message.swift @@ -13,19 +13,24 @@ class Message { let body: String! let icon: UIImage? // Mission1-1. created_at 用のインスタンス変数を追加 + let date: String! + init?(dictionary: [String: AnyObject]) { // Mission1-1 Dictionary から key:created_at の値を取得 - if let identifier = dictionary["id"] as? Int, body = dictionary["body"] as? String, icon = dictionary["icon"] as? String{ + + if let identifier = dictionary["id"] as? Int, body = dictionary["body"] as? String, icon = dictionary["icon"] as? String, date = dictionary["created_at"] as? String{ self.identifier = identifier self.body = body self.icon = ImageHelper.imageWithBase64EncodedString(icon) // Mission1-1 Dictionary から取得した値を created_at 用のインスタンス変数に追加 + self.date = date } else { self.identifier = nil self.body = nil self.icon = nil // Mission1-1 インスタンス変数を nil で初期化 + self.date = nil return nil } } diff --git a/hamada/iOS-client/My1DayApp/MessageTableViewCell.swift b/hamada/iOS-client/My1DayApp/MessageTableViewCell.swift index 74692f2..43f8716 100644 --- a/hamada/iOS-client/My1DayApp/MessageTableViewCell.swift +++ b/hamada/iOS-client/My1DayApp/MessageTableViewCell.swift @@ -12,6 +12,7 @@ class MessageTableViewCell: UITableViewCell { @IBOutlet weak private var iconImageView: UIImageView! @IBOutlet weak private var messageLabel: UILabel! // Mission1-1 UILabel のインスタンス変数を追加 + @IBOutlet weak var dateLabel: UILabel! override func prepareForReuse() { self.iconImageView.image = nil @@ -23,5 +24,6 @@ class MessageTableViewCell: UITableViewCell { self.iconImageView.image = message.icon self.messageLabel.text = message.body // Mission1-1 UILabel のインスタンス変数に created_at の値を代入 + self.dateLabel.text = message.date } } From 48ec97c4ca6a1296da3fd1b5746a6516d40d9130 Mon Sep 17 00:00:00 2001 From: KOH Date: Sun, 28 Jun 2015 14:39:01 +0900 Subject: [PATCH 4/4] mission1-2 --- .../My1DayApp/Base.lproj/Main.storyboard | 43 ++++++++++++------- hamada/iOS-client/My1DayApp/Message.swift | 7 ++- .../My1DayApp/MessageTableViewCell.swift | 3 ++ .../My1DayApp/PostViewController.swift | 7 ++- 4 files changed, 43 insertions(+), 17 deletions(-) diff --git a/hamada/iOS-client/My1DayApp/Base.lproj/Main.storyboard b/hamada/iOS-client/My1DayApp/Base.lproj/Main.storyboard index d38cf23..d079ab7 100644 --- a/hamada/iOS-client/My1DayApp/Base.lproj/Main.storyboard +++ b/hamada/iOS-client/My1DayApp/Base.lproj/Main.storyboard @@ -8,29 +8,35 @@ - + - + - + + @@ -39,6 +45,7 @@ +
@@ -77,15 +84,20 @@ - - + + + + + + + + + + - - - @@ -127,6 +139,7 @@ + diff --git a/hamada/iOS-client/My1DayApp/Message.swift b/hamada/iOS-client/My1DayApp/Message.swift index eb90160..167a83b 100644 --- a/hamada/iOS-client/My1DayApp/Message.swift +++ b/hamada/iOS-client/My1DayApp/Message.swift @@ -14,23 +14,28 @@ class Message { let icon: UIImage? // Mission1-1. created_at 用のインスタンス変数を追加 let date: String! + let userName : String! init?(dictionary: [String: AnyObject]) { // Mission1-1 Dictionary から key:created_at の値を取得 - if let identifier = dictionary["id"] as? Int, body = dictionary["body"] as? String, icon = dictionary["icon"] as? String, date = dictionary["created_at"] as? String{ + if let identifier = dictionary["id"] as? Int, body = dictionary["body"] as? String, icon = dictionary["icon"] as? String, date = dictionary["created_at"] as? String, + userName = dictionary["username"] as? String + { self.identifier = identifier self.body = body self.icon = ImageHelper.imageWithBase64EncodedString(icon) // Mission1-1 Dictionary から取得した値を created_at 用のインスタンス変数に追加 self.date = date + self.userName = userName } else { self.identifier = nil self.body = nil self.icon = nil // Mission1-1 インスタンス変数を nil で初期化 self.date = nil + self.userName = nil return nil } } diff --git a/hamada/iOS-client/My1DayApp/MessageTableViewCell.swift b/hamada/iOS-client/My1DayApp/MessageTableViewCell.swift index 43f8716..162ea6a 100644 --- a/hamada/iOS-client/My1DayApp/MessageTableViewCell.swift +++ b/hamada/iOS-client/My1DayApp/MessageTableViewCell.swift @@ -14,6 +14,8 @@ class MessageTableViewCell: UITableViewCell { // Mission1-1 UILabel のインスタンス変数を追加 @IBOutlet weak var dateLabel: UILabel! + @IBOutlet weak var userNameLabel: UILabel! + override func prepareForReuse() { self.iconImageView.image = nil self.messageLabel.text = nil @@ -25,5 +27,6 @@ class MessageTableViewCell: UITableViewCell { self.messageLabel.text = message.body // Mission1-1 UILabel のインスタンス変数に created_at の値を代入 self.dateLabel.text = message.date + self.userNameLabel.text = message.userName } } diff --git a/hamada/iOS-client/My1DayApp/PostViewController.swift b/hamada/iOS-client/My1DayApp/PostViewController.swift index cebd98b..cd3928b 100644 --- a/hamada/iOS-client/My1DayApp/PostViewController.swift +++ b/hamada/iOS-client/My1DayApp/PostViewController.swift @@ -16,6 +16,10 @@ class PostViewController: UIViewController { @IBOutlet weak private var messageTextView: UITextView! weak var delegate: PostViewControllerDelagate? // Mission1-2 Storyboard から UITextField のインスタンス変数を追加 + + @IBOutlet weak var userNameView: UITextField! + + override func viewDidLoad() { super.viewDidLoad() @@ -34,9 +38,10 @@ class PostViewController: UIViewController { let message = self.messageTextView.text ?? "" // Mission1-2 UITextField のインスタンス変数から値を取得 + let userName = self.userNameView.text ?? "" // Mission1-2 posetMessage の第2引数に 任意の値を渡す - APIRequest.postMessage(message, username: "名前はまだない") { + APIRequest.postMessage(message, username:userName) { [weak self] (data, response, error) -> Void in self?.delegate?.postViewController(self!, didTouchUpCloseButton: sender)