Skip to content

Commit ac081d9

Browse files
committed
Make TopicBuilder as separate module
1 parent c41683d commit ac081d9

File tree

11 files changed

+525
-1563
lines changed

11 files changed

+525
-1563
lines changed

ForPDA.xcodeproj/project.pbxproj

Lines changed: 437 additions & 1501 deletions
Large diffs are not rendered by default.

Modules/Sources/AnnouncementFeature/AnnouncementFeature.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import ParsingClient
1313
import Models
1414
import PersistenceKeys
1515
import AnalyticsClient
16+
import TopicBuilder
1617

1718
@Reducer
1819
public struct AnnouncementFeature: Reducer, Sendable {

Modules/Sources/AnnouncementFeature/AnnouncementScreen.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import SwiftUI
99
import ComposableArchitecture
1010
import PageNavigationFeature
11-
import TopicFeature
11+
import TopicBuilder
1212
import SFSafeSymbols
1313
import SharedUI
1414
import Models

Modules/Sources/PageNavigationFeature/PageNavigationView.swift

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,6 @@ public struct PageNavigation: View {
134134
}
135135
}
136136

137-
// MARK: - Model Extensions
138-
139-
extension NoticeType {
140-
public var color: Color {
141-
switch self {
142-
case .curator: return Color(.Main.green)
143-
case .moderator: return Color(.Theme.primary)
144-
case .admin: return Color(.Main.red)
145-
}
146-
}
147-
}
148-
149137
// MARK: - Previews
150138

151139
#Preview {
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"sourceLanguage" : "en",
3+
"strings" : {
4+
"Code" : {
5+
"localizations" : {
6+
"ru" : {
7+
"stringUnit" : {
8+
"state" : "translated",
9+
"value" : "Код"
10+
}
11+
}
12+
}
13+
},
14+
"Code: " : {
15+
"comment" : "Has space after colon",
16+
"localizations" : {
17+
"ru" : {
18+
"stringUnit" : {
19+
"state" : "translated",
20+
"value" : "Код: "
21+
}
22+
}
23+
}
24+
},
25+
"Hidden text" : {
26+
"localizations" : {
27+
"ru" : {
28+
"stringUnit" : {
29+
"state" : "translated",
30+
"value" : "Скрытый текст"
31+
}
32+
}
33+
}
34+
}
35+
},
36+
"version" : "1.0"
37+
}

Modules/Sources/TopicFeature/TopicView.swift renamed to Modules/Sources/TopicBuilder/TopicView.swift

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import SFSafeSymbols
1212
import Models
1313
import Sharing
1414
import Dependencies
15+
import CacheClient
1516

