diff --git a/Yep.xcodeproj/project.pbxproj b/Yep.xcodeproj/project.pbxproj index 4252a091..86e0535e 100644 --- a/Yep.xcodeproj/project.pbxproj +++ b/Yep.xcodeproj/project.pbxproj @@ -89,6 +89,8 @@ 5033159C1AC101C80008A209 /* ChatRightTextCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5033159A1AC101C80008A209 /* ChatRightTextCell.swift */; }; 5033159D1AC101C80008A209 /* ChatRightTextCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5033159B1AC101C80008A209 /* ChatRightTextCell.xib */; }; 503315A01AC126100008A209 /* MessageToolbar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5033159F1AC126100008A209 /* MessageToolbar.swift */; }; + 50392CD11B393FF60009D647 /* SkillAddCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50392CCF1B393FF60009D647 /* SkillAddCell.swift */; }; + 50392CD21B393FF60009D647 /* SkillAddCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 50392CD01B393FF60009D647 /* SkillAddCell.xib */; }; 5039594E1B05E6E000797A3E /* ProfileSocialAccountGithubCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5039594C1B05E6E000797A3E /* ProfileSocialAccountGithubCell.swift */; }; 5039594F1B05E6E000797A3E /* ProfileSocialAccountGithubCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5039594D1B05E6E000797A3E /* ProfileSocialAccountGithubCell.xib */; }; 503A54ED1B328ADB002077BD /* NSLocale+Yep.swift in Sources */ = {isa = PBXBuildFile; fileRef = 503A54EC1B328ADB002077BD /* NSLocale+Yep.swift */; }; @@ -305,6 +307,8 @@ 5033159A1AC101C80008A209 /* ChatRightTextCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ChatRightTextCell.swift; path = Views/Cells/ChatRightText/ChatRightTextCell.swift; sourceTree = ""; }; 5033159B1AC101C80008A209 /* ChatRightTextCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ChatRightTextCell.xib; path = Views/Cells/ChatRightText/ChatRightTextCell.xib; sourceTree = ""; }; 5033159F1AC126100008A209 /* MessageToolbar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MessageToolbar.swift; path = Views/MessageToolbar/MessageToolbar.swift; sourceTree = ""; }; + 50392CCF1B393FF60009D647 /* SkillAddCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SkillAddCell.swift; path = Views/Cells/SkillAdd/SkillAddCell.swift; sourceTree = ""; }; + 50392CD01B393FF60009D647 /* SkillAddCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = SkillAddCell.xib; path = Views/Cells/SkillAdd/SkillAddCell.xib; sourceTree = ""; }; 5039594C1B05E6E000797A3E /* ProfileSocialAccountGithubCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ProfileSocialAccountGithubCell.swift; path = Views/Cells/ProfileSocialAccount/ProfileSocialAccountGithubCell.swift; sourceTree = ""; }; 5039594D1B05E6E000797A3E /* ProfileSocialAccountGithubCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = ProfileSocialAccountGithubCell.xib; path = Views/Cells/ProfileSocialAccount/ProfileSocialAccountGithubCell.xib; sourceTree = ""; }; 503A54EC1B328ADB002077BD /* NSLocale+Yep.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "NSLocale+Yep.swift"; path = "Extensions/NSLocale+Yep.swift"; sourceTree = ""; }; @@ -780,6 +784,7 @@ 50553F911ADB8BA600F80B59 /* ChatSectionDate */, 505EC8191ADF8155001D27E0 /* SkillCategory */, 505EC81E1ADFBE1F001D27E0 /* SkillSelection */, + 50392CCE1B393FAE0009D647 /* SkillAdd */, 50EB8CC11AE89EDE001AC1EE /* ChatLeftVideo */, 50EB8CC61AE89F15001AC1EE /* ChatRightVideo */, 50894CF71AEA4A04000981AF /* SettingsUser */, @@ -978,6 +983,15 @@ name = MessageToolbar; sourceTree = ""; }; + 50392CCE1B393FAE0009D647 /* SkillAdd */ = { + isa = PBXGroup; + children = ( + 50392CCF1B393FF60009D647 /* SkillAddCell.swift */, + 50392CD01B393FF60009D647 /* SkillAddCell.xib */, + ); + name = SkillAdd; + sourceTree = ""; + }; 503CAB441AC00CB900DFE830 /* Conversation */ = { isa = PBXGroup; children = ( @@ -1557,6 +1571,7 @@ 50894D081AEDFDA2000981AF /* EditProfileMoreInfoCell.xib in Resources */, 508D174D1ACCF49B0092D666 /* ChatRightAudioCell.xib in Resources */, 50A9D44E1ACD382B000B2599 /* NSDateTimeAgo.bundle in Resources */, + 50392CD21B393FF60009D647 /* SkillAddCell.xib in Resources */, 503315981AC1017E0008A209 /* ChatLeftTextCell.xib in Resources */, 50894D031AEA6433000981AF /* EditProfileLessInfoCell.xib in Resources */, 0AD7EA771AC3EEB000617758 /* PushConfig.plist in Resources */, @@ -1754,6 +1769,7 @@ 508B717D1B1FE9B6006BDDB3 /* ChatRightBaseCell.swift in Sources */, 50A9D44B1ACD37A8000B2599 /* NSFileManager+Yep.swift in Sources */, 502AE5531AB93215005BD199 /* ProfileFooterCell.swift in Sources */, + 50392CD11B393FF60009D647 /* SkillAddCell.swift in Sources */, 50EB8CCB1AEA1AC0001AC1EE /* MediaView.swift in Sources */, 506923121ADE025200D27574 /* Waver.swift in Sources */, 0A5D83991AC5D91E000045BF /* ContactsSearchTableViewController.swift in Sources */, diff --git a/Yep/Base.lproj/Intro.storyboard b/Yep/Base.lproj/Intro.storyboard index c443fbed..f5a77713 100644 --- a/Yep/Base.lproj/Intro.storyboard +++ b/Yep/Base.lproj/Intro.storyboard @@ -475,7 +475,7 @@ - + @@ -553,11 +553,58 @@ + + + + + + + + + + + + + + + + + @@ -565,9 +612,13 @@ + + + + @@ -782,5 +833,7 @@ + + diff --git a/Yep/Images.xcassets/flat_arrow_down.imageset/Contents.json b/Yep/Images.xcassets/flat_arrow_down.imageset/Contents.json new file mode 100644 index 00000000..f9b973b8 --- /dev/null +++ b/Yep/Images.xcassets/flat_arrow_down.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "flat_arrow_down.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Yep/Images.xcassets/flat_arrow_down.imageset/flat_arrow_down.pdf b/Yep/Images.xcassets/flat_arrow_down.imageset/flat_arrow_down.pdf new file mode 100644 index 00000000..97f500e3 Binary files /dev/null and b/Yep/Images.xcassets/flat_arrow_down.imageset/flat_arrow_down.pdf differ diff --git a/Yep/Images.xcassets/flat_arrow_left.imageset/Contents.json b/Yep/Images.xcassets/flat_arrow_left.imageset/Contents.json new file mode 100644 index 00000000..e65b817c --- /dev/null +++ b/Yep/Images.xcassets/flat_arrow_left.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "flat_arrow_left.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Yep/Images.xcassets/flat_arrow_left.imageset/flat_arrow_left.pdf b/Yep/Images.xcassets/flat_arrow_left.imageset/flat_arrow_left.pdf new file mode 100644 index 00000000..092c20a3 Binary files /dev/null and b/Yep/Images.xcassets/flat_arrow_left.imageset/flat_arrow_left.pdf differ diff --git a/Yep/Images.xcassets/skill_bubble_large_empty.imageset/Contents.json b/Yep/Images.xcassets/skill_bubble_large_empty.imageset/Contents.json new file mode 100644 index 00000000..87661c83 --- /dev/null +++ b/Yep/Images.xcassets/skill_bubble_large_empty.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "skill_bubble_large_empty.pdf", + "resizing" : { + "mode" : "3-part-horizontal", + "center" : { + "mode" : "fill", + "width" : 1 + }, + "capInsets" : { + "right" : 17, + "left" : 17 + } + } + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Yep/Images.xcassets/skill_bubble_large_empty.imageset/skill_bubble_large_empty.pdf b/Yep/Images.xcassets/skill_bubble_large_empty.imageset/skill_bubble_large_empty.pdf new file mode 100644 index 00000000..7bf76597 Binary files /dev/null and b/Yep/Images.xcassets/skill_bubble_large_empty.imageset/skill_bubble_large_empty.pdf differ diff --git a/Yep/Services/YepServiceSync.swift b/Yep/Services/YepServiceSync.swift index 065f84bf..429ecc93 100644 --- a/Yep/Services/YepServiceSync.swift +++ b/Yep/Services/YepServiceSync.swift @@ -334,10 +334,18 @@ func syncMyInfoAndDoFurtherAction(furtherAction: () -> Void) { // also save some infomation in YepUserDefaults + if let nickname = friendInfo["nickname"] as? String { + YepUserDefaults.nickname.value = nickname + } + if let introduction = friendInfo["introduction"] as? String { YepUserDefaults.introduction.value = introduction } + if let avatarURLString = friendInfo["avatar_url"] as? String { + YepUserDefaults.avatarURLString.value = avatarURLString + } + if let areaCode = friendInfo["phone_code"] as? String { YepUserDefaults.areaCode.value = areaCode } diff --git a/Yep/ViewControllers/Contacts/ContactsViewController.swift b/Yep/ViewControllers/Contacts/ContactsViewController.swift index 91ca87af..3910e943 100644 --- a/Yep/ViewControllers/Contacts/ContactsViewController.swift +++ b/Yep/ViewControllers/Contacts/ContactsViewController.swift @@ -53,7 +53,9 @@ class ContactsViewController: BaseViewController { // MARK: Actions func updateContactsTableView() { - contactsTableView.reloadData() + dispatch_async(dispatch_get_main_queue()) { + self.contactsTableView.reloadData() + } } func syncFriendships() { diff --git a/Yep/ViewControllers/Conversation/ConversationViewController.swift b/Yep/ViewControllers/Conversation/ConversationViewController.swift index 55138d4e..2027790b 100644 --- a/Yep/ViewControllers/Conversation/ConversationViewController.swift +++ b/Yep/ViewControllers/Conversation/ConversationViewController.swift @@ -1083,7 +1083,9 @@ class ConversationViewController: BaseViewController { } func reloadConversationCollectionView() { - conversationCollectionView.reloadData() + dispatch_async(dispatch_get_main_queue()) { + self.conversationCollectionView.reloadData() + } } func cleanTextInput() { diff --git a/Yep/ViewControllers/Conversations/ConversationsViewController.swift b/Yep/ViewControllers/Conversations/ConversationsViewController.swift index d58b9d61..51ddf211 100644 --- a/Yep/ViewControllers/Conversations/ConversationsViewController.swift +++ b/Yep/ViewControllers/Conversations/ConversationsViewController.swift @@ -84,8 +84,7 @@ class ConversationsViewController: UIViewController { super.viewWillAppear(animated) //Make sure unread message refreshed - conversationsTableView.reloadData() - + reloadConversationsTableView() } override func viewDidAppear(animated: Bool) { @@ -109,7 +108,9 @@ class ConversationsViewController: UIViewController { func reloadConversationsTableView() { // println("reloadConversationsTableView") - conversationsTableView.reloadData() + dispatch_async(dispatch_get_main_queue()) { + self.conversationsTableView.reloadData() + } } } diff --git a/Yep/ViewControllers/Discover/DiscoverViewController.swift b/Yep/ViewControllers/Discover/DiscoverViewController.swift index c2bc2679..de5425ef 100644 --- a/Yep/ViewControllers/Discover/DiscoverViewController.swift +++ b/Yep/ViewControllers/Discover/DiscoverViewController.swift @@ -97,8 +97,10 @@ class DiscoverViewController: BaseViewController { } func updateDiscoverTableView() { - //discoverTableView.reloadData() - discoverTableView.reloadSections(NSIndexSet(index: 0), withRowAnimation: UITableViewRowAnimation.Automatic) + dispatch_async(dispatch_get_main_queue()) { + //self.discoverTableView.reloadData() + self.discoverTableView.reloadSections(NSIndexSet(index: 0), withRowAnimation: UITableViewRowAnimation.Automatic) + } } diff --git a/Yep/ViewControllers/PickLocation/PickLocationViewController.swift b/Yep/ViewControllers/PickLocation/PickLocationViewController.swift index d0ffcea9..e3b15ea5 100644 --- a/Yep/ViewControllers/PickLocation/PickLocationViewController.swift +++ b/Yep/ViewControllers/PickLocation/PickLocationViewController.swift @@ -123,7 +123,9 @@ class PickLocationViewController: UIViewController { } func reloadTableView() { - tableView.reloadData() + dispatch_async(dispatch_get_main_queue()) { + self.tableView.reloadData() + } } } diff --git a/Yep/ViewControllers/Profile/ProfileViewController.swift b/Yep/ViewControllers/Profile/ProfileViewController.swift index 4444bb5f..5b12986d 100644 --- a/Yep/ViewControllers/Profile/ProfileViewController.swift +++ b/Yep/ViewControllers/Profile/ProfileViewController.swift @@ -515,9 +515,11 @@ class ProfileViewController: UIViewController { } func updateProfileCollectionView() { - profileCollectionView.collectionViewLayout.invalidateLayout() - profileCollectionView.reloadData() - profileCollectionView.layoutIfNeeded() + dispatch_async(dispatch_get_main_queue()) { + self.profileCollectionView.collectionViewLayout.invalidateLayout() + self.profileCollectionView.reloadData() + self.profileCollectionView.layoutIfNeeded() + } } func sayHi() { diff --git a/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift b/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift index e91edee6..c10001ea 100644 --- a/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift +++ b/Yep/ViewControllers/Register/RegisterPickSkillsViewController.swift @@ -19,6 +19,7 @@ class RegisterPickSkillsViewController: BaseViewController { var learningSkills = [Skill]() let skillSelectionCellIdentifier = "SkillSelectionCell" + let skillAddCellIdentifier = "SkillAddCell" let addSkillsReusableViewIdentifier = "AddSkillsReusableView" let skillTextAttributes = [NSFontAttributeName: UIFont.skillTextLargeFont()] @@ -51,6 +52,7 @@ class RegisterPickSkillsViewController: BaseViewController { skillsCollectionView.registerNib(UINib(nibName: addSkillsReusableViewIdentifier, bundle: nil), forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, withReuseIdentifier: addSkillsReusableViewIdentifier) skillsCollectionView.registerClass(UICollectionReusableView.self, forSupplementaryViewOfKind: UICollectionElementKindSectionFooter, withReuseIdentifier: "footer") skillsCollectionView.registerNib(UINib(nibName: skillSelectionCellIdentifier, bundle: nil), forCellWithReuseIdentifier: skillSelectionCellIdentifier) + skillsCollectionView.registerNib(UINib(nibName: skillAddCellIdentifier, bundle: nil), forCellWithReuseIdentifier: skillAddCellIdentifier) allSkillCategories(failureHandler: { (reason, errorMessage) -> Void in defaultFailureHandler(reason, errorMessage) @@ -63,7 +65,9 @@ class RegisterPickSkillsViewController: BaseViewController { // MARK: Actions func updateSkillsCollectionView() { - skillsCollectionView.reloadData() + dispatch_async(dispatch_get_main_queue()) { + self.skillsCollectionView.reloadData() + } } @IBAction func saveSkills(sender: AnyObject) { @@ -252,11 +256,12 @@ extension RegisterPickSkillsViewController: UICollectionViewDataSource, UICollec func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { switch section { + case Section.Master.rawValue: - return masterSkills.count + return masterSkills.count + 1 case Section.Learning.rawValue: - return learningSkills.count + return learningSkills.count + 1 default: return 0 @@ -265,22 +270,56 @@ extension RegisterPickSkillsViewController: UICollectionViewDataSource, UICollec func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { - let cell = collectionView.dequeueReusableCellWithReuseIdentifier(skillSelectionCellIdentifier, forIndexPath: indexPath) as! SkillSelectionCell - switch indexPath.section { + case Section.Master.rawValue: - let skill = masterSkills[indexPath.item] - cell.skillLabel.text = skill.localName + + if indexPath.item < masterSkills.count { + let cell = collectionView.dequeueReusableCellWithReuseIdentifier(skillSelectionCellIdentifier, forIndexPath: indexPath) as! SkillSelectionCell + + let skill = masterSkills[indexPath.item] + + cell.skillLabel.text = skill.localName + + return cell + + } else { + let cell = collectionView.dequeueReusableCellWithReuseIdentifier(skillAddCellIdentifier, forIndexPath: indexPath) as! SkillAddCell + + cell.skillSetType = .Master + + cell.addSkillsAction = { skillSetType in + self.performSegueWithIdentifier("presentSelectSkills", sender: skillSetType.rawValue) + } + + return cell + } case Section.Learning.rawValue: - let skill = learningSkills[indexPath.item] - cell.skillLabel.text = skill.localName + if indexPath.item < learningSkills.count { + let cell = collectionView.dequeueReusableCellWithReuseIdentifier(skillSelectionCellIdentifier, forIndexPath: indexPath) as! SkillSelectionCell + + let skill = learningSkills[indexPath.item] + + cell.skillLabel.text = skill.localName + + return cell + + } else { + let cell = collectionView.dequeueReusableCellWithReuseIdentifier(skillAddCellIdentifier, forIndexPath: indexPath) as! SkillAddCell + + cell.skillSetType = .Learning + + cell.addSkillsAction = { skillSetType in + self.performSegueWithIdentifier("presentSelectSkills", sender: skillSetType.rawValue) + } + + return cell + } default: - break + return UICollectionViewCell() } - - return cell } func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView { @@ -301,10 +340,6 @@ extension RegisterPickSkillsViewController: UICollectionViewDataSource, UICollec break } - header.addSkillsAction = { skillSetType in - self.performSegueWithIdentifier("presentSelectSkills", sender: skillSetType.rawValue) - } - return header } else { @@ -316,6 +351,7 @@ extension RegisterPickSkillsViewController: UICollectionViewDataSource, UICollec func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAtIndex section: Int) -> UIEdgeInsets { switch section { + case Section.Master.rawValue: return UIEdgeInsets(top: 0, left: sectionLeftEdgeInset, bottom: sectionBottomEdgeInset, right: sectionRightEdgeInset) @@ -332,13 +368,24 @@ extension RegisterPickSkillsViewController: UICollectionViewDataSource, UICollec var skillString = "" switch indexPath.section { + case Section.Master.rawValue: - let skill = masterSkills[indexPath.item] - skillString = skill.localName + if indexPath.item < masterSkills.count { + let skill = masterSkills[indexPath.item] + skillString = skill.localName + + } else { + return CGSize(width: SkillSelectionCell.height, height: SkillSelectionCell.height) + } case Section.Learning.rawValue: - let skill = learningSkills[indexPath.item] - skillString = skill.localName + if indexPath.item < learningSkills.count { + let skill = learningSkills[indexPath.item] + skillString = skill.localName + + } else { + return CGSize(width: SkillSelectionCell.height, height: SkillSelectionCell.height) + } default: break @@ -346,13 +393,35 @@ extension RegisterPickSkillsViewController: UICollectionViewDataSource, UICollec let rect = skillString.boundingRectWithSize(CGSize(width: CGFloat(FLT_MAX), height: SkillSelectionCell.height), options: .UsesLineFragmentOrigin | .UsesFontLeading, attributes: skillTextAttributes, context: nil) - return CGSizeMake(rect.width + 24, SkillSelectionCell.height) + return CGSize(width: rect.width + 24, height: SkillSelectionCell.height) } func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize { return CGSizeMake(collectionViewWidth - (sectionLeftEdgeInset + sectionRightEdgeInset), 70) } + + func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) { + switch indexPath.section { + + case Section.Master.rawValue: + if indexPath.item == masterSkills.count { + if let cell = collectionView.cellForItemAtIndexPath(indexPath) as? SkillAddCell { + cell.addSkillsAction?(cell.skillSetType) + } + } + + case Section.Learning.rawValue: + if indexPath.item == learningSkills.count { + if let cell = collectionView.cellForItemAtIndexPath(indexPath) as? SkillAddCell { + cell.addSkillsAction?(cell.skillSetType) + } + } + + default: + break + } + } } diff --git a/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift b/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift index 6a13fe31..9bffd82e 100644 --- a/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift +++ b/Yep/ViewControllers/Register/RegisterSelectSkillsViewController.swift @@ -21,6 +21,9 @@ class RegisterSelectSkillsViewController: UIViewController { @IBOutlet weak var skillsCollectionView: UICollectionView! @IBOutlet weak var skillsCollectionViewBottomConstrain: NSLayoutConstraint! + @IBOutlet weak var cancelButton: UIButton! + @IBOutlet weak var backButton: UIButton! + let annotationHeight: CGFloat = 150 @IBOutlet weak var skillsCollectionViewEqualHeightToSkillCategoriesCollectionViewConstraint: NSLayoutConstraint! @@ -75,6 +78,12 @@ class RegisterSelectSkillsViewController: UIViewController { skillsCollectionView.registerNib(UINib(nibName: skillSelectionCellIdentifier, bundle: nil), forCellWithReuseIdentifier: skillSelectionCellIdentifier) + cancelButton.setTitle(NSLocalizedString("Cancel", comment: ""), forState: .Normal) + backButton.setTitle(NSLocalizedString("Back", comment: ""), forState: .Normal) + + cancelButton.alpha = 1 + backButton.alpha = 0 + let layout = self.skillCategoriesCollectionView.collectionViewLayout as! UICollectionViewFlowLayout let originLineSpacing = layout.minimumLineSpacing @@ -130,9 +139,19 @@ class RegisterSelectSkillsViewController: UIViewController { // MARK: Actions func updateSkillsCollectionView() { - skillsCollectionView.collectionViewLayout.invalidateLayout() - skillsCollectionView.reloadData() - skillsCollectionView.layoutIfNeeded() + dispatch_async(dispatch_get_main_queue()) { + self.skillsCollectionView.collectionViewLayout.invalidateLayout() + self.skillsCollectionView.reloadData() + self.skillsCollectionView.layoutIfNeeded() + } + } + + @IBAction func cancel() { + dismiss() + } + + @IBAction func back() { + currentSkillCategoryButton?.toggleSelectionState() } func dismiss() { @@ -211,8 +230,20 @@ extension RegisterSelectSkillsViewController: UICollectionViewDataSource, UIColl let skillCategory = skillCategories[indexPath.item] + let categoryImageNames = [ + "Art": "icon_skill_art", + "Technology": "icon_skill_tech", + "Sport": "icon_skill_sport", + "Life Style": "icon_skill_life", + ] + cell.categoryTitle = skillCategory.localName - //cell.categoryImage = + + if let categoryImageName = categoryImageNames[skillCategory.name] { + cell.categoryImage = UIImage(named: categoryImageName) + } else { + cell.categoryImage = UIImage(named: "icon_skill_art") + } let tintColor = skillCategoryTintColors[indexPath.item % skillCategoryTintColors.count] cell.skillCategoryButton.setBackgroundImage(UIImage(named: "button_skill_category")!.imageWithGradientTintColor(tintColor).resizableImageWithCapInsets(UIEdgeInsets(top: 30, left: 40, bottom: 30, right: 40)), forState: .Normal) @@ -301,6 +332,9 @@ extension RegisterSelectSkillsViewController: UICollectionViewDataSource, UIColl self.skillsCollectionView.alpha = 1 + self.cancelButton.alpha = 0 + self.backButton.alpha = 1 + }, completion: { (finished) -> Void in }) @@ -324,6 +358,9 @@ extension RegisterSelectSkillsViewController: UICollectionViewDataSource, UIColl collectionView.alpha = 1 + self.cancelButton.alpha = 1 + self.backButton.alpha = 0 + }, completion: { (_) -> Void in button.removeFromSuperview() @@ -367,9 +404,10 @@ extension RegisterSelectSkillsViewController: UICollectionViewDataSource, UIColl private func updateSkillSelectionCell(skillSelectionCell: SkillSelectionCell, withSkill skill: Skill) { if selectedSkillsSet.contains(skill) { - skillSelectionCell.tintColor = UIColor.darkGrayColor() + skillSelectionCell.skillSelected = true + } else { - skillSelectionCell.tintColor = UIColor.yepTintColor() + skillSelectionCell.skillSelected = false } } diff --git a/Yep/ViewControllers/SearchedUsers/SearchedUsersViewController.swift b/Yep/ViewControllers/SearchedUsers/SearchedUsersViewController.swift index a458620e..336b50de 100644 --- a/Yep/ViewControllers/SearchedUsers/SearchedUsersViewController.swift +++ b/Yep/ViewControllers/SearchedUsers/SearchedUsersViewController.swift @@ -44,7 +44,9 @@ class SearchedUsersViewController: BaseViewController { // MARK: Actions func updateSearchedUsersTableView() { - searchedUsersTableView.reloadData() + dispatch_async(dispatch_get_main_queue()) { + self.searchedUsersTableView.reloadData() + } } // MARK: Navigation diff --git a/Yep/ViewControllers/SocialWorks/SocialWorkDribbbleViewController.swift b/Yep/ViewControllers/SocialWorks/SocialWorkDribbbleViewController.swift index edac1fad..912c0d0f 100644 --- a/Yep/ViewControllers/SocialWorks/SocialWorkDribbbleViewController.swift +++ b/Yep/ViewControllers/SocialWorks/SocialWorkDribbbleViewController.swift @@ -97,7 +97,9 @@ class SocialWorkDribbbleViewController: BaseViewController { // MARK: Actions func updateDribbbleCollectionView() { - dribbbleCollectionView.reloadData() + dispatch_async(dispatch_get_main_queue()) { + self.dribbbleCollectionView.reloadData() + } } func share() { diff --git a/Yep/ViewControllers/SocialWorks/SocialWorkGithubViewController.swift b/Yep/ViewControllers/SocialWorks/SocialWorkGithubViewController.swift index c5bd5451..b98006d5 100644 --- a/Yep/ViewControllers/SocialWorks/SocialWorkGithubViewController.swift +++ b/Yep/ViewControllers/SocialWorks/SocialWorkGithubViewController.swift @@ -125,7 +125,9 @@ class SocialWorkGithubViewController: BaseViewController { // MARK: Actions func updateGithubTableView() { - githubTableView.reloadData() + dispatch_async(dispatch_get_main_queue()) { + self.githubTableView.reloadData() + } } func share() { diff --git a/Yep/ViewControllers/SocialWorks/SocialWorkInstagramViewController.swift b/Yep/ViewControllers/SocialWorks/SocialWorkInstagramViewController.swift index d9b4baab..ac621def 100644 --- a/Yep/ViewControllers/SocialWorks/SocialWorkInstagramViewController.swift +++ b/Yep/ViewControllers/SocialWorks/SocialWorkInstagramViewController.swift @@ -94,7 +94,9 @@ class SocialWorkInstagramViewController: BaseViewController { // MARK: Actions func updateInstagramCollectionView() { - instagramCollectionView.reloadData() + dispatch_async(dispatch_get_main_queue()) { + self.instagramCollectionView.reloadData() + } } func share() { diff --git a/Yep/Views/Cells/SkillAdd/SkillAddCell.swift b/Yep/Views/Cells/SkillAdd/SkillAddCell.swift new file mode 100644 index 00000000..55b98530 --- /dev/null +++ b/Yep/Views/Cells/SkillAdd/SkillAddCell.swift @@ -0,0 +1,16 @@ +// +// SkillAddCell.swift +// +// +// Created by NIX on 15/6/23. +// +// + +import UIKit + +class SkillAddCell: UICollectionViewCell { + + var skillSetType: SkillSetType = .Master + + var addSkillsAction: ((SkillSetType) -> ())? +} diff --git a/Yep/Views/Cells/SkillAdd/SkillAddCell.xib b/Yep/Views/Cells/SkillAdd/SkillAddCell.xib new file mode 100644 index 00000000..0d7929ef --- /dev/null +++ b/Yep/Views/Cells/SkillAdd/SkillAddCell.xib @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Yep/Views/Cells/SkillSelection/SkillSelectionCell.swift b/Yep/Views/Cells/SkillSelection/SkillSelectionCell.swift index d7e54801..1488c382 100644 --- a/Yep/Views/Cells/SkillSelection/SkillSelectionCell.swift +++ b/Yep/Views/Cells/SkillSelection/SkillSelectionCell.swift @@ -16,6 +16,19 @@ class SkillSelectionCell: UICollectionViewCell { @IBOutlet weak var skillLabel: UILabel! + var skillSelected: Bool = false { + willSet { + if newValue { + backgroundImageView.image = UIImage(named: "skill_bubble_large_empty") + skillLabel.textColor = UIColor.yepTintColor() + + } else { + backgroundImageView.image = UIImage(named: "skill_bubble_large") + skillLabel.textColor = UIColor.whiteColor() + } + } + } + override func awakeFromNib() { super.awakeFromNib() diff --git a/Yep/Views/ReusableViews/AddSkills/AddSkillsReusableView.swift b/Yep/Views/ReusableViews/AddSkills/AddSkillsReusableView.swift index 8966f132..153888d4 100644 --- a/Yep/Views/ReusableViews/AddSkills/AddSkillsReusableView.swift +++ b/Yep/Views/ReusableViews/AddSkills/AddSkillsReusableView.swift @@ -29,26 +29,6 @@ class AddSkillsReusableView: UICollectionReusableView { skillTypeLabel.text = "\(newValue)" } } - - var addSkillsAction: ((SkillSetType) -> ())? - @IBOutlet weak var skillTypeLabel: UILabel! - @IBOutlet weak var addSkillsButton: UIButton! - - - override func awakeFromNib() { - super.awakeFromNib() - - addSkillsButton.tintColor = UIColor.yepTintColor() - - addSkillsButton.addTarget(self, action: "tryAddSkills", forControlEvents: .TouchUpInside) - } - - func tryAddSkills() { - if let action = addSkillsAction { - action(skillSetType) - } - } - } diff --git a/Yep/Views/ReusableViews/AddSkills/AddSkillsReusableView.xib b/Yep/Views/ReusableViews/AddSkills/AddSkillsReusableView.xib index 251f1cdd..662d5770 100644 --- a/Yep/Views/ReusableViews/AddSkills/AddSkillsReusableView.xib +++ b/Yep/Views/ReusableViews/AddSkills/AddSkillsReusableView.xib @@ -1,5 +1,5 @@ - + @@ -11,36 +11,22 @@ - + - - - - - -