Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public final class KeyChainService {
)
return .success(value)
} else {
Logger.log(
"Failed to fetched \(type.rawValue) from KeyChain",
category: .info
)
return .failure(KeyChainError.dataConversionError(message: "Failed to convert data to String."))
}
} else {
Expand Down Expand Up @@ -81,12 +85,15 @@ public final class KeyChainService {
let status = SecItemAdd(keyChainQuery, nil)
if status == errSecSuccess {
Logger.log(
"Successfully fetched \(type.rawValue) from KeyChain: \(value)",
"Successfully saved \(type.rawValue) from KeyChain",
category: .info

)
return .success(())
} else {
Logger.log(
"Faied to save \(type.rawValue) from KeyChain",
category: .info
)
return .failure(KeyChainError.unhandledError(status: status))
}
}
Expand All @@ -113,12 +120,16 @@ public final class KeyChainService {
)
return .success(())
} else {
Logger.log(
"Faied to deleted \(type.rawValue) from KeyChain",
category: .info
)
return .failure(KeyChainError.unhandledError(status: status))
}
}
}

public enum TokenType: String {
public enum TokenType: String, CaseIterable {
case accessToken // 액세스 토큰
case refreshToken // 리프레시 토큰
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public final class ProviderImpl: Provider {

// 만약 헤더에 새 토큰이 있으면 저장
if var accessToken = response.response?.allHeaderFields["Authorization"] as? String,
var refreshToken = response.response?.allHeaderFields["authorization-refresh"] as? String {
var refreshToken = response.response?.allHeaderFields["Authorization-refresh"] as? String {
accessToken = accessToken.replacingOccurrences(of: "Bearer ", with: "")
refreshToken = refreshToken.replacingOccurrences(of: "Bearer ", with: "")

Expand Down
31 changes: 16 additions & 15 deletions Poppool/DataLayer/Data/Data/Network/Service/AppleLoginService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,27 @@ import RxSwift

public final class AppleLoginService: NSObject, AuthServiceable {

public override init() { }
private var authorizationController: ASAuthorizationController?
private var authServiceResponse = PublishSubject<AuthServiceResponse>() // 사용자 자격 증명 정보를 방출할 subject

// 사용자 자격 증명 정보를 방출할 subject
private var authServiceResponse: PublishSubject<AuthServiceResponse> = .init()

func fetchUserCredential() -> Observable<AuthServiceResponse> {
performRequest()
return authServiceResponse
}

// Apple 인증 요청을 수행하는 함수
private func performRequest() {
private func makeAuthController() -> ASAuthorizationController {
let appleIDProvider = ASAuthorizationAppleIDProvider()
let request = appleIDProvider.createRequest()
request.requestedScopes = [.fullName, .email]

let authorizationController = ASAuthorizationController(authorizationRequests: [request])
authorizationController.delegate = self
authorizationController.presentationContextProvider = self
authorizationController.performRequests()
let controller = ASAuthorizationController(authorizationRequests: [request])
controller.delegate = self
controller.presentationContextProvider = self

return controller
}

func fetchUserCredential() -> Observable<AuthServiceResponse> {
authServiceResponse = PublishSubject<AuthServiceResponse>()
authorizationController = makeAuthController()
authorizationController?.performRequests()

return authServiceResponse
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public final class SignUpRepositoryImpl: SignUpRepository {
interestCategories: interests,
appleAuthorizationCode: appleAuthorizationCode)
)
print(endPoint)

return provider.request(with: endPoint, interceptor: TokenInterceptor())
}
}
2 changes: 2 additions & 0 deletions Poppool/Poppool.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Poppool/Resource/Info.plist;
INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO;
INFOPLIST_KEY_NSCameraUsageDescription = "사용자가 프로필 사진을 업로드하거나 댓글에 사진을 추가할 수 있도록 카메라를 사용합니다.";
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "사용자의 현재 위치를 기반으로 주변 게시글을 추천하는 데 사용됩니다.";
INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "사용자가 프로필 사진을 업로드하거나 댓글에 사진을 추가할 수 있도록 사진라이브러리에 접근합니다.";
Expand Down Expand Up @@ -491,6 +492,7 @@
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = Poppool/Resource/Info.plist;
INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO;
INFOPLIST_KEY_NSCameraUsageDescription = "사용자가 프로필 사진을 업로드하거나 댓글에 사진을 추가할 수 있도록 카메라를 사용합니다.";
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "사용자의 현재 위치를 기반으로 주변 게시글을 추천하는 데 사용됩니다.";
INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "사용자가 프로필 사진을 업로드하거나 댓글에 사진을 추가할 수 있도록 사진라이브러리에 접근합니다.";
Expand Down
18 changes: 7 additions & 11 deletions Poppool/Poppool/Resource/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand All @@ -22,8 +13,6 @@
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>250725.1554</string>
<key>KAKAO_AUTH_APP_KEY</key>
<string>${KAKAO_AUTH_APP_KEY}</string>
<key>LSApplicationQueriesSchemes</key>
Expand All @@ -38,6 +27,11 @@
</array>
<key>NAVER_MAP_CLIENT_ID</key>
<string>${NAVER_MAP_CLIENT_ID}</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>POPPOOL_API_KEY</key>
<string>${POPPOOL_API_KEY}</string>
<key>POPPOOL_BASE_URL</key>
Expand All @@ -61,5 +55,7 @@
</array>
</dict>
</dict>
<key>UIDesignRequiresCompatibility</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,11 @@ public class PPButton: UIButton {
) {
super.init(frame: .zero)

self.setTitleColor(buttonStyle.textColor, for: .normal)
self.setTitleColor(buttonStyle.disabledTextColor, for: .disabled)

self.setBackgroundColor(buttonStyle.backgroundColor, for: .normal)
self.setBackgroundColor(buttonStyle.disabledBackgroundColor, for: .disabled)

self.setText(to: text, with: fontStyle, for: .normal)
self.setText(to: disabledText, with: fontStyle, for: .disabled)
self.setText(to: text, with: fontStyle, color: buttonStyle.textColor, for: .normal)
self.setText(to: disabledText, with: fontStyle, color: buttonStyle.disabledTextColor, for: .disabled)

self.layer.cornerRadius = cornerRadius
self.clipsToBounds = true
Expand All @@ -90,7 +87,7 @@ public class PPButton: UIButton {
public init(
style: ButtonStyle,
text: String,
disabledText: String = "",
disabledText: String = " ",
font: UIFont? = .korFont(style: .medium, size: 16),
cornerRadius: CGFloat = 4
) {
Expand All @@ -103,14 +100,11 @@ public class PPButton: UIButton {
return
}

self.setTitleColor(style.textColor, for: .normal)
self.setTitleColor(style.disabledTextColor, for: .disabled)

self.setBackgroundColor(style.backgroundColor, for: .normal)
self.setBackgroundColor(style.disabledBackgroundColor, for: .disabled)

self.setText(to: text, with: PPFontStyle, for: .normal)
self.setText(to: disabledText, with: PPFontStyle, for: .disabled)
self.setText(to: text, with: PPFontStyle, color: style.textColor, for: .normal)
self.setText(to: disabledText, with: PPFontStyle, color: style.disabledTextColor, for: .disabled)

self.layer.cornerRadius = cornerRadius
self.clipsToBounds = true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import UIKit

import SnapKit
import Then

public final class PPUnderlinedTextButton: UIButton {

private let textColor: UIColor = .g1000
private let disabledTextColor: UIColor = .g300

private let UnderlineView = UIView().then {
$0.backgroundColor = .g1000
}

public init(
fontStyle: PPFontStyle = .KOm16,
text: String,
disabledText: String = ""
) {
super.init(frame: .zero)

self.setText(to: text, with: fontStyle, color: textColor, for: .normal)
self.setText(to: disabledText.isEmpty ? text : disabledText, with: fontStyle, color: disabledTextColor, for: .disabled)

self.addViews()
self.setupConstraints()
}

required init?(coder: NSCoder) {
fatalError("\(#file), \(#function) Error")
}

override public func layoutSubviews() {
super.layoutSubviews()

switch state {
case .normal:
UnderlineView.backgroundColor = textColor
case .disabled:
UnderlineView.backgroundColor = disabledTextColor
default: break
}
}
}

extension PPUnderlinedTextButton {
func addViews() {
[UnderlineView].forEach {
self.addSubview($0)
}
}

func setupConstraints() {
UnderlineView.snp.makeConstraints { make in
make.height.equalTo(1)
make.bottom.equalToSuperview()
make.horizontalEdges.equalToSuperview()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public extension UIButton {
func setText(
to text: String = " ",
with style: PPFontStyle,
color: UIColor = .g1000,
for controlState: UIControl.State = .normal
) {
let paragraphStyle = NSMutableParagraphStyle()
Expand All @@ -17,7 +18,8 @@ public extension UIButton {
attributes: [
.font: UIFont.PPFont(style: style),
.paragraphStyle: paragraphStyle,
.baselineOffset: style.baseLineOffset
.baselineOffset: style.baseLineOffset,
.foregroundColor: color
]
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ public extension UILabel {
self.attributedText = NSAttributedString(string: text ?? " ", attributes: attributes)
}

/// 기존 attributed 속성을 유지하면서 텍스트 컬러만 변경합니다.
func updateTextColor(to color: UIColor?) {
if let current = self.attributedText, current.length > 0 {
let mutable = NSMutableAttributedString(attributedString: current)
let fullRange = NSRange(location: 0, length: mutable.length)
mutable.addAttribute(.foregroundColor, value: color ?? .g1000, range: fullRange)
self.attributedText = mutable
} else {
self.textColor = color
}
}

/// Style이 포함된 텍스트를 적용합니다.
func setText(to text: String?, with style: PPFontStyle) {
let paragraphStyle = NSMutableParagraphStyle()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
05125B982DB626E3001342A2 /* ReactorKit in Frameworks */ = {isa = PBXBuildFile; productRef = 05125B972DB626E3001342A2 /* ReactorKit */; };
05125BA12DB6275C001342A2 /* PanModal in Frameworks */ = {isa = PBXBuildFile; productRef = 05125BA02DB6275C001342A2 /* PanModal */; };
051631302DC3D1FD00A6C0D1 /* DesignSystem.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0516312F2DC3D1FD00A6C0D1 /* DesignSystem.framework */; };
0520B78D2E7410BF009E4BF3 /* RxRelay in Frameworks */ = {isa = PBXBuildFile; productRef = 0520B78C2E7410BF009E4BF3 /* RxRelay */; };
0522C1E12DB67C8300B141FF /* RxSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 0522C1E02DB67C8300B141FF /* RxSwift */; };
055C24D72E28FC6200AD389C /* PresentationInterface.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05734C352DCDF6EC0093825D /* PresentationInterface.framework */; };
055C24E32E28FCA000AD389C /* DesignSystem.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0516312F2DC3D1FD00A6C0D1 /* DesignSystem.framework */; };
Expand Down Expand Up @@ -109,6 +110,7 @@
05BDD5CF2DB6770300C1E192 /* Lottie in Frameworks */,
08B2A35B2DB66B5A00E57EFA /* FloatingPanel in Frameworks */,
08B2A3612DB66BAB00E57EFA /* Then in Frameworks */,
0520B78D2E7410BF009E4BF3 /* RxRelay in Frameworks */,
05734C572DCDF9E80093825D /* NMapsMap in Frameworks */,
0522C1E12DB67C8300B141FF /* RxSwift in Frameworks */,
05C1D62E2DB53A8200508FFD /* Infrastructure.framework in Frameworks */,
Expand Down Expand Up @@ -264,6 +266,7 @@
05BDD5CE2DB6770300C1E192 /* Lottie */,
0522C1E02DB67C8300B141FF /* RxSwift */,
05734C562DCDF9E80093825D /* NMapsMap */,
0520B78C2E7410BF009E4BF3 /* RxRelay */,
);
productName = Presentation;
productReference = 058CC9042DB537960084221A /* Presentation.framework */;
Expand Down Expand Up @@ -894,6 +897,11 @@
package = 05125B9F2DB6275C001342A2 /* XCRemoteSwiftPackageReference "PanModal" */;
productName = PanModal;
};
0520B78C2E7410BF009E4BF3 /* RxRelay */ = {
isa = XCSwiftPackageProductDependency;
package = 05125B932DB62295001342A2 /* XCRemoteSwiftPackageReference "RxSwift" */;
productName = RxRelay;
};
0522C1E02DB67C8300B141FF /* RxSwift */ = {
isa = XCSwiftPackageProductDependency;
package = 05125B932DB62295001342A2 /* XCRemoteSwiftPackageReference "RxSwift" */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ final class MyPageReactor: Reactor {
UserDefaultService.Key.allCases
.filter { $0 != .lastLogin }
.forEach { self?.userDefaultService.delete(keyType: $0) }

@Dependency var keyChainService: KeyChainService
TokenType.allCases.forEach { keyChainService.deleteToken(type: $0) }
})
.andThen(Observable.just(.logout))
.catch { _ in Observable.empty() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ final class WithdrawlReasonReactor: Reactor {
keyChainService.deleteToken(type: .accessToken)
keyChainService.deleteToken(type: .refreshToken)
UserDefaultService.Key.allCases.forEach { userDefaultService.delete(keyType: $0) }
TokenType.allCases.forEach { keyChainService.deleteToken(type: $0) }

let nextController = WithdrawlCompleteController()
nextController.mainView.checkButton.rx.tap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,14 @@ extension SignUpCompleteController {
reactor.state
.withUnretained(self)
.subscribe { (owner, state) in
owner.mainView.nickNameLabel.updateText(to: state.nickName)

let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineHeightMultiple = 1.3
paragraphStyle.alignment = .center
owner.mainView.nickNameLabel.attributedText = NSMutableAttributedString(
string: state.nickName,
attributes: [NSAttributedString.Key.paragraphStyle: paragraphStyle]
)
let categoryString = state.categoryTitles.enumerated()
.map { "#\($0.element)" }

let categoryString = state.categoryTitles
.map { "#\($0)" }
.joined(separator: ", ")

let attributedText = NSMutableAttributedString(
Expand Down
Loading