Skip to content

Commit

Permalink
Merge pull request #67 from boostcamp3-iOS/feature/liveFeed
Browse files Browse the repository at this point in the history
Feature/live feed
  • Loading branch information
godpp authored Feb 11, 2019
2 parents 80560b4 + 43991d8 commit c476725
Show file tree
Hide file tree
Showing 6 changed files with 232 additions and 10 deletions.
8 changes: 8 additions & 0 deletions tree/tree.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
6A198CC8220C9F51002421AC /* ArticleTypeEnum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A198CC7220C9F51002421AC /* ArticleTypeEnum.swift */; };
6A198CCA220CAA9A002421AC /* DefaultLabelView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6A198CC9220CAA9A002421AC /* DefaultLabelView.xib */; };
6A198CCC220CAAB5002421AC /* DefautLabelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A198CCB220CAAB5002421AC /* DefautLabelView.swift */; };
6A47BF43220E0638008BEA7A /* LiveFeedTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A47BF41220E0638008BEA7A /* LiveFeedTableViewCell.swift */; };
6A47BF44220E0638008BEA7A /* LiveFeedTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6A47BF42220E0638008BEA7A /* LiveFeedTableViewCell.xib */; };
6A5D282A22013FA5009EC8ED /* Extension+ImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A5D282922013FA5009EC8ED /* Extension+ImageView.swift */; };
6A5D282C220187F8009EC8ED /* Extension+UIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A5D282B220187F8009EC8ED /* Extension+UIView.swift */; };
6A65DA432203D22B005EB2BC /* LoadingView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6A65DA422203D22B005EB2BC /* LoadingView.xib */; };
Expand Down Expand Up @@ -104,6 +106,8 @@
6A198CC7220C9F51002421AC /* ArticleTypeEnum.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleTypeEnum.swift; sourceTree = "<group>"; };
6A198CC9220CAA9A002421AC /* DefaultLabelView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DefaultLabelView.xib; sourceTree = "<group>"; };
6A198CCB220CAAB5002421AC /* DefautLabelView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefautLabelView.swift; sourceTree = "<group>"; };
6A47BF41220E0638008BEA7A /* LiveFeedTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LiveFeedTableViewCell.swift; sourceTree = "<group>"; };
6A47BF42220E0638008BEA7A /* LiveFeedTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = LiveFeedTableViewCell.xib; sourceTree = "<group>"; };
6A5D282922013FA5009EC8ED /* Extension+ImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension+ImageView.swift"; sourceTree = "<group>"; };
6A5D282B220187F8009EC8ED /* Extension+UIView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension+UIView.swift"; sourceTree = "<group>"; };
6A65DA422203D22B005EB2BC /* LoadingView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = LoadingView.xib; sourceTree = "<group>"; };
Expand Down Expand Up @@ -356,6 +360,8 @@
BC5D4E45220B1D66000465B0 /* Events */,
BC5D4E44220B1D60000465B0 /* Keyword */,
BCD1BB2522057CF800F9C8A8 /* TableViewCell+Animator.swift */,
6A47BF41220E0638008BEA7A /* LiveFeedTableViewCell.swift */,
6A47BF42220E0638008BEA7A /* LiveFeedTableViewCell.xib */,
);
path = Live;
sourceTree = "<group>";
Expand Down Expand Up @@ -563,6 +569,7 @@
files = (
D9DFFB47220EEA7F0047E326 /* ScrapFilter.storyboard in Resources */,
BC5D4E42220B1D17000465B0 /* KeywordDetailGraphCell.xib in Resources */,
6A47BF44220E0638008BEA7A /* LiveFeedTableViewCell.xib in Resources */,
35DC0DFF21F6FB3200F30416 /* .swiftlint.yml in Resources */,
6A65DA432203D22B005EB2BC /* LoadingView.xib in Resources */,
BCDB9E282205A1040095E4E4 /* TrendHeaderCell.xib in Resources */,
Expand Down Expand Up @@ -648,6 +655,7 @@
BC2656C721FD950900003413 /* Articles.swift in Sources */,
BC5D4E41220B1D17000465B0 /* KeywordDetailGraphCell.swift in Sources */,
D9C6AB5D21FC152D001C0AB8 /* SearchScrollEnum.swift in Sources */,
6A47BF43220E0638008BEA7A /* LiveFeedTableViewCell.swift in Sources */,
BC5D4E4C220B531D000465B0 /* KeywordDetailViewController.swift in Sources */,
D9C6AB3D21FA9B3E001C0AB8 /* Extension+UIColor.swift in Sources */,
6A0957AE220963B300D46741 /* SearchFilterProtocol.swift in Sources */,
Expand Down
4 changes: 2 additions & 2 deletions tree/tree/Controller/Search/ArticleDetailViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ class ArticleDetailViewController: UIViewController {
}

override func viewWillAppear(_ animated: Bool) {
createFloatingButton()
// createFloatingButton()
self.tabBarController?.tabBar.isHidden = true
}

override func viewWillDisappear(_ animated: Bool) {
removeFloatingButton()
// removeFloatingButton()
self.tabBarController?.tabBar.isHidden = false
}

Expand Down
28 changes: 22 additions & 6 deletions tree/tree/Controller/Search/SearchViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class SearchViewController: UIViewController {
navigationBarSetting()
registerArticleCell()
filterItemSetting()
getUserFilter()
userFilter()
setDefaultView(message: "Please Search 🔎")
}

Expand Down Expand Up @@ -153,7 +153,10 @@ class SearchViewController: UIViewController {
}
}

