Skip to content

Commit

Permalink
Merge branch 'feature/meet_geniuses' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
nixzhu committed Jun 30, 2016
2 parents f7f056a + bbb2285 commit 43d4e69
Show file tree
Hide file tree
Showing 16 changed files with 585 additions and 27 deletions.
42 changes: 41 additions & 1 deletion Yep.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@
50A6A7B31D23643100E01190 /* ConversationViewController+YepFayeServiceDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A6A7B21D23643100E01190 /* ConversationViewController+YepFayeServiceDelegate.swift */; };
50A6A7B51D23676300E01190 /* ConversationViewController+SendMessages.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A6A7B41D23676300E01190 /* ConversationViewController+SendMessages.swift */; };
50A6A7B71D2377E100E01190 /* ConversationViewController+SyncMessages.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A6A7B61D2377E100E01190 /* ConversationViewController+SyncMessages.swift */; };
50A6A7BA1D23AD4000E01190 /* MeetGeniusShowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A6A7B91D23AD4000E01190 /* MeetGeniusShowView.swift */; };
50A6A7BD1D23BED600E01190 /* GeniusInterviewViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A6A7BC1D23BED600E01190 /* GeniusInterviewViewController.swift */; };
50A6A7BF1D23BEEF00E01190 /* GeniusInterview.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 50A6A7BE1D23BEEF00E01190 /* GeniusInterview.storyboard */; };
50A6A7C21D23C2D300E01190 /* GeniusInterviewActionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A6A7C11D23C2D300E01190 /* GeniusInterviewActionView.swift */; };
50A820241B969B0F007CD30E /* NSTimeZone+Yep.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A820231B969B0F007CD30E /* NSTimeZone+Yep.swift */; };
50A93A9D1BD8C515007005DB /* FeedSkillPickerItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A93A9C1BD8C515007005DB /* FeedSkillPickerItemView.swift */; };
50A9D4571ACD393A000B2599 /* YepWaverView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A9D4541ACD393A000B2599 /* YepWaverView.swift */; };
Expand Down Expand Up @@ -1020,6 +1024,10 @@
50A6A7B21D23643100E01190 /* ConversationViewController+YepFayeServiceDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "ConversationViewController+YepFayeServiceDelegate.swift"; path = "ViewControllers/Conversation/ConversationViewController+YepFayeServiceDelegate.swift"; sourceTree = "<group>"; };
50A6A7B41D23676300E01190 /* ConversationViewController+SendMessages.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "ConversationViewController+SendMessages.swift"; path = "ViewControllers/Conversation/ConversationViewController+SendMessages.swift"; sourceTree = "<group>"; };
50A6A7B61D2377E100E01190 /* ConversationViewController+SyncMessages.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "ConversationViewController+SyncMessages.swift"; path = "ViewControllers/Conversation/ConversationViewController+SyncMessages.swift"; sourceTree = "<group>"; };
50A6A7B91D23AD4000E01190 /* MeetGeniusShowView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MeetGeniusShowView.swift; path = Views/MeetGeniusShow/MeetGeniusShowView.swift; sourceTree = "<group>"; };
50A6A7BC1D23BED600E01190 /* GeniusInterviewViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GeniusInterviewViewController.swift; path = ViewControllers/GeniusInterview/GeniusInterviewViewController.swift; sourceTree = "<group>"; };
50A6A7BE1D23BEEF00E01190 /* GeniusInterview.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = GeniusInterview.storyboard; path = ViewControllers/GeniusInterview/GeniusInterview.storyboard; sourceTree = "<group>"; };
50A6A7C11D23C2D300E01190 /* GeniusInterviewActionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GeniusInterviewActionView.swift; path = Views/GeniusInterviewAction/GeniusInterviewActionView.swift; sourceTree = "<group>"; };
50A820231B969B0F007CD30E /* NSTimeZone+Yep.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "NSTimeZone+Yep.swift"; path = "Extensions/NSTimeZone+Yep.swift"; sourceTree = "<group>"; };
50A93A9C1BD8C515007005DB /* FeedSkillPickerItemView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = FeedSkillPickerItemView.swift; path = Views/PickerItems/FeedSkill/FeedSkillPickerItemView.swift; sourceTree = "<group>"; };
50A9D4541ACD393A000B2599 /* YepWaverView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = YepWaverView.swift; path = Views/AudioWaves/YepWaverView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1804,6 +1812,7 @@
502048251B0F1BB8002EBFC7 /* SearchedUsers */,
502280F91B1C3F2F00E984EE /* FriendsInContacts */,
5023DE2E1AB685F100B3EE96 /* Discover */,
50A6A7BB1D23BE7600E01190 /* GeniusInterview */,
5023DE311AB6861900B3EE96 /* Profile */,
845E1A671B788EFC001E0789 /* EditSkills */,
502AE51C1AB70DE5005BD199 /* Welcome */,
Expand Down Expand Up @@ -1911,6 +1920,8 @@
5023DE391AB6979C00B3EE96 /* Views */ = {
isa = PBXGroup;
children = (
50A6A7B81D23AD1600E01190 /* MeetGeniusShow */,
50A6A7C01D23C28D00E01190 /* GeniusInterviewActionView */,
50B6A03D1CA282B100C460E3 /* ActionSheet */,
50B8E6191B41341000C17EA1 /* ProgressViews */,
504CBA3B1B3D048900663A90 /* TextViews */,
Expand Down Expand Up @@ -2820,6 +2831,31 @@
name = DoNotDisturbPeriod;
sourceTree = "<group>";
};
50A6A7B81D23AD1600E01190 /* MeetGeniusShow */ = {
isa = PBXGroup;
children = (
50A6A7B91D23AD4000E01190 /* MeetGeniusShowView.swift */,
);
name = MeetGeniusShow;
sourceTree = "<group>";
};
50A6A7BB1D23BE7600E01190 /* GeniusInterview */ = {
isa = PBXGroup;
children = (
50A6A7BC1D23BED600E01190 /* GeniusInterviewViewController.swift */,
50A6A7BE1D23BEEF00E01190 /* GeniusInterview.storyboard */,
);
name = GeniusInterview;
sourceTree = "<group>";
};
50A6A7C01D23C28D00E01190 /* GeniusInterviewActionView */ = {
isa = PBXGroup;
children = (
50A6A7C11D23C2D300E01190 /* GeniusInterviewActionView.swift */,
);
name = GeniusInterviewActionView;
sourceTree = "<group>";
};
50A93A9E1BD8C51D007005DB /* PickerItems */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -4130,6 +4166,7 @@
84385C461B8594E80071130D /* Show.xcassets in Resources */,
50894CFB1AEA54BA000981AF /* SettingsMoreCell.xib in Resources */,
50E1CE8F1BE0BFF00025B933 /* MediaViewCell.xib in Resources */,
50A6A7BF1D23BEEF00E01190 /* GeniusInterview.storyboard in Resources */,
505EC8181ADF8151001D27E0 /* SkillCategoryCell.xib in Resources */,
6A8215091BCBE8F10011F36C /* DiscoverSkillCell.xib in Resources */,
50DEE0451BEA025100015741 /* About.storyboard in Resources */,
Expand Down Expand Up @@ -4463,6 +4500,7 @@
502AE5581AB932D5005BD199 /* ProfileSectionHeaderReusableView.swift in Sources */,
500EED981BF07A3000C6BABC /* ConversationViewController+Feed.swift in Sources */,
508F8FDE1B049ACF00461B0B /* InstagramMediaCell.swift in Sources */,
50A6A7BA1D23AD4000E01190 /* MeetGeniusShowView.swift in Sources */,
502AE5211AB71C7E005BD199 /* BorderButton.swift in Sources */,
50858EBB1C22487900EDE492 /* FeedBasicCell.swift in Sources */,
84C959891B731FD20017D3ED /* ChatBaseCell.swift in Sources */,
Expand Down Expand Up @@ -4528,6 +4566,7 @@
5080EB1C1B93F43A006F3C2D /* PodsHelpYepViewController.swift in Sources */,
0A1CAC731AFA526200826B45 /* SkillHomeSectionButton.swift in Sources */,
50E392BC1C22752C00C0CECB /* FeedNormalImagesCell.swift in Sources */,
50A6A7BD1D23BED600E01190 /* GeniusInterviewViewController.swift in Sources */,
50E34C261CBB8A37007CAE80 /* SearchFeedsViewController.swift in Sources */,
50B38FCC1B6B37F00064C132 /* FeedbackViewController.swift in Sources */,
50CB05761CC5D0FD0024BE06 /* SearchedFeedBasicCell.swift in Sources */,
Expand Down Expand Up @@ -4609,6 +4648,7 @@
338940371CB7C80900B276C1 /* NewFeedPreviewCell.swift in Sources */,
502AE52E1AB83879005BD199 /* UnderLineTextField.swift in Sources */,
5012FDDA1BFABDE400294145 /* ProfileFeedsCell.swift in Sources */,
50A6A7C21D23C2D300E01190 /* GeniusInterviewActionView.swift in Sources */,
508F8FD71B01EDB400461B0B /* DribbbleShotCell.swift in Sources */,
508DF62B1B9985F300B194A4 /* YepLog.swift in Sources */,
50A6A7AF1D2361A900E01190 /* ConversationViewController+AVAudioPlayerDelegate.swift in Sources */,
Expand Down Expand Up @@ -5106,7 +5146,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_SWIFT_FLAGS = "-D DEBUG -D STAGING_";
OTHER_SWIFT_FLAGS = "-D DEBUG -D STAGING";
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
Expand Down
9 changes: 4 additions & 5 deletions Yep/Extensions/UISearchBar+Yep.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,17 @@ extension UISearchBar {
yep_cancelButton?.enabled = true
}

func yep_makeSureCancelButtonAlwaysEnabled() -> ObjectKeypathObserver? {
func yep_makeSureCancelButtonAlwaysEnabled() -> ObjectKeypathObserver<UIButton>? {

guard let cancelButton = yep_cancelButton else {
println("Not cancelButton in searchBar!")
return nil
}

return ObjectKeypathObserver(object: cancelButton, keypath: "enabled", afterValueChanged: { object in
if let cancelButton = object as? UIButton {
if !cancelButton.enabled {
cancelButton.enabled = true
}
let cancelButton = object
if !cancelButton.enabled {
cancelButton.enabled = true
}
})
}
Expand Down
10 changes: 5 additions & 5 deletions Yep/Helpers/KVO/ObjectKeypathObserver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@

import UIKit

final class ObjectKeypathObserver: NSObject {
final class ObjectKeypathObserver<Object: NSObject>: NSObject {

weak var object: NSObject?
weak var object: Object?
var keypath: String
typealias AfterValueChanged = (object: NSObject) -> Void
typealias AfterValueChanged = (object: Object) -> Void
var afterValueChanged: AfterValueChanged?

deinit {
object?.removeObserver(self, forKeyPath: keypath)
}

init(object: NSObject, keypath: String, afterValueChanged: AfterValueChanged) {
init(object: Object, keypath: String, afterValueChanged: AfterValueChanged) {

self.object = object
self.keypath = keypath
Expand All @@ -32,7 +32,7 @@ final class ObjectKeypathObserver: NSObject {

override func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutablePointer<Void>) {

guard let object = object as? NSObject else {
guard let object = object as? Object else {
return
}

Expand Down
17 changes: 13 additions & 4 deletions Yep/ViewControllers/Discover/Discover.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="BbO-Lb-bmk" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1094" y="691"/>
<point key="canvasLocation" x="1094" y="717"/>
</scene>
<!--Meet Genius View Controller-->
<scene sceneID="LJn-ul-tWy">
Expand Down Expand Up @@ -86,15 +86,23 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="RtR-Fj-qI0" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1094" y="41"/>
<point key="canvasLocation" x="1094" y="-3"/>
</scene>
<!--ProfileViewController-->
<scene sceneID="c2u-kZ-KfX">
<objects>
<viewControllerPlaceholder storyboardName="Profile" referencedIdentifier="ProfileViewController" id="Mso-uB-5h2" sceneMemberID="viewController"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="2y7-Gv-1UV" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1015" y="342"/>
<point key="canvasLocation" x="1015" y="379"/>
</scene>
<!--GeniusInterviewViewController-->
<scene sceneID="rFU-Ru-Gmf">
<objects>
<viewControllerPlaceholder storyboardName="GeniusInterview" referencedIdentifier="GeniusInterviewViewController" id="mSt-h3-goH" sceneMemberID="viewController"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="et6-lG-1Em" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1044.5" y="299"/>
</scene>
<!--Discover Container View Controller-->
<scene sceneID="O2C-is-rbL">
Expand All @@ -111,7 +119,7 @@
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ade-aI-clV">
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
<connections>
<segue destination="T3K-r6-koR" kind="embed" id="ldB-jB-1ZQ"/>
<segue destination="T3K-r6-koR" kind="embed" identifier="embedMeetGenius" id="ldB-jB-1ZQ"/>
</connections>
</containerView>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="tFq-8H-AGD">
Expand Down Expand Up @@ -150,6 +158,7 @@
<outlet property="geniusesContainerView" destination="ade-aI-clV" id="MLp-zX-9Fu"/>
<outlet property="segmentedControl" destination="pIA-g9-MZ7" id="3w9-pT-zy3"/>
<segue destination="Mso-uB-5h2" kind="show" identifier="showProfile" id="xMr-kL-ECd"/>
<segue destination="mSt-h3-goH" kind="show" identifier="showGeniusInterview" id="4mo-zj-Hna"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="T4l-ea-p2b" userLabel="First Responder" sceneMemberID="firstResponder"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@ class DiscoverContainerViewController: UIViewController {

switch identifier {

case "embedMeetGenius":
let vc = segue.destinationViewController as! MeetGeniusViewController

vc.showGeniusInterviewAction = {
SafeDispatch.async { [weak self] in
self?.performSegueWithIdentifier("showGeniusInterview", sender: nil)
}
}

case "embedDiscover":

let vc = segue.destinationViewController as! DiscoverViewController
Expand Down
109 changes: 102 additions & 7 deletions Yep/ViewControllers/Discover/MeetGeniusViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,32 @@
//

import UIKit
import YepKit

class MeetGeniusViewController: UIViewController {

var showGeniusInterviewAction: (() -> Void)?

@IBOutlet weak var tableView: UITableView! {
didSet {
tableView.tableHeaderView = MeetGeniusShowView(frame: CGRect(x: 0, y: 0, width: 100, height: 180))
tableView.tableFooterView = UIView()

tableView.rowHeight = 90
tableView.tableFooterView = InfoView(NSLocalizedString("To be continue.", comment: ""))

tableView.registerNibOf(GeniusInterviewCell)
tableView.registerNibOf(LoadMoreTableViewCell)
}
}

var geniusInterviews: [GeniusInterview] = []

private var canLoadMore: Bool = false

override func viewDidLoad() {
super.viewDidLoad()

println("tableView.tableHeaderView: \(tableView.tableHeaderView)")
}

/*
Expand All @@ -38,19 +50,102 @@ class MeetGeniusViewController: UIViewController {

extension MeetGeniusViewController: UITableViewDataSource, UITableViewDelegate {

private enum Section: Int {
case GeniusInterview
case LoadMore
}

func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 0

return 2
}

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 15

guard let section = Section(rawValue: section) else {
fatalError("Invalid Section")
}

switch section {

case .GeniusInterview:
return geniusInterviews.count

case .LoadMore:
return 1
}
}

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell: GeniusInterviewCell = tableView.dequeueReusableCell()
cell.avatarImageView.image = UIImage(named: "yep_icon_solo")
cell.numberLabel.text = String(format: "#%03d", indexPath.row)
return cell

guard let section = Section(rawValue: indexPath.section) else {
fatalError("Invalid Section")
}

switch section {

case .GeniusInterview:
let cell: GeniusInterviewCell = tableView.dequeueReusableCell()
let geniusInterview = geniusInterviews[indexPath.row]
cell.configure(withGeniusInterview: geniusInterview)
return cell

case .LoadMore:
let cell: LoadMoreTableViewCell = tableView.dequeueReusableCell()
cell.isLoading = true
return cell
}
}

func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {

guard let section = Section(rawValue: indexPath.section) else {
fatalError("Invalid Section")
}

switch section {

case .GeniusInterview:
break

case .LoadMore:
guard let cell = cell as? LoadMoreTableViewCell else {
break
}

guard canLoadMore else {
cell.isLoading = false
break
}

println("load more feeds")

if !cell.isLoading {
cell.isLoading = true
}

// TODO
}
}

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {

defer {
tableView.deselectRowAtIndexPath(indexPath, animated: true)
}

guard let section = Section(rawValue: indexPath.section) else {
fatalError("Invalid Section")
}

switch section {

case .GeniusInterview:
showGeniusInterviewAction?()

case .LoadMore:
break
}
}
}

2 changes: 1 addition & 1 deletion Yep/ViewControllers/EditProfile/EditProfile.storyboard
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
Expand Down
Loading

0 comments on commit 43d4e69

Please sign in to comment.