Skip to content

Commit f830f89

Browse files
baquerchashmeetsingh
authored andcommitted
Skill Details (#529)
1 parent 401352d commit f830f89

File tree

5 files changed

+162
-61
lines changed

5 files changed

+162
-61
lines changed

Susi/Controllers/SkillDetailViewController/SkillDetailVCMethods.swift

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -103,26 +103,20 @@ extension SkillDetailViewController {
103103
skillDescription.text = skill?.skillDescription
104104
}
105105

106-
func addContentType() {
107-
view.addSubview(contentType)
108-
contentType.widthAnchor.constraint(equalToConstant: 140).isActive = true
109-
contentType.heightAnchor.constraint(equalToConstant: 35).isActive = true
110-
contentType.leftAnchor.constraint(equalTo: ratingBackView.leftAnchor).isActive = true
111-
contentType.topAnchor.constraint(equalTo: feedbackDisplayTableView.bottomAnchor, constant: 16).isActive = true
112-
113-
view.addSubview(content)
114-
content.leftAnchor.constraint(equalTo: contentType.rightAnchor, constant: -6).isActive = true
115-
content.topAnchor.constraint(equalTo: contentType.topAnchor, constant: 8).isActive = true
116-
content.widthAnchor.constraint(equalToConstant: 140).isActive = true
117-
content.heightAnchor.constraint(equalToConstant: 22).isActive = true
118-
119-
guard let contents = skill?.dynamic_content else { return }
120-
if contents {
121-
content.text = "Dynamic"
106+
func addSkillDetails() {
107+
let locale = NSLocale(localeIdentifier: (skill?.language)!)
108+
let language = locale.displayName(forKey: NSLocale.Key.identifier, value: skill?.language as Any)
109+
let updatedDate = skill?.lastModifiedTime.getFirstChar(19)
110+
categoryLabel.text = skill?.group
111+
languageLabel.text = language
112+
updatedOnLabel.text = updatedDate?.replacingOccurrences(of: "T", with: " ")
113+
let content = skill?.dynamic_content
114+
if content! {
115+
contentTypeLabel.text = "Dynamic"
122116
} else {
123-
content.text = "Static"
117+
contentTypeLabel.text = "Static"
124118
}
125-
119+
126120
}
127121

128122
@objc func reportSkillAction() {

Susi/Controllers/SkillDetailViewController/SkillDetailViewController.swift

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,6 @@ import FTPopOverMenu_Swift
1313

1414
class SkillDetailViewController: GeneralViewController {
1515

16-
let contentType: UILabel = {
17-
let label = UILabel()
18-
label.text = "Content Type:"
19-
label.font = UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium)
20-
21-
label.translatesAutoresizingMaskIntoConstraints = false
22-
return label
23-
}()
24-
25-
let content: UILabel = {
26-
let label = UILabel()
27-
label.font = UIFont.systemFont(ofSize: 18)
28-
label.textColor = UIColor.iOSGray()
29-
label.translatesAutoresizingMaskIntoConstraints = false
30-
31-
return label
32-
}()
3316

3417
lazy var skillOptionButton: IconButton = {
3518
let sb = IconButton()
@@ -114,6 +97,10 @@ class SkillDetailViewController: GeneralViewController {
11497
UIColor.oneStarRating()
11598
]
11699

100+
@IBOutlet weak var categoryLabel: UILabel!
101+
@IBOutlet weak var languageLabel: UILabel!
102+
@IBOutlet weak var updatedOnLabel: UILabel!
103+
@IBOutlet weak var contentTypeLabel: UILabel!
117104
var menuOptionsAfterLogin: [String] {
118105
return ["Share Skill","Report Skill"]
119106
}
@@ -133,7 +120,7 @@ class SkillDetailViewController: GeneralViewController {
133120
getRatingByUser()
134121
setupFiveStarData()
135122
setupBarChart()
136-
addContentType()
123+
addSkillDetails()
137124
setupFeedbackTextField()
138125
}
139126

@@ -152,7 +139,7 @@ class SkillDetailViewController: GeneralViewController {
152139
super.viewWillLayoutSubviews()
153140
// ScrollView content size
154141
let labelHeight = skillDescription.heightForLabel(text: skillDescription.text!, font: UIFont.systemFont(ofSize: 16.0), width: self.view.frame.width - 64)
155-
scrollView.contentSize = CGSize(width: self.view.frame.width, height: self.view.frame.height + 240.0 + feedbackTableHeighConstraint.constant + labelHeight)
142+
scrollView.contentSize = CGSize(width: self.view.frame.width, height: self.view.frame.height + 500.0 + feedbackTableHeighConstraint.constant + labelHeight)
156143
}
157144

158145
override func localizeStrings() {

Susi/Model/Client/Constants.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ extension Client {
187187
static let skillRating = "skill_rating"
188188
static let accessToken = "access_token"
189189
static let feedback = "feedback"
190+
static let lastModifiedTime = "lastModifiedTime"
190191
}
191192

192193
struct FiveStarRating {

Susi/Model/Skill.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class Skill: NSObject {
4545
var model: String = ""
4646
var group: String = ""
4747
var language: String = ""
48+
var lastModifiedTime: String = ""
4849

4950

5051
init(dictionary: [String: AnyObject], skillKey: String) {
@@ -69,6 +70,7 @@ class Skill: NSObject {
6970
model = dictionary[Client.SkillListing.model] as? String ?? ""
7071
group = dictionary[Client.SkillListing.group] as? String ?? ""
7172
language = dictionary[Client.SkillListing.language] as? String ?? ""
73+
lastModifiedTime = dictionary[Client.SkillListing.lastModifiedTime] as? String ?? ""
7274
}
7375

7476
static func getAllSkill(_ skills: [String: AnyObject], _ model: String, _ group: String, _ language: String) -> [Skill] {

0 commit comments

Comments
 (0)