Skip to content

Commit

Permalink
Merge pull request #20 from KakaoTocs/develop_1.0.6
Browse files Browse the repository at this point in the history
Develop 1.0.6
  • Loading branch information
KakaoTocs authored Dec 10, 2021
2 parents d90d57a + 8b4aa2a commit 93e3770
Show file tree
Hide file tree
Showing 46 changed files with 2,257 additions and 116 deletions.
140 changes: 136 additions & 4 deletions BMDJ.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
"repositoryURL": "https://github.com/firebase/firebase-ios-sdk.git",
"state": {
"branch": null,
"revision": "b8e974d8863536e93c1dd3ea65477a65d671847e",
"version": "8.5.0"
"revision": "38d4f0c634b0b01f02f087943723d801de4544f7",
"version": "8.6.1"
}
},
{
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,33 @@
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "46870C40-224E-448A-85BE-BDCD0D57585F"
uuid = "6AE586AD-DDA7-40FD-B05A-903B2A7CA68E"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "BMDJ/Reactor/HomeViewReactor.swift"
filePath = "BMDJ/ViewController/LoginViewController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "219"
endingLineNumber = "219"
landmarkName = "unknown"
landmarkType = "0">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "B04CDFAE-9FA6-4FCD-92B7-577123CADFC7"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "BMDJ/ViewController/LoginViewController.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "213"
endingLineNumber = "213"
landmarkName = "reduce(state:mutation:)"
landmarkType = "7">
landmarkName = "unknown"
landmarkType = "0">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
Expand Down
Binary file modified BMDJ/.DS_Store
Binary file not shown.
11 changes: 10 additions & 1 deletion BMDJ/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import UIKit

import Firebase
import GoogleSignIn

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
Expand Down Expand Up @@ -42,9 +43,17 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
} else {
window?.rootViewController = loginVC
}

#if DEBUG
UserHabit.sessionStart("dev_4289ca4293b33fdaaa7ab19af85c28b29f732dca", withAutoTracking: true)
#else
UserHabit.sessionStart("4289ca4293b33fdaaa7ab19af85c28b29f732dca", withAutoTracking: true)
#endif
return true
}

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return GIDSignIn.sharedInstance.handle(url)
}
}

