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

feat: 1.0.6베타 QA 반영 #168

Merged
merged 14 commits into from
Dec 12, 2024
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
8 changes: 4 additions & 4 deletions Projects/App/ShareExtension/Sources/ShareRootFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ struct ShareRootFeature {
func handleAsyncAction(_ action: Action.AsyncAction, state: inout State) -> Effect<Action> {
switch action {
case .URL_파싱_수행:
guard let item = state.context?.inputItems.first as? NSExtensionItem,
let itemProvider = item.attachments?.first else {
return .none
}
guard
let item = state.context?.inputItems.first as? NSExtensionItem,
let itemProvider = item.attachments?.first
else { return .none }

return .run { send in
var urlItem: (any NSSecureCoding)? = nil
Expand Down
3 changes: 2 additions & 1 deletion Projects/App/Sources/AppDelegate/AppDelegateFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public struct AppDelegateFeature {
let setting = await self.userNotifications.getNotificationSettings()
switch setting.authorizationStatus {
case .authorized, .notDetermined:
guard try await self.userNotifications.requestAuthorization([.alert, .sound])
guard
try await self.userNotifications.requestAuthorization([.alert, .sound])
else { return }
default: return
}
Expand Down
34 changes: 21 additions & 13 deletions Projects/App/Sources/MainTab/MainTabFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public struct MainTabFeature {
@Presents var contentDetail: ContentDetailFeature.State?
@Shared(.inMemory("SelectCategory")) var categoryId: Int?
@Shared(.inMemory("PushTapped")) var isPushTapped: Bool = false
var savedContentId: Int?
var categoryOfSavedContent: BaseCategoryItem?

public init() {
self.pokit = .init()
Expand Down Expand Up @@ -78,6 +78,7 @@ public struct MainTabFeature {
case 경고_띄움(BaseError)
case errorSheetPresented(Bool)
case 링크팝업_활성화(PokitLinkPopup.PopupType)
case 카테고리상세_이동(category: BaseCategoryItem)
}
public enum AsyncAction: Equatable {
case 공유받은_카테고리_조회(categoryId: Int)
Expand All @@ -98,7 +99,7 @@ public struct MainTabFeature {
switch action {
case .binding(\.linkPopup):
guard state.linkPopup == nil else { return .none }
state.savedContentId = nil
state.categoryOfSavedContent = nil
return .none
case .binding:
return .none
Expand Down Expand Up @@ -183,15 +184,15 @@ private extension MainTabFeature {
}
)
case .onOpenURL(url: let url):
guard let components = URLComponents(url: url, resolvingAgainstBaseURL: false) else {
return .none
}
guard
let components = URLComponents(url: url, resolvingAgainstBaseURL: false)
else { return .none }

let queryItems = components.queryItems ?? []
guard let categoryIdString = queryItems.first(where: { $0.name == "categoryId" })?.value,
let categoryId = Int(categoryIdString) else {
return .none
}
guard
let categoryIdString = queryItems.first(where: { $0.name == "categoryId" })?.value,
let categoryId = Int(categoryIdString)
else { return .none }

return .send(.async(.공유받은_카테고리_조회(categoryId: categoryId)))
case .경고_확인버튼_클릭:
Expand Down Expand Up @@ -222,7 +223,14 @@ private extension MainTabFeature {
case let .링크팝업_활성화(type):
state.linkPopup = type
return .none

case let .카테고리상세_이동(category):
if category.categoryName == "미분류" {
state.selectedTab = .pokit
state.path.removeAll()
return .send(.pokit(.delegate(.미분류_카테고리_활성화)))
}
state.path.append(.카테고리상세(.init(category: category)))
return .none
Comment on lines +226 to +233
Copy link
Contributor

@stealmh stealmh Dec 10, 2024

Choose a reason for hiding this comment

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

유저마다 미분류 id값이 다르다면 저희가 할 수 있는 최선은 Constants로 빼내는것이긴 한데 ...
단순 문자열로 비교는 좀 별로긴하네요 서버쪽에서 해결해줘야 할 것 같아요..😂

Copy link
Contributor Author

Choose a reason for hiding this comment

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

일단 어떻게 하면 좋을까여

Copy link
Contributor

Choose a reason for hiding this comment

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

일단 스테이..

default: return .none
}
}
Expand Down Expand Up @@ -259,9 +267,9 @@ private extension MainTabFeature {
return .send(.delegate(.링크추가하기))
case .success:
state.linkPopup = nil
state.contentDetail = .init(contentId: state.savedContentId)
state.savedContentId = nil
return .none
guard let category = state.categoryOfSavedContent else { return .none }
state.categoryOfSavedContent = nil
return .send(.inner(.카테고리상세_이동(category: category)))
case .error, .text, .warning, .none:
return .none
}
Expand Down
8 changes: 5 additions & 3 deletions Projects/App/Sources/MainTab/MainTabPath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,10 @@ public extension MainTabFeature {
case .contentDetail(.presented(.delegate(.즐겨찾기_갱신_완료))),
.contentDetail(.presented(.delegate(.컨텐츠_조회_완료))),
.contentDetail(.presented(.delegate(.컨텐츠_삭제_완료))):
guard let stackElementId = state.path.ids.last,
let lastPath = state.path.last else {
guard
let stackElementId = state.path.ids.last,
let lastPath = state.path.last
else {
switch state.selectedTab {
case .pokit:
return .send(.pokit(.delegate(.미분류_카테고리_컨텐츠_조회)))
Expand Down Expand Up @@ -175,7 +177,7 @@ public extension MainTabFeature {

/// - 링크추가 및 수정에서 저장하기 눌렀을 때
case let .path(.element(stackElementId, action: .링크추가및수정(.delegate(.저장하기_완료(contentId))))):
state.savedContentId = contentId
state.categoryOfSavedContent = contentId
state.path.removeLast()
switch state.path.last {
case .검색:
Expand Down
12 changes: 8 additions & 4 deletions Projects/CoreKit/Sources/CoreNetwork/TokenInterceptor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,20 @@ public final class TokenInterceptor: RequestInterceptor {
dueTo error: Error,
completion: @escaping (RetryResult) -> Void
) {
guard let response = request.task?.response as? HTTPURLResponse,
response.statusCode == 401 else {
guard
let response = request.task?.response as? HTTPURLResponse,
response.statusCode == 401
else {
completion(.doNotRetryWithError(error))
return
}

print("🚀 Retry: statusCode: \(response.statusCode)")

guard keychain.read(.accessToken) != nil,
let refreshToken = keychain.read(.refreshToken) else {
guard
keychain.read(.accessToken) != nil,
let refreshToken = keychain.read(.refreshToken)
else {
deleteAllToken()
completion(.doNotRetryWithError(error))
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ extension KakaoShareClient: DependencyKey {
buttons: [button]
)

guard ShareApi.isKakaoTalkSharingAvailable(),
let templateJsonData = try? SdkJSONEncoder.custom.encode(template),
let templateJsonObject = SdkUtils.toJsonObject(templateJsonData) else {
guard
ShareApi.isKakaoTalkSharingAvailable(),
let templateJsonData = try? SdkJSONEncoder.custom.encode(template),
let templateJsonObject = SdkUtils.toJsonObject(templateJsonData)
else {
/// 🚨 Error Case [1]: 카카오톡 미설치
guard let url = URL(string: "itms-apps://itunes.apple.com/app/id362057947"),
UIApplication.shared.canOpenURL(url) else {
return
}
guard
let url = URL(string: "itms-apps://itunes.apple.com/app/id362057947"),
UIApplication.shared.canOpenURL(url)
else { return }

UIApplication.shared.open(url, options: [:], completionHandler: nil)
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,28 @@ public final class AppleLoginController: NSObject, ASAuthorizationControllerDele
controller: ASAuthorizationController,
didCompleteWithAuthorization authorization: ASAuthorization
) {
guard let credential = authorization.credential as? ASAuthorizationAppleIDCredential else {
guard
let credential = authorization.credential as? ASAuthorizationAppleIDCredential
else {
continuation?.resume(throwing: SocialLoginError.invalidCredential)
continuation = nil
return
}


guard let tokenData = credential.identityToken,
let token = String(data: tokenData, encoding: .utf8) else {
guard
let tokenData = credential.identityToken,
let token = String(data: tokenData, encoding: .utf8)
else {
continuation?.resume(throwing: SocialLoginError.appleLoginError(.invalidIdentityToken))
continuation = nil
return
}

guard let authorizationCode = credential.authorizationCode,
let codeString = String(data: authorizationCode, encoding: .utf8) else {
guard
let authorizationCode = credential.authorizationCode,
let codeString = String(data: authorizationCode, encoding: .utf8)
else {
continuation?.resume(throwing: SocialLoginError.appleLoginError(.invalidAuthorizationCode))
continuation = nil
return
Expand Down
8 changes: 1 addition & 7 deletions Projects/DSKit/Sources/Components/PokitBadge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,14 @@ public struct PokitBadge: View {
.background {
RoundedRectangle(cornerRadius: 4, style: .continuous)
.fill(backgroundColor)
.overlay {
if state == .unRead {
RoundedRectangle(cornerRadius: 4, style: .continuous)
.stroke(.pokit(.border(.brand)), lineWidth: 1)
}
}
}
}

private var backgroundColor: Color {
switch self.state {
case .default, .small, .memo, .member: return .pokit(.bg(.primary))
case .unCategorized: return .pokit(.color(.grayScale(._50)))
case .unRead: return .pokit(.bg(.base))
case .unRead: return Color(red: 1, green: 0.95, blue: 0.92)
}
}

Expand Down
55 changes: 27 additions & 28 deletions Projects/DSKit/Sources/Components/PokitCalendar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,13 @@ public struct PokitCalendar: View {
let year = calendar.component(.year, from: date)
let month = calendar.component(.month, from: date)

guard let range = calendar.range(
of: .day,
in: .month,
for: date
) else {
return dates
}
guard
let range = calendar.range(
of: .day,
in: .month,
for: date
)
else { return dates }

dates = range.map { day in
var components = DateComponents()
Expand Down Expand Up @@ -255,13 +255,13 @@ public struct PokitCalendar: View {
return dates
}

guard let monthRange = calendar.range(
of: .day,
in: .month,
for: monthDate
) else {
return dates
}
guard
let monthRange = calendar.range(
of: .day,
in: .month,
for: monthDate
)
else { return dates }

let monthDays = Array(monthRange).suffix(firstWeekday - 1)

Expand Down Expand Up @@ -369,25 +369,24 @@ public struct PokitCalendar: View {
}

private func beforeButtonTapped() {
guard let date = calendar.date(
byAdding: .month,
value: -1,
to: currentDate
) else {
return
}
guard
let date = calendar.date(
byAdding: .month,
value: -1,
to: currentDate
) else { return }

self.page = formatter.string(from: date)
}

private func nextButtonTapped() {
guard let date = calendar.date(
byAdding: .month,
value: 1,
to: currentDate
) else {
return
}
guard
let date = calendar.date(
byAdding: .month,
value: 1,
to: currentDate
)
else { return }

self.page = formatter.string(from: date)
}
Expand Down
8 changes: 4 additions & 4 deletions Projects/DSKit/Sources/Components/PokitLinkCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,16 @@ public struct PokitLinkCard<Item: PokitLinkCardItem>: View {
let isUnCategorized = link.categoryName == "미분류"

HStack(spacing: 6) {
if let isRead = link.isRead, !isRead {
PokitBadge(state: .unRead)
}

PokitBadge(
state: isUnCategorized
? .unCategorized
: .default(link.categoryName)
)

if let isRead = link.isRead, !isRead {
PokitBadge(state: .unRead)
}

if let memo = link.memo, !memo.isEmpty {
PokitBadge(state: .memo)
}
Expand Down
18 changes: 10 additions & 8 deletions Projects/DSKit/Sources/Components/PokitLinkPreview.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import SwiftUI

import Util
import NukeUI

public struct PokitLinkPreview: View {
Expand All @@ -33,7 +34,6 @@ public struct PokitLinkPreview: View {
}
}


private var buttonLabel: some View {
HStack(spacing: 16) {
Group {
Expand All @@ -54,18 +54,13 @@ public struct PokitLinkPreview: View {
.background {
RoundedRectangle(cornerRadius: 12, style: .continuous)
.fill(.pokit(.bg(.base)))
.shadow(color: .black.opacity(0.06), radius: 3, x: 2, y: 2)
}
.overlay {
RoundedRectangle(cornerRadius: 12, style: .continuous)
.stroke(.pokit(.border(.tertiary)), lineWidth: 1)
}
.shadow(color: .black.opacity(0.06), radius: 3, x: 2, y: 2)
.onAppear {
withAnimation {
UINotificationFeedbackGenerator()
.notificationOccurred(.success)
}
}
.onChange(of: imageURL, perform: onChangeImageURL)
}

@MainActor
Expand Down Expand Up @@ -134,6 +129,13 @@ public struct PokitLinkPreview: View {
else { return }
openURL(url)
}

private func onChangeImageURL(_ imageURL: String?) {
guard imageURL != nil else { return }
let isError = title == Constants.제목을_입력해주세요_문구
UINotificationFeedbackGenerator()
.notificationOccurred(isError ? .error : .success)
}
}

#Preview {
Expand Down
2 changes: 1 addition & 1 deletion Projects/DSKit/Sources/Components/PokitList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public struct PokitList<Item: PokitSelectItem>: View {

Spacer()
}
.padding(.vertical, 18)
.padding(.vertical, 12)
.padding(.horizontal, 20)
.background {
if isSelected {
Expand Down
Loading
Loading