Skip to content

Commit 99f564a

Browse files
committed
Рефактор
-
1 parent d8d7393 commit 99f564a

File tree

9 files changed

+77
-17
lines changed

9 files changed

+77
-17
lines changed

SwiftUI-WorkoutApp.xcodeproj/project.pbxproj

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@
5353
6758B93C281E74F2001D83D8 /* Date+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6758B93B281E74F2001D83D8 /* Date+.swift */; };
5454
6758B93E281E7695001D83D8 /* Optional+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6758B93D281E7695001D83D8 /* Optional+.swift */; };
5555
6758B946281ED194001D83D8 /* ErrorResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6758B945281ED194001D83D8 /* ErrorResponse.swift */; };
56+
675A370328547ACA00DAE071 /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 675A370528547ACA00DAE071 /* Localizable.stringsdict */; };
5657
675EC649281289FB00C2E229 /* SportsGroundSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 675EC648281289FB00C2E229 /* SportsGroundSize.swift */; };
5758
675EC64B28128B7E00C2E229 /* SportsGroundGrade.swift in Sources */ = {isa = PBXBuildFile; fileRef = 675EC64A28128B7E00C2E229 /* SportsGroundGrade.swift */; };
58-
675EC64D281405A900C2E229 /* Plurals.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 675EC64C281405A900C2E229 /* Plurals.stringsdict */; };
5959
675EC64F2814126800C2E229 /* TextEntryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 675EC64E2814126800C2E229 /* TextEntryView.swift */; };
6060
675EC653281445E500C2E229 /* MapViewUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 675EC652281445E500C2E229 /* MapViewUI.swift */; };
6161
675EC6572815433600C2E229 /* UsersListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 675EC6562815433600C2E229 /* UsersListView.swift */; };
@@ -190,9 +190,9 @@
190190
6758B93B281E74F2001D83D8 /* Date+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+.swift"; sourceTree = "<group>"; };
191191
6758B93D281E7695001D83D8 /* Optional+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Optional+.swift"; sourceTree = "<group>"; };
192192
6758B945281ED194001D83D8 /* ErrorResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErrorResponse.swift; sourceTree = "<group>"; };
193+
675A370628547ACD00DAE071 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = ru; path = ru.lproj/Localizable.stringsdict; sourceTree = "<group>"; };
193194
675EC648281289FB00C2E229 /* SportsGroundSize.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SportsGroundSize.swift; sourceTree = "<group>"; };
194195
675EC64A28128B7E00C2E229 /* SportsGroundGrade.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SportsGroundGrade.swift; sourceTree = "<group>"; };
195-
675EC64C281405A900C2E229 /* Plurals.stringsdict */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; path = Plurals.stringsdict; sourceTree = "<group>"; };
196196
675EC64E2814126800C2E229 /* TextEntryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextEntryView.swift; sourceTree = "<group>"; };
197197
675EC652281445E500C2E229 /* MapViewUI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapViewUI.swift; sourceTree = "<group>"; };
198198
675EC65528153B8200C2E229 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -571,7 +571,7 @@
571571
6798AA4B280AF1C200DB76F1 /* LaunchScreen.storyboard */,
572572
6798AA41280AEDCA00DB76F1 /* Assets.xcassets */,
573573
6798AA80280BF13100DB76F1 /* Localizable.strings */,
574-
675EC64C281405A900C2E229 /* Plurals.stringsdict */,
574+
675A370528547ACA00DAE071 /* Localizable.stringsdict */,
575575
);
576576
path = Resources;
577577
sourceTree = "<group>";
@@ -822,7 +822,7 @@
822822
672F2BE32832BC7C0000A193 /* oldEvents.json in Resources */,
823823
6798AA7E280BF13100DB76F1 /* Localizable.strings in Resources */,
824824
6798AA42280AEDCA00DB76F1 /* Assets.xcassets in Resources */,
825-
675EC64D281405A900C2E229 /* Plurals.stringsdict in Resources */,
825+
675A370328547ACA00DAE071 /* Localizable.stringsdict in Resources */,
826826
);
827827
runOnlyForDeploymentPostprocessing = 0;
828828
};
@@ -965,6 +965,14 @@
965965
/* End PBXSourcesBuildPhase section */
966966

