Skip to content

Commit

Permalink
[Chore] #319 - Conflict 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
EunsuSeo01 committed Dec 31, 2024
2 parents fa44118 + cb23b69 commit bf91d9e
Show file tree
Hide file tree
Showing 41 changed files with 1,232 additions and 363 deletions.
113 changes: 90 additions & 23 deletions Hankkijogbo/Hankkijogbo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "83f265caa107bd411a5b1166549c8ea62979fd689642172db418fac79f0298a8",
"originHash" : "ec45888e133ae9767d5888f71108bbada090fd616f4ec1a668477eeace7cbafd",
"pins" : [
{
"identity" : "alamofire",
Expand Down Expand Up @@ -28,6 +28,15 @@
"version" : "1.0.3"
}
},
{
"identity" : "kakao-ios-sdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/kakao/kakao-ios-sdk",
"state" : {
"branch" : "master",
"revision" : "ab4309c1950550add307046ad1e08024c7514603"
}
},
{
"identity" : "kingfisher",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -76,7 +85,7 @@
{
"identity" : "snapkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SnapKit/SnapKit",
"location" : "https://github.com/SnapKit/SnapKit.git",
"state" : {
"revision" : "2842e6e84e82eb9a8dac0100ca90d9444b0307f4",
"version" : "5.7.1"
Expand Down
4 changes: 3 additions & 1 deletion Hankkijogbo/Hankkijogbo/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
import UIKit

import Amplitude
import KakaoSDKCommon

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
Amplitude.instance().initializeApiKey(Config.Amplitude)
KakaoSDK.initSDK(appKey: Config.Kakao)
return true
}

Expand Down
83 changes: 79 additions & 4 deletions Hankkijogbo/Hankkijogbo/Application/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,15 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
guard let windowScene = (scene as? UIWindowScene) else { return }

window = UIWindow(windowScene: windowScene)
window?.rootViewController = SplashViewController()
window?.makeKeyAndVisible()

guard let urlContext = connectionOptions.urlContexts.first else {
window?.rootViewController = SplashViewController()
return
}

// 딥링크로 앱이 시작된 경우 처리합니다
handleDeeplink(urlContext.url)
}

func sceneDidDisconnect(_ scene: UIScene) {
Expand All @@ -36,6 +43,12 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
func sceneDidEnterBackground(_ scene: UIScene) {
}

func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
guard let urlContext = URLContexts.first else { return }

// 앱이 실행중일 때, 딥링크로 접속했을 경우 처리를 진행합니다.
handleDeeplink(urlContext.url)
}
}

