From d62978cc22d73e2c9cec1b40255ee670d3de75db Mon Sep 17 00:00:00 2001 From: GeonWoo <56182112+lgvv@users.noreply.github.com> Date: Thu, 12 Sep 2024 13:37:47 +0900 Subject: [PATCH] =?UTF-8?q?[2.3.0]=20=EA=B3=B5=EC=A7=80=20=EC=A0=9C?= =?UTF-8?q?=EB=AA=A9=20=EB=B2=88=EC=97=AD=20=EA=B8=B0=EB=8A=A5=20(?= =?UTF-8?q?=EC=8B=A4=ED=97=98=EC=8B=A4)=20(#232)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KuringApp/KuringApp.xcodeproj/project.pbxproj | 8 ++-- .../xcshareddata/swiftpm/Package.resolved | 2 +- package-kuring/Package.swift | 15 +++++-- .../SettingsFeatures/SettingList.swift | 17 ++++++- .../Labs/Dependency/LeLabo.TestValue.swift | 4 ++ .../Sources/Labs/Dependency/LeLabo.swift | 11 +++++ .../Sources/UIKit/BotUI/BotView.swift | 1 - .../Sources/UIKit/BotUI/SendPopup.swift | 1 - .../UIKit/NoticeUI/NoticeDetailView.swift | 8 ++-- .../Sources/UIKit/NoticeUI/NoticeRow.swift | 45 ++++++++++++++++++- .../UIKit/SettingsUI/SettingList.swift | 24 +++++++++- 11 files changed, 119 insertions(+), 17 deletions(-) diff --git a/KuringApp/KuringApp.xcodeproj/project.pbxproj b/KuringApp/KuringApp.xcodeproj/project.pbxproj index f3738be3..ea1bae6b 100644 --- a/KuringApp/KuringApp.xcodeproj/project.pbxproj +++ b/KuringApp/KuringApp.xcodeproj/project.pbxproj @@ -390,7 +390,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CODE_SIGN_ENTITLEMENTS = KuringApp/KuringApp.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 202406011840; + CURRENT_PROJECT_VERSION = 202408281220; DEVELOPMENT_ASSET_PATHS = "\"KuringApp/Preview Content\""; DEVELOPMENT_TEAM = 38PD5AHVVF; ENABLE_PREVIEWS = YES; @@ -407,7 +407,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.2.1; + MARKETING_VERSION = 2.3.0; PRODUCT_BUNDLE_IDENTIFIER = com.kuring.service; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; @@ -425,7 +425,7 @@ ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO; CODE_SIGN_ENTITLEMENTS = KuringApp/KuringApp.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 202406011840; + CURRENT_PROJECT_VERSION = 202408281220; DEVELOPMENT_ASSET_PATHS = "\"KuringApp/Preview Content\""; DEVELOPMENT_TEAM = 38PD5AHVVF; ENABLE_PREVIEWS = YES; @@ -442,7 +442,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 2.2.1; + MARKETING_VERSION = 2.3.0; PRODUCT_BUNDLE_IDENTIFIER = com.kuring.service; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; diff --git a/KuringApp/KuringApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/KuringApp/KuringApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 13479bc1..eaa615eb 100644 --- a/KuringApp/KuringApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/KuringApp/KuringApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -96,7 +96,7 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/ku-ring/ios-maps", "state" : { - "branch" : "main", + "branch" : "2.2.0", "revision" : "d234480483b635145b356615e289313e693a029c" } }, diff --git a/package-kuring/Package.swift b/package-kuring/Package.swift index 29693c07..7145e34e 100644 --- a/package-kuring/Package.swift +++ b/package-kuring/Package.swift @@ -39,7 +39,7 @@ let package = Package( .package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.1.5"), .package(url: "https://github.com/apple/swift-collections.git", branch: "main"), .package(url: "https://github.com/ku-ring/the-satellite", branch: "main"), - .package(url: "https://github.com/ku-ring/ios-maps", branch: "main"), + .package(url: "https://github.com/ku-ring/ios-maps", branch: "2.2.0"), .package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.50.4"), .package(url: "https://github.com/ku-ring/package-activityui", branch: "main"), .package(url: "https://github.com/firebase/firebase-ios-sdk", from: "10.21.0"), @@ -60,8 +60,17 @@ let package = Package( .target( name: "NoticeUI", dependencies: [ - "NoticeFeatures", "SearchFeatures", "SubscriptionUI", "DepartmentUI", "SearchUI", "CommonUI", - "ColorSet", "Caches", + "NoticeFeatures", + "SearchFeatures", + "SubscriptionUI", + "DepartmentUI", + "SearchUI", + "CommonUI", + "ColorSet", + "Caches", + "BotUI", + "BotFeatures", + "DepartmentFeatures", .product(name: "ComposableArchitecture", package: "swift-composable-architecture"), .product(name: "ActivityUI", package: "package-activityui"), ], diff --git a/package-kuring/Sources/Features/SettingsFeatures/SettingList.swift b/package-kuring/Sources/Features/SettingsFeatures/SettingList.swift index f6ea4609..60c78e17 100644 --- a/package-kuring/Sources/Features/SettingsFeatures/SettingList.swift +++ b/package-kuring/Sources/Features/SettingsFeatures/SettingList.swift @@ -22,6 +22,8 @@ public struct SettingListFeature { // TODO: 나중에 디펜던시로 public var currentAppIcon: KuringIcon? public var isCustomAlarmOn: Bool = false + + public var isActiveTranslationStatus: Bool public init( isCustomAlarmOn: Bool = true, @@ -31,6 +33,9 @@ public struct SettingListFeature { @Dependency(\.appIcons) var appIcons self.currentAppIcon = appIcon ?? appIcons.currentAppIcon + + @Dependency(\.leLabo) var leLabo + isActiveTranslationStatus = leLabo.getTranslationStatus() } } @@ -48,15 +53,25 @@ public struct SettingListFeature { case showFeedback case showOpensourceList } + + case transltationRowTapped } + @Dependency(\.leLabo) var leLabo + public var body: some ReducerOf { BindingReducer() - Reduce { _, action in + Reduce { state, action in switch action { case .binding, .delegate: return .none + + case .transltationRowTapped: + state.isActiveTranslationStatus.toggle() + leLabo.setTranslationStatus(state.isActiveTranslationStatus) + + return .none } } } diff --git a/package-kuring/Sources/Labs/Dependency/LeLabo.TestValue.swift b/package-kuring/Sources/Labs/Dependency/LeLabo.TestValue.swift index 7f788330..68928b9e 100644 --- a/package-kuring/Sources/Labs/Dependency/LeLabo.TestValue.swift +++ b/package-kuring/Sources/Labs/Dependency/LeLabo.TestValue.swift @@ -18,6 +18,10 @@ extension LeLabo { }, set: { newValue, _ in status.isBetaAEnabled = newValue + }, getTranslationStatus: { + return true + }, + setTranslationStatus: { isActive in } ) }() diff --git a/package-kuring/Sources/Labs/Dependency/LeLabo.swift b/package-kuring/Sources/Labs/Dependency/LeLabo.swift index ce07fd86..bef79446 100644 --- a/package-kuring/Sources/Labs/Dependency/LeLabo.swift +++ b/package-kuring/Sources/Labs/Dependency/LeLabo.swift @@ -26,6 +26,9 @@ public struct LeLabo { public var status: (Experiment) -> Bool public var set: (NewValue, Experiment) -> Void + + public var getTranslationStatus: () -> Bool + public var setTranslationStatus: (Bool) -> Void } extension LeLabo { @@ -36,6 +39,14 @@ extension LeLabo { }, set: { newValue, experiment in UserDefaults.standard.set(newValue, forKey: experiment.key) + }, + getTranslationStatus: { + let key = "com.kuring.service.lelabo.translation" + return UserDefaults.standard.bool(forKey: key) + }, + setTranslationStatus: { isActive in + let key = "com.kuring.service.lelabo.translation" + UserDefaults.standard.set(isActive, forKey: key) } ) } diff --git a/package-kuring/Sources/UIKit/BotUI/BotView.swift b/package-kuring/Sources/UIKit/BotUI/BotView.swift index 1ec86c46..052629a8 100644 --- a/package-kuring/Sources/UIKit/BotUI/BotView.swift +++ b/package-kuring/Sources/UIKit/BotUI/BotView.swift @@ -4,7 +4,6 @@ // import SwiftUI -import Networks import ColorSet import SwiftData import BotFeatures diff --git a/package-kuring/Sources/UIKit/BotUI/SendPopup.swift b/package-kuring/Sources/UIKit/BotUI/SendPopup.swift index ab09b379..0b148779 100644 --- a/package-kuring/Sources/UIKit/BotUI/SendPopup.swift +++ b/package-kuring/Sources/UIKit/BotUI/SendPopup.swift @@ -6,7 +6,6 @@ import SwiftUI import ComposableArchitecture import ColorSet -import Networks import Dependencies struct SendPopup: View { diff --git a/package-kuring/Sources/UIKit/NoticeUI/NoticeDetailView.swift b/package-kuring/Sources/UIKit/NoticeUI/NoticeDetailView.swift index 083284ea..41de2a51 100644 --- a/package-kuring/Sources/UIKit/NoticeUI/NoticeDetailView.swift +++ b/package-kuring/Sources/UIKit/NoticeUI/NoticeDetailView.swift @@ -32,9 +32,11 @@ public struct NoticeDetailView: View { Button { self.store.send(.bookmarkButtonTapped) } label: { - Image(self.store.isBookmarked - ? "bookmark-fill" - : "bookmark", bundle: Bundle.notices + Image( + self.store.isBookmarked + ? "bookmark-fill" + : "bookmark", + bundle: Bundle.notices ) } diff --git a/package-kuring/Sources/UIKit/NoticeUI/NoticeRow.swift b/package-kuring/Sources/UIKit/NoticeUI/NoticeRow.swift index 5dab41e2..d52b064f 100644 --- a/package-kuring/Sources/UIKit/NoticeUI/NoticeRow.swift +++ b/package-kuring/Sources/UIKit/NoticeUI/NoticeRow.swift @@ -7,12 +7,19 @@ import Caches import Models import SwiftUI import ColorSet +#if canImport(Translation) +import Translation +#endif import ComposableArchitecture public struct NoticeRow: View { - var rowType: NoticeRowType + let rowType: NoticeRowType let notice: Notice - + + /// 번역 노출 여부 + @State var showsTranslation: Bool = false + @AppStorage("com.kuring.service.lelabo.translation") private var transltationValue: Bool = false + public init( notice: Notice, bookmarked: Bool = false, @@ -65,6 +72,8 @@ public struct NoticeRow: View { dateView } Spacer() + + translationButton } .padding(.top, 13) @@ -78,6 +87,7 @@ public struct NoticeRow: View { } .padding(.horizontal, 20) .padding(.bottom, 16) + case .important: HStack(alignment: .top, spacing: 0) { VStack(alignment: .leading, spacing: 4) { @@ -86,10 +96,13 @@ public struct NoticeRow: View { dateView } Spacer() + + translationButton } .padding(.horizontal, 20) .padding(.top, 13) .padding(.bottom, 16) + case .bookmark: ZStack { HStack(alignment: .top, spacing: 0) { @@ -98,6 +111,8 @@ public struct NoticeRow: View { dateView } Spacer() + + translationButton } .padding(.top, 16) @@ -111,6 +126,7 @@ public struct NoticeRow: View { } .padding(.horizontal, 20) .padding(.bottom, 16) + case .none: HStack(alignment: .top, spacing: 0) { VStack(alignment: .leading, spacing: 4) { @@ -118,6 +134,8 @@ public struct NoticeRow: View { dateView } Spacer() + + translationButton } .padding(.horizontal, 20) .padding(.vertical, 16) @@ -173,9 +191,32 @@ public struct NoticeRow: View { .compositingGroup() } + @ViewBuilder + private var translationButton: some View { + VStack { + Spacer() + if #available(iOS 17.4, *), + transltationValue { + Image(systemName: "translate") + .frame(width: 24) + .onTapGesture { + showsTranslation.toggle() + } + .translationPresentation( + isPresented: $showsTranslation, + text: notice.subject + ) + } else { + EmptyView() + } + Spacer() + } + } + private func separateWithDot(_ value: String) -> String { return value.replacingOccurrences(of: "-", with: ".") } + } #Preview { diff --git a/package-kuring/Sources/UIKit/SettingsUI/SettingList.swift b/package-kuring/Sources/UIKit/SettingsUI/SettingList.swift index b1af0780..74211533 100644 --- a/package-kuring/Sources/UIKit/SettingsUI/SettingList.swift +++ b/package-kuring/Sources/UIKit/SettingsUI/SettingList.swift @@ -56,6 +56,28 @@ public struct SettingList: View { .listRowBackground(Color.Kuring.bg) Section { + if #available(iOS 17.4, *) { + ZStack { + HStack(spacing: 0) { + Text("번역") + Spacer() + Text( + store.isActiveTranslationStatus + ? "끄기" + : "켜기" + ) + } + .font(.system(size: 16, weight: .medium)) + .kerning(0.15) + .foregroundStyle(Color.Kuring.body) + .contentShape(Rectangle()) + .onTapGesture { + store.send(.transltationRowTapped) + } + } + .padding(.vertical, 9) + } + ZStack { NavigationLink( state: SettingsAppFeature.Path.State.appIconSelector( @@ -132,7 +154,7 @@ public struct SettingList: View { } header: { headerView("정보") } footer: { - Text("Designed by 김예은, 이소영.\nDeveloped by 박성수, 이건우, 최효원.\nManaged by 채수빈") + Text("Designed by 김예은, 이소영.\nDeveloped by 박성수, 이건우, 최효원.\nManaged by 채수빈.") .font(.footnote) .foregroundStyle(Color.Kuring.caption1) }