Skip to content

Commit

Permalink
Merge pull request #168 from YAPP-Github/feat/#167-qa-241207
Browse files Browse the repository at this point in the history
feat: 1.0.6๋ฒ ํƒ€ QA ๋ฐ˜์˜
  • Loading branch information
ShapeKim98 authored Dec 12, 2024
2 parents bfe5652 + 9384699 commit e843c11
Show file tree
Hide file tree
Showing 24 changed files with 236 additions and 201 deletions.
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
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

0 comments on commit e843c11

Please sign in to comment.