private extension SceneDelegate {
Expand All @@ -44,9 +57,9 @@ private extension SceneDelegate {
func checkAppleAccountStatus() {
let appleIDProvider = ASAuthorizationAppleIDProvider()
let userId: String = UserDefaults.standard.getUserId()

if userId.isEmpty { return }

appleIDProvider.getCredentialState(forUserID: userId) { (credentialState, _) in
DispatchQueue.main.async {
switch credentialState {
Expand All @@ -61,16 +74,62 @@ private extension SceneDelegate {
}
}

// 서버에 사용자의 정보가 저장되어있는지 확인합니다.
/// 서버에 사용자의 정보가 저장되어있는지 확인합니다.
func checkServerAccountStatus() {
let accessToken: String = UserDefaults.standard.getAccesshToken()

if !accessToken.isEmpty {
getMe()
}
}

/// 딥링크로 앱이 시작된 경우, url 에 따라 view를 처리합니다
private func handleDeeplink(_ url: URL) {
guard url.scheme == "kakao\(Config.Kakao)" else { return }

switch url.host {
case "kakaolink":
let queryParameters: [String: String] = url.getQueryParameters()

switch Set(queryParameters.keys) {
case ["sharedZipId"]:
guard let zipId = Int(queryParameters["sharedZipId"] ?? "") else { print("❌ NO-EXISTENT DEEP LINK ❌ - ZIP ID IS ERROR"); return }
handleSharedZipDeeplink(zipId: zipId)

default:
print("❌ NO-EXISTENT DEEP LINK ❌ - NO PARAMETERS")
}
default:
print("❌ NO-EXISTENT DEEP LINK ❌")
}
}

/// 족보 공유의 딥링크를 이용한 경우, zipVC를 반환합니다.
private func handleSharedZipDeeplink(zipId: Int) {
if UserDefaults.standard.isLogin {
getZipOwnership(zipId: zipId)
} else {
presentZipDetails(zipId: zipId, isOwnership: false)
}
}

/// 공유받은 족보 상세 페이지로 이동
private func presentZipDetails(zipId: Int, isOwnership: Bool) {
let tabBarController = TabBarController()
tabBarController.selectedIndex = 2
let navigationController = HankkiNavigationController(rootViewController: tabBarController)

window?.rootViewController = navigationController

if isOwnership {
navigationController.pushViewController(ZipDetailViewController(zipId: zipId, type: .myZip), animated: false)
} else {
navigationController.pushViewController(ZipDetailViewController(zipId: zipId, type: .sharedZip), animated: false)
}
}
}

// MARK: - API
private extension SceneDelegate {
func getMe() {
NetworkService.shared.userService.getMe { result in
Expand Down Expand Up @@ -106,4 +165,20 @@ private extension SceneDelegate {
}
}
}

func getZipOwnership(zipId: Int) {
NetworkService.shared.zipService.getZipOwnership(zipId: zipId) { result in
switch result {
case .success(let response):
guard let isOwnership = response?.data.isOwner else { return }
self.presentZipDetails(zipId: zipId, isOwnership: isOwnership)

case .notFound:
fatalError("\(zipId)의 족보가 없습니다")

default:
fatalError("잘못된 접근입니다!")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ final class BottomButtonView: BaseView {
setupStyle()
}
}

let lineButtonText: String
let leftButtonText: String
let rightButtonText: String
Expand All @@ -28,6 +29,8 @@ final class BottomButtonView: BaseView {
var rightButtonHandler: ButtonAction?
var gradientColor: UIColor

var isPrimaryButtonAble: Bool = false

// MARK: - UI Properties

private let primaryButton: UIButton = UIButton()
Expand All @@ -49,7 +52,8 @@ final class BottomButtonView: BaseView {
lineButtonHandler: ButtonAction? = nil,
leftButtonHandler: ButtonAction? = nil,
rightButtonHandler: ButtonAction? = nil,
gradientColor: UIColor = .hankkiWhite
gradientColor: UIColor = .hankkiWhite,
isPrimaryButtonAble: Bool = false
) {
self.primaryButtonText = primaryButtonText
self.lineButtonText = lineButtonText
Expand All @@ -62,6 +66,10 @@ final class BottomButtonView: BaseView {
self.gradientColor = gradientColor
super.init(frame: frame)

if isPrimaryButtonAble {
self.setupEnabledDoneButton()
}

setupButtonAction()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// GrayLineView.swift
// Hankkijogbo
//
// Created by Gahyun Kim on 12/22/24.
//

import UIKit

import SnapKit

/// 색상과 높이를 동적으로 설정할 수 있는 Custom Line View
/// default : gray200, height 1
final class CustomLineView: UIView {

init(frame: CGRect = .zero, backgroundColor: UIColor = .gray200, height: Int = 1) {
super.init(frame: frame)

setupStyle(backgroundColor: backgroundColor)
setupLayout(height: height)
}

required init?(coder: NSCoder) {
super.init(coder: coder)

setupStyle(backgroundColor: .gray200)
setupLayout(height: 1)
}

override var intrinsicContentSize: CGSize {
return CGSize(width: UIView.noIntrinsicMetric, height: 1)
}
}

private extension CustomLineView {
func setupStyle(backgroundColor: UIColor) {
self.backgroundColor = backgroundColor
}

func setupLayout(height: Int) {
self.snp.makeConstraints {
$0.height.equalTo(height)
}
}
}
40 changes: 34 additions & 6 deletions Hankkijogbo/Hankkijogbo/Global/Consts/StringLiterals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import Foundation

// swiftlint:disable nesting
enum StringLiterals {

enum Kakao {
static let storeUrl = "itms-apps://itunes.apple.com/app/362057947"
static let zipShareTemplete = 115383
}

enum Common {
static let goToHome = "홈으로"
static let withdraw = "탈퇴하기"
Expand Down Expand Up @@ -65,6 +69,17 @@ enum StringLiterals {
static let primaryButton = "로그인하기"
}

enum NeedLoginToSharedZip {
static let title = "족보를 확인하려면\n로그인이 필요해요"
static let primaryButton = "로그인"
}

enum NeedOneMoreHankkiToShare {
static let title = "족보에 식당이 없어요\n식당 1개 이상 시에만 공유할 수 있어요"
static let secondaryButton = back
static let primaryButton = "둘러보기"
}

enum Logout {
static let title = "정말 로그아웃 하실 건가요?"
static let secondaryButton = Common.logout
Expand Down Expand Up @@ -130,6 +145,7 @@ enum StringLiterals {
static let deleteAlready = "이미 삭제된 식당입니다"
static let serverError = "오류가 발생했어요 다시 시도해주세요"
static let accessError = "로그인 유효기간이 만료되었어요 재로그인 해주세요"
static let addSharedZip = "족보가 추가되었습니다"
}

enum Toolbar {
Expand Down Expand Up @@ -257,9 +273,9 @@ enum StringLiterals {
}

enum Option {
static let Terms = "약관 및 정책"
static let OneonOne = "1:1 문의"
static let Logout = Common.logout
static let terms = "약관 및 정책"
static let oneOnOne = "1:1 문의"
static let logout = Common.logout
}

enum Header {
Expand Down Expand Up @@ -307,9 +323,21 @@ enum StringLiterals {
}
}

enum SharedZip {
static let zipShareDefaultImageURL = Config.DefaultHankkiImageURL

static let navigation = "공유받은 족보"
static let addButton = "내 족보에 추가하기"

static let viewTitle = "공유받은 족보의\n새로운 이름을 지어주세요"
static let viewDescription = "공유받은 족보는 내 마음대로 편집할 수 있어요!"
static let submitButton = "추가하기"
}

enum ExternalLink {
static let OneonOne = "https://tally.so/r/mO0oJY"
static let Terms = "https://fast-kilometer-dbf.notion.site/FAQ-bb4d74b681d14f4f91bbbcc829f6d023?pvs=4"
static let oneOnOne = "https://tally.so/r/mO0oJY"
static let terms = "https://fast-kilometer-dbf.notion.site/FAQ-bb4d74b681d14f4f91bbbcc829f6d023?pvs=4"
static let linkTree = "https://link.inpock.co.kr/hankkilink?fbclid=PAZXh0bgNhZW0CMTEAAabp7jPfQGVtGfHXOSEA-urXPNPbog0a0Rco43_a-zsdcxQOvFqVXQoqsXQ_aem_gyGO3bZoFAlf0tMF7QTqKg"
}

enum Onboarding {
Expand Down
18 changes: 18 additions & 0 deletions Hankkijogbo/Hankkijogbo/Global/Extensions/URL+.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// URL+.swift
// Hankkijogbo
//
// Created by 심서현 on 12/20/24.
//

import Foundation

extension URL {
// URL 의 쿼리 파라미터를 딕셔너리 객체로 변환한다.
func getQueryParameters() -> [String:String] {
var parameters: [String:String] = [:]
let components = URLComponents(url: self, resolvingAgainstBaseURL: false)
components?.queryItems?.forEach { parameters[$0.name] = $0.value }
return parameters
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "btn_heart.svg",
"filename" : "ic_heart.svg",
"idiom" : "universal"
}
],
Expand Down

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit bf91d9e

Please sign in to comment.