Skip to content

Commit

Permalink
Merge branch 'suyeon' into feat/#358-editReadyInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaybei authored Sep 4, 2024
2 parents bff013b + 084491e commit 3a329df
Show file tree
Hide file tree
Showing 20 changed files with 199 additions and 162 deletions.
7 changes: 0 additions & 7 deletions KkuMulKum.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1213,13 +1213,6 @@
path = Tardy;
sourceTree = "<group>";
};
DD9F59642C7C7E3B00E928DF /* Recovered References */ = {
isa = PBXGroup;
children = (
);
name = "Recovered References";
sourceTree = "<group>";
};
DD9F59652C7C7E5C00E928DF /* Cell */ = {
isa = PBXGroup;
children = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
Expand All @@ -49,6 +49,13 @@
ReferencedContainer = "container:KkuMulKum.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<EnvironmentVariables>
<EnvironmentVariable
key = "IDEPreferLogStreaming"
value = "YES"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
25 changes: 8 additions & 17 deletions KkuMulKum/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import UIKit

import KakaoSDKCommon
import KakaoSDKAuth
import Firebase
Expand All @@ -19,30 +20,20 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {

UNUserNotificationCenter.current().delegate = LocalNotificationManager.shared

// KakaoSDK 초기화 과정에서 앱 키를 동적으로 불러오기
if let kakaoAppKey = fetchKakaoAppKeyFromPrivacyInfo() {
KakaoSDK.initSDK(appKey: kakaoAppKey)
// KakaoSDK 초기화
if let kakaoAppKey = Bundle.main.privacyInfo?["NATIVE_APP_KEY"] as? String {
KakaoSDK.initSDK(appKey: kakaoAppKey, loggingEnable: true)
print("Kakao SDK initialized with app key: \(kakaoAppKey)")
} else {
print("Failed to load KAKAO_APP_KEY from PrivacyInfo.plist")
}

setupFirebase(application: application)

return true
}

func fetchKakaoAppKeyFromPrivacyInfo() -> String? {
guard let path = Bundle.main.path(forResource: "PrivacyInfo", ofType: "plist"),
let dict = NSDictionary(contentsOfFile: path) as? [String: AnyObject],
let appKey = dict["NATIVE_APP_KEY"] as? String else {
return nil
}
return appKey
}

// 카카오 로그인

// 카카오 로그인 URL 처리 (중복 제거)
func application(
_ app: UIApplication,
open url: URL,
Expand Down Expand Up @@ -117,7 +108,7 @@ extension AppDelegate: MessagingDelegate, UNUserNotificationCenterDelegate {
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
Messaging.messaging().apnsToken = deviceToken

Messaging.messaging().token { [weak self] token, error in
Messaging.messaging().token { token, error in
if let error = error {
print("Error fetching FCM registration token: \(error)")
} else if let token = token {
Expand Down
8 changes: 4 additions & 4 deletions KkuMulKum/Application/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
}

func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
if let url = URLContexts.first?.url {
if (AuthApi.isKakaoTalkLoginUrl(url)) {
_ = AuthController.handleOpenUrl(url: url)
if let url = URLContexts.first?.url {
if (AuthApi.isKakaoTalkLoginUrl(url)) {
_ = AuthController.handleOpenUrl(url: url)
}
}
}
}

func application(
_ app: UIApplication,
Expand Down
20 changes: 20 additions & 0 deletions KkuMulKum/Resource/Extension/UIButton+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,24 @@ extension UIButton {
)
setAttributedTitle(attributedString, for: .normal)
}

func addUnderlineWithMyPage(
textColor: UIColor,
underlineColor: UIColor = .gray2,
spacing: CGFloat = 12
) {
let font = UIFont.pretendard(.body05)
let underlineStyle = NSUnderlineStyle.single

let attributes: [NSAttributedString.Key: Any] = [
.font: font,
.foregroundColor: textColor,
.underlineStyle: underlineStyle.rawValue,
.underlineColor: underlineColor,
.baselineOffset: spacing / 2
]

let attributedString = NSMutableAttributedString(string: self.titleLabel?.text ?? "", attributes: attributes)
setAttributedTitle(attributedString, for: .normal)
}
}
2 changes: 2 additions & 0 deletions KkuMulKum/Resource/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPhotoLibraryUsageDescription</key>
<string>꾸물꿈은 카메라 권한을 필요로 합니다. 카메라를 통해 자신의 프로필을 즉시 찍어 업로드할 수 있습니다. 허용 안함 시 일부 기능이 동작하지 않을 수 있습니다.</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand Down
6 changes: 3 additions & 3 deletions KkuMulKum/Source/Home/ViewController/HomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ private extension HomeViewController {
setProgressButton(rootView.todayPromiseView.moveButton)
setEnableButton(rootView.todayPromiseView.arriveButton)

rootView.todayPromiseView.prepareButton.setTitle("준비 ", style: .body05, color: .white)
rootView.todayPromiseView.prepareButton.setTitle("준비 완료", style: .body05, color: .white)
rootView.todayPromiseView.moveButton.setTitle("이동 중", style: .body05, color: .maincolor)
rootView.todayPromiseView.arriveButton.setTitle("도착 완료", style: .body05, color: .maincolor)

Expand Down Expand Up @@ -487,8 +487,8 @@ private extension HomeViewController {
setCompleteButton(rootView.todayPromiseView.moveButton)
setCompleteButton(rootView.todayPromiseView.arriveButton)

rootView.todayPromiseView.prepareButton.setTitle("준비 ", style: .body05, color: .white)
rootView.todayPromiseView.moveButton.setTitle("이동 ", style: .body05, color: .white)
rootView.todayPromiseView.prepareButton.setTitle("준비 완료", style: .body05, color: .white)
rootView.todayPromiseView.moveButton.setTitle("이동 완료", style: .body05, color: .white)
rootView.todayPromiseView.arriveButton.setTitle("도착 완료", style: .body05, color: .white)

rootView.todayPromiseView.prepareButton.isEnabled = false
Expand Down
7 changes: 7 additions & 0 deletions KkuMulKum/Source/MeetingInfo/Cell/MeetingMemberCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ final class MeetingMemberCell: BaseCollectionViewCell {
super.prepareForReuse()

profileImageButton.do {
var config = UIButton.Configuration.plain()
config.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 0)

$0.imageView?.image = nil
$0.backgroundColor = .clear
$0.isEnabled = false
Expand Down Expand Up @@ -89,6 +92,10 @@ private extension MeetingMemberCell {
self.delegate = delegate

profileImageButton.do {
var config = UIButton.Configuration.plain()
config.contentInsets = NSDirectionalEdgeInsets(top: 5, leading: 0, bottom: 0, trailing: 0)

$0.configuration = config
$0.backgroundColor = .gray1
$0.setImage(.iconPlus.withTintColor(.gray4), for: .normal)
$0.isEnabled = true
Expand Down
25 changes: 16 additions & 9 deletions KkuMulKum/Source/MeetingInfo/View/MeetingInfoBannerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ final class MeetingInfoBannerView: BaseView {
$0.setText("모임 생성일", style: .label01, color: .gray4)
}

private let divider = UIView(backgroundColor: .gray4)
private let divider = UILabel().then {
$0.setText("l", style: .label01, color: .gray4)
}

private let createdAtLabel = UILabel().then {
$0.setText("2024.06.01", style: .label01, color: .gray4)
Expand All @@ -40,24 +42,29 @@ final class MeetingInfoBannerView: BaseView {
backgroundColor = .lightGreen
layer.cornerRadius = 8

horizontalStackView.addArrangedSubviews(explanationLabel, divider, createdAtLabel)
backgroundImageView.addSubviews(horizontalStackView, metCountLabel)
backgroundImageView.addSubviews(explanationLabel, divider, createdAtLabel, metCountLabel)
addSubviews(backgroundImageView)
}

override func setupAutoLayout() {
explanationLabel.snp.makeConstraints {
$0.top.equalToSuperview().offset(20)
$0.leading.equalToSuperview().offset(16)
}

divider.snp.makeConstraints {
$0.width.equalTo(1)
$0.leading.equalTo(explanationLabel.snp.trailing).offset(12)
$0.centerY.equalTo(explanationLabel)
}

horizontalStackView.snp.makeConstraints {
$0.top.equalToSuperview().offset(20)
$0.leading.equalToSuperview().offset(16)
createdAtLabel.snp.makeConstraints {
$0.leading.equalTo(divider.snp.trailing).offset(12)
$0.centerY.equalTo(explanationLabel)
}

metCountLabel.snp.makeConstraints {
$0.top.equalTo(horizontalStackView.snp.bottom).offset(2)
$0.leading.equalTo(horizontalStackView)
$0.top.equalTo(explanationLabel.snp.bottom).offset(2)
$0.leading.equalTo(explanationLabel)
$0.bottom.equalToSuperview().offset(-20)
}

Expand Down
13 changes: 1 addition & 12 deletions KkuMulKum/Source/MeetingInfo/View/MeetingInfoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ final class MeetingInfoView: BaseView {
$0.setText("모임 참여 인원 0명", style: .body01, color: .gray8)
}

private let arrowButton = UIButton().then {
let image = UIImage(resource: .iconRight).withTintColor(.gray4)
$0.setImage(image, for: .normal)
$0.contentMode = .scaleAspectFill
}

private let createPromiseButton = UIButton(backgroundColor: .maincolor).then {
$0.setTitle("+ 약속추가", style: .body01, color: .white)
$0.layer.cornerRadius = Screen.height(52) / 2
Expand Down Expand Up @@ -102,7 +96,7 @@ final class MeetingInfoView: BaseView {
)
emptyDescriptionView.addSubviews(emptyDescriptionLabel)
addSubviews(
infoBanner, memberCountLabel, arrowButton, memberListView, createPromiseButton,
infoBanner, memberCountLabel, memberListView, createPromiseButton,
grayBackgroundView
)
bringSubviewToFront(createPromiseButton)
Expand All @@ -121,11 +115,6 @@ final class MeetingInfoView: BaseView {
$0.leading.equalTo(infoBanner)
}

arrowButton.snp.makeConstraints {
$0.trailing.equalToSuperview().offset(-20)
$0.centerY.equalTo(memberCountLabel)
}

memberListView.snp.makeConstraints {
$0.top.equalTo(memberCountLabel.snp.bottom).offset(20)
$0.horizontalEdges.equalToSuperview()
Expand Down
30 changes: 28 additions & 2 deletions KkuMulKum/Source/MeetingInfo/ViewModel/MeetingInfoViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,33 @@ extension MeetingInfoViewModel: ViewModelType {
}
.disposed(by: disposeBag)

let info = infoRelay.asDriver(onErrorJustReturn: nil)
let info = infoRelay
.map { info -> MeetingInfoModel? in
guard let info else {
print("MeetingInfoModel이 존재하지 않습니다.")
return nil
}

let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"

guard let date = dateFormatter.date(from: info.createdAt) else {
print("서버의 date가 형식에 맞지 않습니다.")
return nil
}

dateFormatter.dateFormat = "yyyy.MM.dd"
let dateString = dateFormatter.string(from: date)

return MeetingInfoModel(
meetingID: info.meetingID,
name: info.name,
createdAt: dateString,
metCount: info.metCount,
invitationCode: info.invitationCode
)
}
.asDriver(onErrorJustReturn: nil)

let memberCount = meetingMemberModelRelay
.compactMap { $0?.memberCount }
Expand Down Expand Up @@ -218,7 +244,7 @@ private extension MeetingInfoViewModel {
if 0 < dDay {
return ("+\(dDay)", .past)
} else if 0 == dDay {
return ("-Day", .today)
return ("-DAY", .today)
} else {
return ("\(dDay)", .future)
}
Expand Down
4 changes: 2 additions & 2 deletions KkuMulKum/Source/MyPage/View/MyPageEditView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class MyPageEditView: BaseView {
}

let skipButton = UIButton().then {
$0.setTitle("기본 프로필로 설정", style: .body03, color: .gray5)
$0.addUnderline()
$0.setTitle("기본 프로필로 설정", style: .body05, color: .gray5)
$0.addUnderlineWithMyPage(textColor: .gray5, underlineColor: .gray2)
}

let confirmButton = UIButton().then {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@ class MyPageViewController: BaseViewController, CustomActionSheetDelegate {

private func updateUI(with userInfo: LoginUserModel?) {
guard let userInfo = userInfo else { return }
let levelText = viewModel.getLevelText(for: userInfo.level)

rootView.contentView.nameLabel.text = userInfo.name ?? "꾸물리안 님"
rootView.contentView.levelLabel.setText("Lv. \(userInfo.level) 지각대장 꾸물이", style: .body05, color: .white)
rootView.contentView.nameLabel.text = (userInfo.name.map { $0 + "" }) ?? "꾸물리안 님"
rootView.contentView.levelLabel.setText("Lv. \(userInfo.level) \(levelText)", style: .body05, color: .white)
rootView.contentView.levelLabel.setHighlightText("Lv. \(userInfo.level)", style: .body05, color: .lightGreen)

updateProfileImage(with: userInfo.profileImageURL)
Expand Down Expand Up @@ -215,8 +216,10 @@ class MyPageViewController: BaseViewController, CustomActionSheetDelegate {
KingfisherManager.shared.cache.clearDiskCache()
})
.disposed(by: disposeBag)

navigationController?.pushViewController(editProfileViewController, animated: true)

editProfileViewController.hidesBottomBarWhenPushed = true

navigationController?.pushViewController(editProfileViewController, animated: true)
}

private func pushAskViewController() {
Expand Down
15 changes: 15 additions & 0 deletions KkuMulKum/Source/MyPage/ViewModel/MyPageViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,21 @@ class MyPageViewModel: NSObject {
.asSignal(onErrorJustReturn: ())
}

func getLevelText(for level: Int) -> String {
switch level {
case 1:
return "빼꼼 꾸물이"
case 2:
return "망기적 꾸물이"
case 3:
return "기적 꾸물이"
case 4:
return "꾸물꿈"
default:
return "꾸물리안 님"
}
}

func fetchUserInfo() {
Task {
do {
Expand Down
Loading

0 comments on commit 3a329df

Please sign in to comment.