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

[2.3.0] 공지 제목 번역 기능 (실험실) #232

Merged
merged 23 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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 KuringApp/KuringApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/ku-ring/ios-maps",
"state" : {
"branch" : "main",
"branch" : "2.2.0",
"revision" : "d234480483b635145b356615e289313e693a029c"
}
},
Expand Down
15 changes: 12 additions & 3 deletions package-kuring/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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"),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -31,6 +33,9 @@ public struct SettingListFeature {

@Dependency(\.appIcons) var appIcons
self.currentAppIcon = appIcon ?? appIcons.currentAppIcon

@Dependency(\.leLabo) var leLabo
isActiveTranslationStatus = leLabo.getTranslationStatus()
}
}

Expand All @@ -48,15 +53,25 @@ public struct SettingListFeature {
case showFeedback
case showOpensourceList
}

case transltationRowTapped
}

@Dependency(\.leLabo) var leLabo

public var body: some ReducerOf<Self> {
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
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions package-kuring/Sources/Labs/Dependency/LeLabo.TestValue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ extension LeLabo {
},
set: { newValue, _ in
status.isBetaAEnabled = newValue
}, getTranslationStatus: {
return true
},
setTranslationStatus: { isActive in
}
)
}()
Expand Down
11 changes: 11 additions & 0 deletions package-kuring/Sources/Labs/Dependency/LeLabo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
}
)
}
Expand Down
1 change: 0 additions & 1 deletion package-kuring/Sources/UIKit/BotUI/BotView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//

import SwiftUI
import Networks
import ColorSet
import SwiftData
import BotFeatures
Expand Down
1 change: 0 additions & 1 deletion package-kuring/Sources/UIKit/BotUI/SendPopup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import SwiftUI
import ComposableArchitecture
import ColorSet
import Networks
import Dependencies

struct SendPopup: View {
Expand Down
8 changes: 5 additions & 3 deletions package-kuring/Sources/UIKit/NoticeUI/NoticeDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}

Expand Down
45 changes: 43 additions & 2 deletions package-kuring/Sources/UIKit/NoticeUI/NoticeRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,19 @@ import Caches
import Models
import SwiftUI
import ColorSet
#if canImport(Translation)
import Translation
sunshiningsoo marked this conversation as resolved.
Show resolved Hide resolved
#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,
Expand Down Expand Up @@ -65,6 +72,8 @@ public struct NoticeRow: View {
dateView
}
Spacer()

translationButton
}
.padding(.top, 13)

Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -98,6 +111,8 @@ public struct NoticeRow: View {
dateView
}
Spacer()

translationButton
}
.padding(.top, 16)

Expand All @@ -111,13 +126,16 @@ public struct NoticeRow: View {
}
.padding(.horizontal, 20)
.padding(.bottom, 16)

case .none:
HStack(alignment: .top, spacing: 0) {
VStack(alignment: .leading, spacing: 4) {
titleView
dateView
}
Spacer()

translationButton
}
.padding(.horizontal, 20)
.padding(.vertical, 16)
Expand Down Expand Up @@ -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 {
Expand Down
24 changes: 23 additions & 1 deletion package-kuring/Sources/UIKit/SettingsUI/SettingList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,28 @@ public struct SettingList: View {
.listRowBackground(Color.Kuring.bg)

Section {
if #available(iOS 17.4, *) {
ZStack {
HStack(spacing: 0) {
Text("번역")
lgvv marked this conversation as resolved.
Show resolved Hide resolved
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(
Expand Down Expand Up @@ -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)
}
Expand Down