967967
/* Begin PBXVariantGroup section */
968+
675A370528547ACA00DAE071 /* Localizable.stringsdict */ = {
969+
isa = PBXVariantGroup;
970+
children = (
971+
675A370628547ACD00DAE071 /* ru */,
972+
);
973+
name = Localizable.stringsdict;
974+
sourceTree = "<group>";
975+
};
968976
6798AA80280BF13100DB76F1 /* Localizable.strings */ = {
969977
isa = PBXVariantGroup;
970978
children = (

SwiftUI-WorkoutApp/Models/SportsGround.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ struct Comment: Codable, Identifiable, Hashable {
137137
}
138138

139139
static var mock: Comment {
140-
.init(id: .zero, body: "Test comment", date: "2013-01-16T03:35:54+04:00", user: .emptyValue)
140+
.init(id: .zero, body: "Test comment", date: "2013-01-16T03:35:54+04:00", user: .mock)
141141
}
142142
}
143143

SwiftUI-WorkoutApp/Models/UserResponse.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ extension UserResponse {
5454
var regForm: MainUserForm {
5555
.init(self)
5656
}
57+
static var mock: UserResponse {
58+
.init(userName: "TestUserName", fullName: "TestFullName", email: "[email protected]", imageStringURL: "avatar_default", birthDateIsoString: "1990-11-25", createdIsoDateTimeSec: nil, userID: .zero, cityID: 1, countryID: 17, genderCode: 1, friendsCount: 5, journalsCount: 2, friendRequestsCountString: "3", sportsGroundsCountString: "4", addedSportsGrounds: nil)
59+
}
5760
static var emptyValue: UserResponse {
5861
.init(userName: nil, fullName: nil, email: nil, imageStringURL: nil, birthDateIsoString: nil, createdIsoDateTimeSec: nil, userID: nil, cityID: nil, countryID: nil, genderCode: nil, friendsCount: nil, journalsCount: nil, friendRequestsCountString: nil, sportsGroundsCountString: nil, addedSportsGrounds: nil)
5962
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>yearsCount %lld</key>
6+
<dict>
7+
<key>NSStringLocalizedFormatKey</key>
8+
<string>%#@VARIABLE@</string>
9+
<key>VARIABLE</key>
10+
<dict>
11+
<key>NSStringFormatSpecTypeKey</key>
12+
<string>NSStringPluralRuleType</string>
13+
<key>NSStringFormatValueTypeKey</key>
14+
<string>lld</string>
15+
<key>zero</key>
16+
<string>%lld лет</string>
17+
<key>one</key>
18+
<string>%lld год</string>
19+
<key>two</key>
20+
<string>%lld года</string>
21+
<key>few</key>
22+
<string>%lld года</string>
23+
<key>many</key>
24+
<string>%lld лет</string>
25+
</dict>
26+
</dict>
27+
<key>peopleTrainHere %lld</key>
28+
<dict>
29+
<key>NSStringLocalizedFormatKey</key>
30+
<string>%#@VARIABLE@</string>
31+
<key>VARIABLE</key>
32+
<dict>
33+
<key>NSStringFormatSpecTypeKey</key>
34+
<string>NSStringPluralRuleType</string>
35+
<key>NSStringFormatValueTypeKey</key>
36+
<string>lld</string>
37+
<key>zero</key>
38+
<string>%lld человек</string>
39+
<key>one</key>
40+
<string>%lld человек</string>
41+
<key>two</key>
42+
<string>%lld человека</string>
43+
<key>few</key>
44+
<string>%lld человека</string>
45+
<key>many</key>
46+
<string>%lld человек</string>
47+
</dict>
48+
</dict>
49+
</dict>
50+
</plist>

SwiftUI-WorkoutApp/Screens/Components/Comments/CommentViewCell.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ private extension CommentViewCell {
6666
struct SportsGroundCommentView_Previews: PreviewProvider {
6767
static var previews: some View {
6868
CommentViewCell(
69-
model: .init(id: .zero, body: "Test comment", date: "2013-01-16T03:35:54+04:00", user: .emptyValue),
69+
model: .init(
70+
id: .zero,
71+
body: "Test comment",
72+
date: "2013-01-16T03:35:54+04:00",
73+
user: .mock
74+
),
7075
deleteClbk: {_ in},
7176
editClbk: {_ in}
7277
)

SwiftUI-WorkoutApp/Screens/Components/MapSnapshotView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private extension MapSnapshotView {
8383
snapshotImage = image
8484
} else {
8585
#if DEBUG
86-
print("--- Error with snapshot: ", error)
86+
print("--- Error with snapshot: ", (error?.localizedDescription).valueOrEmpty)
8787
#endif
8888
}
8989
}

SwiftUI-WorkoutApp/Screens/Events/Detail/EventDetailsView.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,7 @@ private extension EventDetailsView {
166166
HStack {
167167
Text("Идут")
168168
Spacer()
169-
Text(
170-
"peopleTrainHere \(viewModel.event.participants.count)",
171-
tableName: "Plurals"
172-
)
169+
Text("peopleTrainHere \(viewModel.event.participants.count)")
173170
.foregroundColor(.secondary)
174171
}
175172
}

SwiftUI-WorkoutApp/Screens/Profile/Detail/UserDetailsView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ private extension UserDetailsView {
7474
VStack(spacing: 4) {
7575
Text(viewModel.user.name)
7676
.fontWeight(.bold)
77-
Text(viewModel.user.gender) + Text("yearsCount \(viewModel.user.age)", tableName: "Plurals")
77+
Text(viewModel.user.gender) + Text("yearsCount \(viewModel.user.age)")
7878
Text(viewModel.user.shortAddress)
7979
.multilineTextAlignment(.center)
8080
}
@@ -267,7 +267,7 @@ private extension UserDetailsView {
267267

268268
struct UserProfileView_Previews: PreviewProvider {
269269
static var previews: some View {
270-
UserDetailsView(for: .emptyValue)
270+
UserDetailsView(for: .mock)
271271
.environmentObject(CheckNetworkService())
272272
.environmentObject(DefaultsService())
273273
}

SwiftUI-WorkoutApp/Screens/SportsGrounds/Detail/SportsGroundDetailView.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,7 @@ private extension SportsGroundDetailView {
149149
HStack {
150150
Text("Здесь тренируются")
151151
Spacer()
152-
Text(
153-
"peopleTrainHere \(viewModel.ground.participants.count)",
154-
tableName: "Plurals"
155-
)
152+
Text("peopleTrainHere \(viewModel.ground.participants.count)")
156153
.foregroundColor(.secondary)
157154
}
158155
}

0 commit comments

Comments
 (0)