Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

로그인 - 온보딩 쪽 디자인 & 기능 완성 #91

Merged
merged 32 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3f522ff
refactor #87: 로그인 뷰 디자인 변경
enebin Aug 31, 2023
54d9dae
refactor #88: 개인정보 등록 뷰 디자인 변경
enebin Aug 31, 2023
2ce9cb2
refactor #87: 루트뷰 로직 개선
enebin Sep 1, 2023
873edaf
refactor #87: 루트뷰 로직 및 푸시토큰 등록 개선
enebin Sep 2, 2023
2a62396
refactor #87: 마이페이지 APi 호출 로직 개선
enebin Sep 2, 2023
8f2488f
refactor #87: 루트뷰 애니메이션 개선
enebin Sep 2, 2023
63c0c27
refactor #87: 햅틱 개선
enebin Sep 2, 2023
05dad48
fix #88: 닉네임 로직 버그 수정
enebin Sep 2, 2023
7f4977e
refactor #87: 약관 수정
enebin Sep 2, 2023
f499971
refactor #87: 카카오 로그인 세팅
enebin Sep 2, 2023
b3b93be
refactor #87: xcconfig 세팅
enebin Sep 2, 2023
e983ace
feature #89: 마이페이지에 포토/설정 버튼 추가
enebin Sep 2, 2023
a5a6e54
feature #89: 마이페이지에 설정 네비게이션 로직 추가
enebin Sep 2, 2023
1ad62f2
feature #89: 네비게이션 바 커스텀
enebin Sep 2, 2023
3ab0e46
fix #89: 홈 뷰 애니메이션 버그 수정
enebin Sep 3, 2023
3771f8a
fix #89: 웹뷰 헤더 토큰 추가
enebin Sep 3, 2023
0706617
fix #89: 스택 오버플로우 버그 수정
enebin Sep 3, 2023
07be2dd
feature #89: 루트뷰에서 로그아웃 액션 수신
enebin Sep 4, 2023
fa42493
refactor #89: 루트뷰를 스위치스토어로 변경
enebin Sep 4, 2023
c80e875
refactor #89: 백그라운드 블러 로직 변경
enebin Sep 4, 2023
e875ec1
Merge branch 'refactor/루트뷰-통한의-리팩토링' into feature/setting-view(#89)
enebin Sep 4, 2023
9197ccf
refactor #89: 파일 이름 변경
enebin Sep 4, 2023
9563edd
refactor #89: 액션 이름 변경
enebin Sep 4, 2023
88ddca0
feature #89: 푸시알림 관리를 위한 매니저 클래스 추가
enebin Sep 4, 2023
d0ae5d6
feature #89: 푸시알림 등록 로직 수정
enebin Sep 4, 2023
c5beda8
refactor #89: 설정 진입 네비게이션 로직 개선
enebin Sep 4, 2023
f133d2b
refactor #89: 코드 개선
enebin Sep 5, 2023
ea19516
refactor #89: 웹 뷰 로딩속도 개선
enebin Sep 5, 2023
6f15114
refactor #89: 홈에서 테스트 진입 UX 개선
enebin Sep 6, 2023
ae04e23
feature #89: 권한 관련 에러처리 및 `alert` 추가
enebin Sep 6, 2023
f750031
chore #89: 코드린트
enebin Sep 6, 2023
6662b61
Merge pull request #92 from Nexters/feature/setting-view(#89)
enebin Sep 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Encrypted/Secrets/GoogleService-Info.plist.encrypted
Binary file not shown.
Binary file modified Encrypted/XCConfig/App/DEV.xcconfig.encrypted
Binary file not shown.
2 changes: 1 addition & 1 deletion Encrypted/XCConfig/App/PROD.xcconfig.encrypted
Original file line number Diff line number Diff line change
@@ -1 +1 @@
�d��BJؠ���LH�8�v2c�����mH �"?^F1Xn�o^� |�т�2x>�SFgtmz \���Ԍ����uQ&=O��pV��fa�zuc)�!����wW�0+SXl>7{�mD@���Z�]��增�o�_{�Z���Ex�6 l}�5`������W����.?��h��o>Hˈ4��: SѢ����C^7L�
�d��BJؠ���LH�8�v2c�����mH �"?^F1Xn�o^� |�т�2x>�SFgtmz \���Ԍ����uQ&uD�0�p>y�����|/�N&UcŞ�;RV��$�H�K����X6W]�nu.����i}�D�ş?��~Jod >�w���R
Expand Down
17 changes: 15 additions & 2 deletions Plugins/EnvPlugin/ProjectDescriptionHelpers/InfoPlist.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,24 @@ public extension Project {
"CFBundleURLTypes": [
[
"CFBundleTypeRole": "Editor",
"CFBundleURLSchemes": ["keyme"]
"CFBundleURLSchemes": [
"keyme",
"kakao$(KAKAO_API_KEY)"
]
]
],
"API_BASE_URL": "$(API_BASE_URL)",
"UIUserInterfaceStyle": "Light"
"KAKAO_API_KEY": "$(KAKAO_API_KEY)",
"UIUserInterfaceStyle": "Light",
"NSAppTransportSecurity": [
"NSExceptionDomains": [
"api.keyme.space": [
"NSIncludesSubdomains": true,
"NSExceptionMinimumTLSVersion": "TLSv1.2",
],
]
],
"LSApplicationQueriesSchemes": ["kakaokompassauth", "kakaolink"]
]

static let baseUrlInfoPlist: [String: InfoPlist.Value] = [
Expand Down
1 change: 0 additions & 1 deletion Projects/Core/Sources/Example.swift

This file was deleted.

46 changes: 46 additions & 0 deletions Projects/Core/Sources/Utility/Function/TCA+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// TCA+.swift
// Core
//
// Created by Young Bin on 2023/09/03.
// Copyright © 2023 team.humanwave. All rights reserved.
//

import ComposableArchitecture

private final class Ref<T: Equatable>: Equatable {
var val: T
init(_ v: T) {
self.val = v
}

static func == (lhs: Ref<T>, rhs: Ref<T>) -> Bool {
lhs.val == rhs.val
}
}

/// 스택 오버플로우 방지용 래퍼
/// 참고: https://github.com/pointfreeco/swift-composable-architecture/discussions/488
@propertyWrapper
public struct Box<T: Equatable>: Equatable {
private var ref: Ref<T>

public init(_ x: T) {
self.ref = Ref(x)
}

public var wrappedValue: T {
get { ref.val }
set {
if !isKnownUniquelyReferenced(&ref) {
ref = Ref(newValue)
return
}
ref.val = newValue
}
}

public var projectedValue: Box<T> {
self
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ㅋㅋㅋㅋㅋㅋㅋㅋ 붕 기엽네 ㅋㅋㅋㅋㅋ

Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ public class HapticManager {
generator.impactOccurred()
}

/// 붕
public func boong() {
let generator = UIImpactFeedbackGenerator(style: .soft)
generator.prepare()
generator.impactOccurred()
}

/// 패턴 재생(패턴은 추후 협의 후 개발해서 추가)
public func playHapticPattern() {
do {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// TextFieldPlaceholder.swift
// Core
//
// Created by 이영빈 on 2023/08/31.
// Copyright © 2023 team.humanwave. All rights reserved.
//

import SwiftUI

public extension View {
func placeholder<Content: View>(
when shouldShow: Bool,
alignment: Alignment = .leading,
@ViewBuilder placeholder: () -> Content
) -> some View {
ZStack(alignment: alignment) {
placeholder().opacity(shouldShow ? 1 : 0)
self
}
}
}
68 changes: 68 additions & 0 deletions Projects/Core/Sources/Utility/UI/WebView/WebViewWarmUper.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// https://github.com/bernikovich/WebViewWarmUper
//
// Created by Timur Bernikovich on 07/03/2019.
// Copyright © 2019 Timur Bernikovich. All rights reserved.
//

import WebKit
import UIKit

public protocol WarmUpable {
func warmUp()
}

public class WarmUper<Object: WarmUpable> {

private let creationClosure: () -> Object
private var warmedUpObjects: [Object] = []
public var numberOfWamedUpObjects: Int = 2 {
didSet {
prepare()
}
}

public init(creationClosure: @escaping () -> Object) {
self.creationClosure = creationClosure
prepare()
}

public func prepare() {
while warmedUpObjects.count < numberOfWamedUpObjects {
let object = creationClosure()
object.warmUp()
warmedUpObjects.append(object)
}
}

private func createObjectAndWarmUp() -> Object {
let object = creationClosure()
object.warmUp()
return object
}

public func dequeue() -> Object {
let warmedUpObject: Object
if let object = warmedUpObjects.first {
warmedUpObjects.removeFirst()
warmedUpObject = object
} else {
warmedUpObject = createObjectAndWarmUp()
}
prepare()
return warmedUpObject
}

}

extension WKWebView: WarmUpable {
public func warmUp() {
loadHTMLString("", baseURL: nil)
}
}

public typealias WKWebViewWarmUper = WarmUper<WKWebView>
public extension WarmUper where Object == WKWebView {
static let shared = WKWebViewWarmUper(creationClosure: {
WKWebView(frame: .zero, configuration: WKWebViewConfiguration())
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "photo_export.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "setting.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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.
2 changes: 1 addition & 1 deletion Projects/DSKit/Sources/Lottie/KeymeLottie.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public struct KeymeLottieView: UIViewRepresentable {

lottieView.translatesAutoresizingMaskIntoConstraints = false
lottieView.loopMode = loopMode
lottieView.contentMode = .scaleToFill
lottieView.contentMode = .scaleAspectFill
lottieView.play(completion: { finished in
if finished {
completion?()
Expand Down
64 changes: 59 additions & 5 deletions Projects/Features/Sources/Home/KeymeTestHomeFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@
import ComposableArchitecture
import Domain
import Network
import Foundation

struct KeymeTestsHomeFeature: Reducer {
public struct KeymeTestsHomeFeature: Reducer {
@Dependency(\.keymeAPIManager) private var network

// 테스트를 아직 풀지 않았거나, 풀었거나 2가지 케이스만 존재
struct State: Equatable {
public struct State: Equatable {
@PresentationState var alertState: AlertState<Action.Alert>?
@PresentationState var testStartViewState: KeymeTestsStartFeature.State?
var authorizationToken: String? {
@Dependency(\.keymeAPIManager.authorizationToken) var authorizationToken
return authorizationToken
}
var view: View

struct View: Equatable {
Expand All @@ -28,15 +34,35 @@ struct KeymeTestsHomeFeature: Reducer {
}
}

enum Action {
public enum Action {
case requestLogout

case fetchDailyTests
case showTestStartView(testData: KeymeTestsModel)
case showErrorAlert(HomeFeatureError)

case alert(PresentationAction<Alert>)
case startTest(PresentationAction<KeymeTestsStartFeature.Action>)

enum View {}

public enum Alert: Equatable {
case error(HomeFeatureError)
}

public enum HomeFeatureError: LocalizedError {
case cannotGetAuthorizationInformation

public var errorDescription: String? {
switch self {
case .cannotGetAuthorizationInformation:
return "로그인 정보를 불러올 수 없습니다. 다시 로그인을 진행해주세요."
}
}
}
}

var body: some ReducerOf<Self> {
public var body: some ReducerOf<Self> {
Reduce { state, action in
switch action {
case .fetchDailyTests:
Expand All @@ -49,13 +75,41 @@ struct KeymeTestsHomeFeature: Reducer {

case .showTestStartView(let testData):
state.view.dailyTestId = testData.testId
state.testStartViewState = .init(nickname: state.view.nickname, testData: testData)
guard let authorizationToken = state.authorizationToken else {
return .send(.showErrorAlert(.cannotGetAuthorizationInformation))
}

state.testStartViewState = KeymeTestsStartFeature.State(
nickname: state.view.nickname,
testData: testData,
authorizationToken: authorizationToken)

case .showErrorAlert(let error):
if case .cannotGetAuthorizationInformation = error {
state.alertState = AlertState(
title: { TextState("에러 발생") },
actions: { ButtonState(
action: .error(.cannotGetAuthorizationInformation),
label: { TextState("닫기") }
) },
message: { TextState(error.localizedDescription) })
}
return .none

case .alert(.presented(.error(let error))):
if case .cannotGetAuthorizationInformation = error {
return .send(.requestLogout)
}
return .none

default:
break
}

return .none
}
.ifLet(\.$testStartViewState, action: /Action.startTest) {
KeymeTestsStartFeature()
}
}
}
7 changes: 6 additions & 1 deletion Projects/Features/Sources/Home/KeymeTestHomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ struct KeymeTestsHomeView: View {

init(store: StoreOf<KeymeTestsHomeFeature>) {
self.store = store
store.send(.fetchDailyTests)
}

var body: some View {
Expand All @@ -41,7 +40,13 @@ struct KeymeTestsHomeView: View {
// 결과 화면 표시도 생각

}
.onAppear {
if viewStore.dailyTestId == nil {
viewStore.send(.fetchDailyTests)
}
}
}
.alert(store: store.scope(state: \.$alertState, action: KeymeTestsHomeFeature.Action.alert))
}
}

Expand Down
Loading