Skip to content

Commit

Permalink
Merge pull request #59 from yapp-project/develop
Browse files Browse the repository at this point in the history
Merge develop to master
  • Loading branch information
eojine committed Mar 30, 2019
2 parents 899c4f5 + 9311e18 commit 8f7d19b
Show file tree
Hide file tree
Showing 159 changed files with 4,204 additions and 419 deletions.
2 changes: 2 additions & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ target 'Toonie' do
pod 'Kingfisher'
pod 'lottie-ios'
pod 'SwiftLint'
pod 'SnapKit'
pod 'Alamofire'

target 'ToonieTests' do
inherit! :search_paths
Expand Down
18 changes: 13 additions & 5 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
PODS:
- Kingfisher (5.2.0)
- Alamofire (4.8.2)
- Kingfisher (5.3.1)
- KTCenterFlowLayout (1.3.1)
- lottie-ios (2.5.3)
- lottie-ios (3.0.3)
- SnapKit (4.2.0)
- SwiftLint (0.31.0)

DEPENDENCIES:
- Alamofire
- Kingfisher
- KTCenterFlowLayout
- lottie-ios
- SnapKit
- SwiftLint

SPEC REPOS:
https://github.com/cocoapods/specs.git:
- Alamofire
- Kingfisher
- KTCenterFlowLayout
- lottie-ios
- SnapKit
- SwiftLint

SPEC CHECKSUMS:
Kingfisher: 07067cfacf371117330dceb4b4b8f5c4b691ab42
Alamofire: ae5c501addb7afdbb13687d7f2f722c78734c2d3
Kingfisher: d9e7e0b209b59b8f9873aa2f37654e81a7beea51
KTCenterFlowLayout: 6e02b50ab2bd865025ae82fe266ed13b6d9eaf97
lottie-ios: a50d5c0160425cd4b01b852bb9578963e6d92d31
lottie-ios: 06e0b54aab85ba128e332687d7f4ac4861a7a7ae
SnapKit: fe8a619752f3f27075cc9a90244d75c6c3f27e2a
SwiftLint: 7a0227733d786395817373b2d0ca799fd0093ff3

PODFILE CHECKSUM: 1080201be50d75d768612a504c437da38704ec55
PODFILE CHECKSUM: 32f2fd98a8055354eb302f20af8f45112e271c02

COCOAPODS: 1.6.1
299 changes: 268 additions & 31 deletions Toonie.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions Toonie/Common/CommonUtility.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// CommonUtility.swift
// Toonie
//
// Created by ebpark on 11/03/2019.
// Copyright © 2019 Yapp. All rights reserved.
//

import UIKit

///애플리케이션에 필요한 잡다한 도구 모음
final class CommonUtility: NSObject {
//디자인 가이드 기준 Xs
static let deviceWidth: CGFloat = 375
static let deviceHeight: CGFloat = 812

var mainNavigationViewController: MainNavigationController?
var feedNavigationViewController: FeedNavigationController?
var lookNavigationViewController: LookNavigationController?
// var myPageNavigationViewController : MyPageNavigationController

//싱글톤
static let sharedInstance: CommonUtility = {
let instance = CommonUtility()
return instance
} ()

///아이폰Xs 해상도 기준으로 타 디바이스 비율을 가져오는 메서드
static func getDeviceRatioWidth() -> CGFloat {
// print("-->현재 디바이스 크기 \(UIScreen.main.bounds.width)")
return (CGFloat)(UIScreen.main.bounds.width / deviceWidth)
}
static func getDeviceRatioHieght() -> CGFloat {
// print("-->현재 디바이스 크기 \(UIScreen.main.bounds.height)")
// XMax : 812 -> 디바이스 크기 Xs 기준으로 나오고 있음
return (CGFloat)(UIScreen.main.bounds.height / deviceHeight)
}
}
22 changes: 22 additions & 0 deletions Toonie/Common/GestureViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// GestureViewController.swift
// Toonie
//
// Created by 박은비 on 23/03/2019.
// Copyright © 2019 Yapp. All rights reserved.
//

import UIKit

///모든 뷰 컨트롤러는 GestureViewController를 상속받음.
class GestureViewController: UIViewController {

///viewwillAppear 호출시 꼭 super 넣어줄것
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

//스와이프제스쳐로 뒤로가기 허용
navigationController?.interactivePopGestureRecognizer?.delegate = nil
}

}
34 changes: 34 additions & 0 deletions Toonie/Common/Network/API+Base.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// API+Base.swift
// Toonie
//
// Created by 양어진 on 23/03/2019.
// Copyright © 2019 Yapp. All rights reserved.
//

import Foundation
/*
API의 기본 형태
Base URL과 JSONDecoder의 디코딩 전략 설정
*/
class API {
// static let baseURL = "http://192.168.1.223:8080"
// static let baseURL = "http://10.10.98.117:8080"
// static let baseURL = "http://192.168.0.3:8080"
static let baseURL = "http://eunbi6431.cafe24.com/Tooniee"

static let jsonDecoder: JSONDecoder = {
let jsonDecoder = JSONDecoder()
jsonDecoder.keyDecodingStrategy = .convertFromSnakeCase
return jsonDecoder
}()

static let token: String = {
return baseURL + "/token"
}()

static let keywords: String = {
return baseURL + "/keywords"
}()

}
14 changes: 14 additions & 0 deletions Toonie/Common/Network/Model/Keywords.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// File.swift
// Toonie
//
// Created by 박은비 on 31/03/2019.
// Copyright © 2019 Yapp. All rights reserved.
//