private func loadMoreArticles(keyword: String, language: String, sort: String) {
private func loadMoreArticles(
keyword: String,
language: String,
sort: String) {
if page >= totalPage { return }
page += 1
APIManager.getArticles(
Expand Down Expand Up @@ -317,7 +320,12 @@ extension SearchViewController: UITableViewDataSourcePrefetching {

// MARK: Filter Delegate
extension SearchViewController: FilterSettingDelegate {
func observeUserSetting(keyword: String, sort: String, category: String, language: String) {
func observeUserSetting(
keyword: String,
sort: String,
category: String,
language: String
) {
updateUserFilter(
keyword: keyword,
sort: sort,
Expand All @@ -327,15 +335,23 @@ extension SearchViewController: FilterSettingDelegate {
UserDefaults.standard.set(searchFilter, forKey: "searchFilter")
}

private func updateUserFilter(keyword: String, sort: String, category: String, language: String) {
private func updateUserFilter(
keyword: String,
sort: String,
category: String,
language: String
) {
searchFilter.updateValue(keyword, forKey: "keyword")
searchFilter.updateValue(sort, forKey: "sort")
searchFilter.updateValue(category, forKey: "category")
searchFilter.updateValue(language.lowercased(), forKey: "language")
}

private func getUserFilter() {
guard let userFilter = UserDefaults.standard.dictionary(forKey: "searchFilter") else { return }
private func userFilter() {
guard
let userFilter = UserDefaults.standard.dictionary(forKey: "searchFilter") else {
return
}
if let keyword = userFilter["keyword"] as? String,
let sort = userFilter["sort"] as? String,
let category = userFilter["category"] as? String,
Expand Down
27 changes: 27 additions & 0 deletions tree/tree/View/Live/LiveFeedTableViewCell.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// LiveFeedTableViewCell.swift
// tree
//
// Created by hyeri kim on 09/02/2019.
// Copyright © 2019 gardener. All rights reserved.
//

import UIKit

class LiveFeedTableViewCell: UITableViewCell {

@IBOutlet weak var dateLabel: UILabel!
@IBOutlet weak var eventLabel: UILabel!
@IBOutlet weak var locationLabel: UILabel!
@IBOutlet weak var articleCountLabel: UILabel!

override func awakeFromNib() {
super.awakeFromNib()
}

override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)

}

}
Loading

0 comments on commit c476725

Please sign in to comment.