1617
public struct TopicView: View {
1718

@@ -343,12 +344,12 @@ struct CodeView: View {
343344
Group {
344345
switch info {
345346
case .none:
346-
Text("Код")
347+
Text("Code", bundle: .module)
347348
.foregroundStyle(Color(.Labels.primary))
348349

349350
case let .title(title):
350351
HStack {
351-
Text("Код: ")
352+
Text("Code: ", bundle: .module)
352353
.foregroundStyle(Color(.Labels.teritary))
353354
Text(title)
354355
.foregroundStyle(Color(.Labels.primary))
@@ -446,7 +447,7 @@ struct HideView: View {
446447
if isShown {
447448
VStack(spacing: 0) {
448449
HStack(spacing: 0) {
449-
Text("Скрытый текст")
450+
Text("Hidden text", bundle: .module)
450451
.foregroundStyle(Color(.Labels.primary))
451452
.font(.callout)
452453
.frame(maxWidth: .infinity, alignment: .leading)
@@ -478,6 +479,7 @@ struct HideView: View {
478479
}
479480
.animation(.default, value: isShown)
480481
.task {
482+
// TODO: What is happening here?
481483
@Dependency(\.cacheClient) var cache
482484
if let userId = shouldLoadUser, let info {
483485
if let currentUser = await cache.getUser(userId) {
@@ -537,6 +539,18 @@ struct NoticeView: View {
537539
}
538540
}
539541

542+
// MARK: - Extensions
543+
544+
public extension NoticeType {
545+
var color: Color {
546+
switch self {
547+
case .curator: return Color(.Main.green)
548+
case .moderator: return Color(.Theme.primary)
549+
case .admin: return Color(.Main.red)
550+
}
551+
}
552+
}
553+
540554
// MARK: - Previews
541555

542556
#Preview("Code View") {

Modules/Sources/TopicFeature/Resources/Localizable.xcstrings

Lines changed: 12 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -21,78 +21,48 @@
2121
}
2222
}
2323
},
24-
"Open In Browser" : {
25-
"localizations" : {
26-
"ru" : {
27-
"stringUnit" : {
28-
"state" : "translated",
29-
"value" : "Открыть в браузере"
30-
}
31-
}
32-
}
33-
},
34-
"Remove from favorites" : {
35-
"localizations" : {
36-
"ru" : {
37-
"stringUnit" : {
38-
"state" : "translated",
39-
"value" : "Удалить из избранного"
40-
}
41-
}
42-
}
43-
},
44-
"Код" : {
24+
"Edited: %@ • %@" : {
4525
"localizations" : {
46-
"ru" : {
26+
"en" : {
4727
"stringUnit" : {
48-
"state" : "translated",
49-
"value" : "Code"
28+
"state" : "new",
29+
"value" : "Edited: %1$@ • %2$@"
5030
}
51-
}
52-
}
53-
},
54-
"Код: " : {
55-
"localizations" : {
31+
},
5632
"ru" : {
5733
"stringUnit" : {
5834
"state" : "translated",
59-
"value" : "Code:"
35+
"value" : "Отредактировал: %1$@ • %2$@"
6036
}
6137
}
6238
}
6339
},
64-
"Отредактировал: %@ • %@" : {
40+
"Open In Browser" : {
6541
"localizations" : {
66-
"en" : {
67-
"stringUnit" : {
68-
"state" : "new",
69-
"value" : "Отредактировал: %1$@ • %2$@"
70-
}
71-
},
7242
"ru" : {
7343
"stringUnit" : {
7444
"state" : "translated",
75-
"value" : "Edited by: %1$@ • %2$@"
45+
"value" : "Открыть в браузере"
7646
}
7747
}
7848
}
7949
},
80-
"Причина: %@" : {
50+
"Reason: %@" : {
8151
"localizations" : {
8252
"ru" : {
8353
"stringUnit" : {
8454
"state" : "translated",
85-
"value" : "Reason: %@"
55+
"value" : "Причина: %@"
8656
}
8757
}
8858
}
8959
},
90-
"Скрытый текст" : {
60+
"Remove from favorites" : {
9161
"localizations" : {
9262
"ru" : {
9363
"stringUnit" : {
9464
"state" : "translated",
95-
"value" : "Hidden text"
65+
"value" : "Удалить из избранного"
9666
}
9767
}
9868
}

Modules/Sources/TopicFeature/TopicFeature.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import PasteboardClient
1616
import NotificationCenterClient
1717
import TCAExtensions
1818
import AnalyticsClient
19+
import TopicBuilder
1920

2021
@Reducer
2122
public struct TopicFeature: Reducer, Sendable {

Modules/Sources/TopicFeature/TopicScreen.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import SharedUI
1313
import NukeUI
1414
import Models
1515
import ParsingClient
16+
import TopicBuilder
1617

1718
public struct TopicScreen: View {
1819

@@ -237,9 +238,9 @@ public struct TopicScreen: View {
237238
@ViewBuilder
238239
private func PostFooter(_ lastEdit: Post.LastEdit) -> some View {
239240
VStack(alignment: .leading, spacing: 6) {
240-
Text("Отредактировал: \(lastEdit.username)\(lastEdit.date.formatted())")
241+
Text("Edited: \(lastEdit.username)\(lastEdit.date.formatted())", bundle: .module)
241242
if !lastEdit.reason.isEmpty {
242-
Text("Причина: \(lastEdit.reason)")
243+
Text("Reason: \(lastEdit.reason)", bundle: .module)
243244
}
244245
}
245246
.font(.caption2)

0 commit comments

Comments
 (0)