import Foundation
struct Keywords: Codable {
let success: Bool?
let keywords: [String]?
}

13 changes: 13 additions & 0 deletions Toonie/Common/Network/Model/Token.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// Token.swift
// Toonie
//
// Created by 양어진 on 23/03/2019.
// Copyright © 2019 Yapp. All rights reserved.
//

import Foundation
struct Token: Codable {
let success: Bool?
let token: String?
}
15 changes: 15 additions & 0 deletions Toonie/Common/Network/NetworkResult.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// NetworkResult.swift
// Toonie
//
// Created by 양어진 on 30/03/2019.
// Copyright © 2019 Yapp. All rights reserved.
//

import Foundation

enum NetworkResult<T> {
case networkSuccess(T)
case networkError((resCode : Int, msg : String))
case networkFail
}
56 changes: 56 additions & 0 deletions Toonie/Common/Network/Requestable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//
// Requestable.swift
// Toonie
//
// Created by 양어진 on 30/03/2019.
// Copyright © 2019 Yapp. All rights reserved.
//

import Foundation
import Alamofire

protocol Requestable {
associatedtype NetworkData: Codable
typealias NetworkSuccessResult = (resCode: Int, resResult: NetworkData)
func get(_ URL: String,
params: Parameters?,
completion: @escaping (NetworkResult<NetworkSuccessResult>) -> Void)
}

extension Requestable {

func get(_ URL: String,
params: Parameters? = nil,
completion: @escaping (NetworkResult<NetworkSuccessResult>) -> Void) {
guard let encodedUrl = URL.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) else {
print("networking - invalid url")
return
}

Alamofire.request(encodedUrl,
method: .get,
parameters: nil).responseData { (res) in
switch res.result {
case .success :
if let value = res.result.value {
let decoder = JSONDecoder()
do {
let resCode = res.response?.statusCode
let datas = try decoder.decode(NetworkData.self, from: value)
let result: NetworkSuccessResult = (resCode!, datas)
completion(.networkSuccess(result))
} catch {
print("Decoding Err")
}
}
case .failure(let err) :
if let error = err as NSError?, error.code == -1009 {
completion(.networkFail)
} else {
let resCode = res.response?.statusCode ?? 0
completion(.networkError((resCode, err.localizedDescription)))
}
}
}
}
}
21 changes: 21 additions & 0 deletions Toonie/Common/Network/Service/Service.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Foundation

struct TokenService : Requestable {
typealias NetworkData = Token
static let shareInstance = TokenService()

func getToken(url : String, params : [String : Any]? = nil, completion : @escaping (NetworkResult<Any>) -> Void) {
get(url, params: params) { (result) in

switch result {
case .networkSuccess(let successResult):
// let nextPageLink = getNextPage(linkHeader: successResult.resHeader?["Link"] as? String)
completion(.networkSuccess((successResult.resResult)))
case .networkError(let errResult):
completion(.networkError((errResult.resCode, errResult.msg)))
case .networkFail:
completion(.networkFail)
}
}
}
}
80 changes: 80 additions & 0 deletions Toonie/Detail/Controller/DetailViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
//
// DetailViewController.swift
// Toonie
//
// Created by 이재은 on 30/03/2019.
// Copyright © 2019 Yapp. All rights reserved.
//

import UIKit

// 인스타툰 상세 화면
final class DetailToonViewController: GestureViewController {

// MARK: - IBOutlets

@IBOutlet private weak var detailToonImageView: UIImageView!
@IBOutlet private weak var detailToonIdLabel: UILabel!
@IBOutlet private weak var authorLabel: UILabel!
@IBOutlet private weak var descriptionLabel: UILabel!
@IBOutlet private weak var postCountLabel: UILabel!
@IBOutlet private weak var followerNumberLabel: UILabel!
@IBOutlet private weak var mainKeywordLabel: UILabel!
@IBOutlet private weak var subKeywordLabel: UILabel!

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)

}

override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
subKeywordLabel?.text = ""

}

// MARK: - IBActions
@IBAction func backButtonDidTap(_ sender: UIButton) {
self.navigationController?.popViewController(animated: true)
}

/// 공유 액션시트
@IBAction func moreButtonDidTap(_ sender: UIButton) {
UIAlertController
.alert(title: nil, message: nil, style: .actionSheet)
.action(title: "KakaoTalk에 공유", style: .default) { _ in
print("dd")
}
.action(title: "Messager에 공유", style: .default) { _ in
print("dd")
}
.action(title: "링크 복사", style: .default) { _ in
print("dd")
}
.action(title: "이 작품 더이상 추천 받지 않기", style: .destructive) { _ in
print("dd")
}
.action(title: "취소", style: .cancel) { _ in
print("dd")
}
.present(to: self)

}

@IBAction func moveToonButtonDidTap(_ sender: UIButton) {

}

@IBAction func addToMyCollection(_ sender: UIButton) {
}

// MARK: - Life Cycle

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}

// MARK: - Functions

}
Loading

0 comments on commit 8f7d19b

Please sign in to comment.