Skip to content

Commit

Permalink
Merge pull request #169 from YAPP-Github/develop
Browse files Browse the repository at this point in the history
release 1.0.6
  • Loading branch information
ShapeKim98 authored Dec 18, 2024
2 parents b04f89b + 3261557 commit 436c173
Show file tree
Hide file tree
Showing 97 changed files with 1,975 additions and 1,421 deletions.
2 changes: 1 addition & 1 deletion Projects/App/Resources/Pokit-info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.5</string>
<string>1.0.6</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand Down
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
64 changes: 50 additions & 14 deletions Projects/App/Sources/MainTab/MainTabFeature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import FeaturePokit
import FeatureRemind
import FeatureContentDetail
import Domain
import DSKit
import Util
import CoreKit

Expand All @@ -28,7 +29,7 @@ public struct MainTabFeature {
public struct State: Equatable {
var selectedTab: MainTab = .pokit
var isBottomSheetPresented: Bool = false
var isLinkSheetPresented: Bool = false
var linkPopup: PokitLinkPopup.PopupType?
var isErrorSheetPresented: Bool = false
var link: String?

Expand All @@ -40,6 +41,7 @@ public struct MainTabFeature {
@Presents var contentDetail: ContentDetailFeature.State?
@Shared(.inMemory("SelectCategory")) var categoryId: Int?
@Shared(.inMemory("PushTapped")) var isPushTapped: Bool = false
var categoryOfSavedContent: BaseCategoryItem?

public init() {
self.pokit = .init()
Expand All @@ -64,7 +66,7 @@ public struct MainTabFeature {
public enum View: Equatable {
case addButtonTapped
case addSheetTypeSelected(TabAddSheetType)
case linkCopyButtonTapped
case 링크팝업_버튼_눌렀을때
case onAppear
case onOpenURL(url: URL)
case 경고_확인버튼_클릭
Expand All @@ -75,6 +77,8 @@ public struct MainTabFeature {
case 공유포킷_이동(sharedCategory: CategorySharing.SharedCategory)
case 경고_띄움(BaseError)
case errorSheetPresented(Bool)
case 링크팝업_활성화(PokitLinkPopup.PopupType)
case 카테고리상세_이동(category: BaseCategoryItem)
}
public enum AsyncAction: Equatable {
case 공유받은_카테고리_조회(categoryId: Int)
Expand All @@ -93,6 +97,10 @@ public struct MainTabFeature {
/// - Reducer Core
private func core(into state: inout State, action: Action) -> Effect<Action> {
switch action {
case .binding(\.linkPopup):
guard state.linkPopup == nil else { return .none }
state.categoryOfSavedContent = nil
return .none
case .binding:
return .none
case let .pushAlertTapped(isTapped):
Expand Down Expand Up @@ -156,9 +164,8 @@ private extension MainTabFeature {
case .포킷추가: return .send(.delegate(.포킷추가하기))
}

case .linkCopyButtonTapped:
state.isLinkSheetPresented = false
return .run { send in await send(.delegate(.링크추가하기)) }
case .링크팝업_버튼_눌렀을때:
return linkPopupButtonTapped(state: &state)

case .onAppear:
if state.isPushTapped {
Expand All @@ -177,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 All @@ -198,7 +205,10 @@ private extension MainTabFeature {
switch action {
case let .linkCopySuccess(url):
guard let url else { return .none }
state.isLinkSheetPresented = true
state.linkPopup = .link(
title: Constants.복사한_링크_저장하기_문구,
url: url.absoluteString
)
state.link = url.absoluteString
return .none

Expand All @@ -209,7 +219,18 @@ private extension MainTabFeature {
case let .errorSheetPresented(isPresented):
state.isErrorSheetPresented = isPresented
return .none


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 @@ -238,4 +259,19 @@ private extension MainTabFeature {
func handleDelegateAction(_ action: Action.DelegateAction, state: inout State) -> Effect<Action> {
return .none
}

func linkPopupButtonTapped(state: inout State) -> Effect<Action> {
switch state.linkPopup {
case .link:
state.linkPopup = nil
return .send(.delegate(.링크추가하기))
case .success:
state.linkPopup = nil
guard let category = state.categoryOfSavedContent else { return .none }
state.categoryOfSavedContent = nil
return .send(.inner(.카테고리상세_이동(category: category)))
case .error, .text, .warning, .none:
return .none
}
}
}
19 changes: 8 additions & 11 deletions Projects/App/Sources/MainTab/MainTabFeatureView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,10 @@ public extension MainTabView {
}
}

if self.store.isLinkSheetPresented {
if self.store.linkPopup != nil {
PokitLinkPopup(
"복사한 링크 저장하기",
isPresented: $store.isLinkSheetPresented,
type: .link(url: self.store.link ?? ""),
action: { send(.linkCopyButtonTapped) }
type: $store.linkPopup,
action: { send(.링크팝업_버튼_눌렀을때, animation: .pokitSpring) }
)
}
}
Expand All @@ -94,12 +92,10 @@ private extension MainTabView {
tabView
.overlay(alignment: .bottom) {
VStack(spacing: 0) {
if store.isLinkSheetPresented {
if store.linkPopup != nil {
PokitLinkPopup(
"복사한 링크 저장하기",
isPresented: $store.isLinkSheetPresented,
type: .link(url: store.link ?? ""),
action: { send(.linkCopyButtonTapped) }
type: $store.linkPopup,
action: { send(.링크팝업_버튼_눌렀을때, animation: .pokitSpring) }
)
.padding(.bottom, 20)
}
Expand Down Expand Up @@ -265,7 +261,8 @@ private extension MainTabView {
}
.padding(.horizontal, 28)
.onTapGesture {
UIImpactFeedbackGenerator(style: .rigid).impactOccurred()
UIImpactFeedbackGenerator(style: .light)
.impactOccurred()
store.send(.binding(.set(\.selectedTab, tab)))
}
}
Expand Down
19 changes: 13 additions & 6 deletions Projects/App/Sources/MainTab/MainTabPath.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import FeatureContentSetting
import FeatureContentList
import FeatureCategorySharing
import Domain
import Util

@Reducer
public struct MainTabPath {
Expand Down Expand Up @@ -140,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 @@ -173,13 +176,17 @@ public extension MainTabFeature {
return .none

/// - 링크추가 및 수정에서 저장하기 눌렀을 때
case let .path(.element(stackElementId, action: .링크추가및수정(.delegate(.저장하기_완료)))):
case let .path(.element(stackElementId, action: .링크추가및수정(.delegate(.저장하기_완료(contentId))))):
state.categoryOfSavedContent = contentId
state.path.removeLast()
switch state.path.last {
case .검색:
return .send(.path(.element(id: stackElementId, action: .검색(.delegate(.컨텐츠_검색)))))
return .merge(
.send(.path(.element(id: stackElementId, action: .검색(.delegate(.컨텐츠_검색))))),
.send(.inner(.링크팝업_활성화(.success(title: Constants.링크_저장_완료_문구))), animation: .pokitSpring)
)
default:
return .none
return .send(.inner(.링크팝업_활성화(.success(title: Constants.링크_저장_완료_문구))), animation: .pokitSpring)
}
/// - 각 화면에서 링크 복사 감지했을 때 (링크 추가 및 수정 화면 제외)
case let .path(.element(_, action: .알림함(.delegate(.linkCopyDetected(url))))),
Expand Down Expand Up @@ -216,7 +223,7 @@ public extension MainTabFeature {
),
title: content.title,
data: content.data,
memo: content.memo,
memo: content.memo ?? "",
createdAt: content.createdAt,
favorites: nil,
alertYn: .no
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ public struct ContentBaseResponse: Decodable {
public let data: String
public let domain: String
public let title: String
public let memo: String?
public let thumbNail: String
public let createdAt: String
public let isRead: Bool?
public let isFavorite: Bool?
}

extension ContentBaseResponse {
Expand All @@ -29,9 +31,11 @@ extension ContentBaseResponse {
data: "https://www.youtube.com/watch?v=wtSwdGJzQCQ",
domain: "youtube",
title: "신서유기",
memo: nil,
thumbNail: "https://i.ytimg.com/vi/NnOC4_kH0ok/hqdefault.jpg?sqp=-oaymwEjCNACELwBSFryq4qpAxUIARUAAAAAGAElAADIQj0AgKJDeAE=&rs=AOn4CLDN6u6mTjbaVmRZ4biJS_aDq4uvAQ",
createdAt: "2024.08.08",
isRead: false
isRead: false,
isFavorite: true
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extension CategoryImageResponse {
public static var mock: [Self] = [
Self(
imageId: 2312,
imageUrl: "https://pokit-storage.s3.ap-northeast-2.amazonaws.com/logo/pokit.png"
imageUrl: Constants.기본_썸네일_주소.absoluteString
),
Self(
imageId: 23122,
Expand Down
Loading

0 comments on commit 436c173

Please sign in to comment.