extension AppDelegate: UNUserNotificationCenterDelegate {
Expand Down
Binary file modified BMDJ/Assets.xcassets/.DS_Store
Binary file not shown.
23 changes: 23 additions & 0 deletions BMDJ/Assets.xcassets/moreIc.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"scale" : "1x",
"idiom" : "universal",
"filename" : "moreIc.png"
},
{
"scale" : "2x",
"idiom" : "universal",
"filename" : "[email protected]"
},
{
"scale" : "3x",
"idiom" : "universal",
"filename" : "[email protected]"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file added BMDJ/Assets.xcassets/moreIc.imageset/moreIc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions BMDJ/Model/Memo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ struct Memo: Codable, Equatable {
case danjiID = "danjiId"
}

public static func ==(lhs: Memo, rhs: Memo) -> Bool {
return lhs.id == rhs.id
}

static func empty(danjiID: String) -> Memo {
return .init(id: UUID().uuidString, danjiID: danjiID, mood: .nomal, imageURLString: "https://firebasestorage.googleapis.com/v0/b/bmdj-1627404676793.appspot.com/o/Mock%2FEmptyImage.png?alt=media&token=5265397c-d9e6-4d54-929f-321e0c5e9c92", text: "올려주신 메모가 없습니다.\n메모를 작성해 보세요 :)", createDate: Int(Date().timeIntervalSince1970 * 1000))
}
Expand Down
16 changes: 11 additions & 5 deletions BMDJ/Network/Memo/MemoClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,18 @@ final class MemoClient {
.map { $0.data }
}

func update() {

func update(memo: Memo) -> Observable<Bool> {
return RxAlamofire.upload(multipartFormData: { formData in
if let text = memo.text.data(using: .utf8) {
formData.append(text, withName: "text")
}
}, urlRequest: MemoRouter.update(id: memo.id, text: memo.text))
.map { _ in true }
}

func delete() {

func delete(memo: Memo) -> Observable<Bool> {
return RxAlamofire.request(MemoRouter.delete(id: memo.id))
.validate(statusCode: 200..<300)
.map { _ in true }
}

}
28 changes: 3 additions & 25 deletions BMDJ/Network/Memo/MemoRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Alamofire
enum MemoRouter: URLRequestConvertible {
case all(danjiID: String)
case add(memoCreate: MemoCreate)
case update(id: String)
case update(id: String, text: String)
case delete(id: String)

private var baseURL: String {
Expand Down Expand Up @@ -41,37 +41,15 @@ enum MemoRouter: URLRequestConvertible {
return "/memos?danjiId=\(id)"
case .add:
return "/memo"
case .update(let id):
return "memo/\(id)"
case .update(let id, _):
return "/memo/\(id)"
case .delete(let id):
return "/memo/\(id)"
}
}

var body: Data? {
switch self {
// case .add(let memo):
// let params = [
// "mood": memo.mood.rawValue,
// "text": memo.text,
// "danjiId": memo.danjiId
// ]
// var strings: [String] = []
// for (key, value) in params {
// strings.append(key + "=\(value)")
// }
// guard let data = strings.map({ String($0) }).joined(separator: "&").data(using: .utf8) else {
// return nil
// }
/*
if let image = memo.image,
let imageData = image.pngData() {
data.append("\r\n--\(memo.uuid)\r\n".data(using: .utf8)!)
data.append("Content-Disposition: form-data; name=\"image\"; filename=\"image\"\r\n".data(using: .utf8)!)
// data.append(imageData)
data.append("Content-Type: image/png\r\n\r\n".data(using: .utf8)!)
}*/
// return data
default:
return nil
}
Expand Down
3 changes: 3 additions & 0 deletions BMDJ/Reactor/DanjiSettingViewReactor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ final class DanjiSettingViewReactor: Reactor {
SettingSection(model: "서비스 약관", items: [
SettingTableCellReactor(state: .init(name: "개인정보 처리방침", value: nil, isSwitch: false))
]),
SettingSection(model: "라이센스 정보", items: [
SettingTableCellReactor(state: .init(name: "라이센스 목록", value: nil, isSwitch: false))
]),
SettingSection(model: "계정", items: [
SettingTableCellReactor(state: .init(name: "서비스 탈퇴", value: nil, isSwitch: false))
])
Expand Down
28 changes: 23 additions & 5 deletions BMDJ/Reactor/HomeViewReactor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ final class HomeViewReactor: Reactor {
case updateDanjiSectionItem(IndexPath, DanjiSection.Item)
case insertMemoSectionItem(IndexPath, MemoSection.Item)
case updateMemoSectionItem(IndexPath, MemoSection.Item)
case delete(Memo)
case update(Memo)
}

struct State {
Expand Down Expand Up @@ -158,10 +160,10 @@ final class HomeViewReactor: Reactor {
let reactor = MemoCollectionCellReactor(memo: memo, isGradient: false)
return .just(.insertMemoSectionItem(indexPath, reactor))

case let .update(memo):
guard let indexPath = self.memoIndexPath(forMemoID: memo.id, from: state) else { return .empty() }
let reactor = MemoCollectionCellReactor(memo: memo, isGradient: false)
return .just(.updateMemoSectionItem(indexPath, reactor))
// case let .update(memo):
// guard let indexPath = self.memoIndexPath(forMemoID: memo.id, from: state) else { return .empty() }
// let reactor = MemoCollectionCellReactor(memo: memo, isGradient: false)
// return .just(.updateMemoSectionItem(indexPath, reactor))
case .move:
return provider.memoRepository.fetchMemo()
.map { memos in
Expand All @@ -171,6 +173,10 @@ final class HomeViewReactor: Reactor {
}
case .refresh:
return .just(.removeEmpty)
case let .delete(memo):
return .just(.delete(memo))
case let .update(memo):
return .just(.update(memo))
}
}

Expand Down Expand Up @@ -232,6 +238,18 @@ final class HomeViewReactor: Reactor {
}
case let .fetchMemoSections(sections):
state.memoSections = sections
case let .delete(memo):
if let index = state.memoSections.first?.items.firstIndex(where: { $0.currentState.memoe.id == memo.id }),
var section = state.memoSections.first {
section.items.remove(at: index)
state.memoSections = [.init(model: (), items: section.items)]
}
case let .update(memo):
if let index = state.memoSections.first?.items.firstIndex(where: { $0.currentState.memoe.id == memo.id }),
var section = state.memoSections.first {
section.items[index] = .init(memo: memo, isGradient: false)
state.memoSections = [.init(model: (), items: section.items)]
}
default:
break
}
Expand Down Expand Up @@ -276,6 +294,6 @@ final class HomeViewReactor: Reactor {
if let memoReactors = currentState.memoSections.first?.items {
memos = memoReactors.map { $0.initialState.memoe }
}
return MemoListViewReactor(memos: memos)
return MemoListViewReactor(memos: memos, provider: provider)
}
}
24 changes: 24 additions & 0 deletions BMDJ/Reactor/LicenseDetailViewReactor.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// LicenseDetailViewReactor.swift
// BMDJ
//
// Created by 김진우 on 2021/09/05.
//

import Foundation

import ReactorKit

final class LicenseDetailViewReactor: Reactor {
typealias Action = NoAction

struct State {
let text: String
}

let initialState: State

init(text: String) {
self.initialState = .init(text: text)
}
}
Loading

0 comments on commit 93e3770

Please sign in to comment.