Skip to content

Commit 19cf3a9

Browse files
authored
Feature/send ground feedback (#127)
* Добавил кнопку для обратной связи о площадке * Поднял версию до 3.3.3 (1) * Обновил гитигнор * Обновил версии библиотек
1 parent 294bd46 commit 19cf3a9

File tree

7 files changed

+96
-14
lines changed

7 files changed

+96
-14
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
screenshots/screenshots.html
33
SwiftUI-WorkoutApp.xcodeproj/project.xcworkspace/xcuserdata/oleg991.xcuserdatad/UserInterfaceState.xcuserstate
44
SwiftUI-WorkoutApp.xcodeproj/project.xcworkspace/xcuserdata/oleg991.xcuserdatad/IDEFindNavigatorScopes.plist
5+
SwiftUI-WorkoutApp/.DS_Store

SwiftUI-WorkoutApp.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,7 @@
11651165
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
11661166
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
11671167
CODE_SIGN_STYLE = Automatic;
1168-
CURRENT_PROJECT_VERSION = 2;
1168+
CURRENT_PROJECT_VERSION = 1;
11691169
DEVELOPMENT_ASSET_PATHS = "SwiftUI-WorkoutApp/Preview\\ Content/PreviewContent.swift SwiftUI-WorkoutApp/Preview\\ Content";
11701170
DEVELOPMENT_TEAM = CR68PP2Z3F;
11711171
ENABLE_PREVIEWS = YES;
@@ -1183,7 +1183,7 @@
11831183
"$(inherited)",
11841184
"@executable_path/Frameworks",
11851185
);
1186-
MARKETING_VERSION = 3.3.2;
1186+
MARKETING_VERSION = 3.3.3;
11871187
PRODUCT_BUNDLE_IDENTIFIER = com.FGU.WorkOut;
11881188
PRODUCT_NAME = WorkoutApp;
11891189
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
@@ -1201,7 +1201,7 @@
12011201
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
12021202
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
12031203
CODE_SIGN_STYLE = Automatic;
1204-
CURRENT_PROJECT_VERSION = 2;
1204+
CURRENT_PROJECT_VERSION = 1;
12051205
DEVELOPMENT_ASSET_PATHS = "SwiftUI-WorkoutApp/Preview\\ Content/PreviewContent.swift SwiftUI-WorkoutApp/Preview\\ Content";
12061206
DEVELOPMENT_TEAM = CR68PP2Z3F;
12071207
ENABLE_PREVIEWS = YES;
@@ -1219,7 +1219,7 @@
12191219
"$(inherited)",
12201220
"@executable_path/Frameworks",
12211221
);
1222-
MARKETING_VERSION = 3.3.2;
1222+
MARKETING_VERSION = 3.3.3;
12231223
PRODUCT_BUNDLE_IDENTIFIER = com.FGU.WorkOut;
12241224
PRODUCT_NAME = WorkoutApp;
12251225
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";

SwiftUI-WorkoutApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SwiftUI-WorkoutApp/DesignSystem/Sources/DesignSystem/Icons.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public enum Icons {
2323
case gearshape
2424
case refresh = "arrow.triangle.2.circlepath"
2525
case exclamation = "exclamationmark.triangle"
26+
case exclamationArrowCircle = "exclamationmark.arrow.circlepath"
2627
case xmarkCircle = "xmark.circle"
2728
case xmark
2829
case filter = "line.3.horizontal.decrease.circle"

SwiftUI-WorkoutApp/Resources/Localizable.xcstrings

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2163,6 +2163,22 @@
21632163
}
21642164
}
21652165
},
2166+
"Написать письмо" : {
2167+
"localizations" : {
2168+
"en" : {
2169+
"stringUnit" : {
2170+
"state" : "translated",
2171+
"value" : "Write a letter"
2172+
}
2173+
},
2174+
"ru" : {
2175+
"stringUnit" : {
2176+
"state" : "translated",
2177+
"value" : "Написать письмо"
2178+
}
2179+
}
2180+
}
2181+
},
21662182
"Настроить" : {
21672183
"extractionState" : "manual",
21682184
"localizations" : {
@@ -2463,6 +2479,23 @@
24632479
}
24642480
}
24652481
},
2482+
"Нужно обновить данные о площадке?" : {
2483+
"extractionState" : "manual",
2484+
"localizations" : {
2485+
"en" : {
2486+
"stringUnit" : {
2487+
"state" : "translated",
2488+
"value" : "Should we update any information about this sports ground?"
2489+
}
2490+
},
2491+
"ru" : {
2492+
"stringUnit" : {
2493+
"state" : "translated",
2494+
"value" : "Нужно обновить данные о площадке?"
2495+
}
2496+
}
2497+
}
2498+
},
24662499
"О приложении" : {
24672500
"extractionState" : "manual",
24682501
"localizations" : {

SwiftUI-WorkoutApp/SWModels/Sources/SWModels/Constants.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public enum Constants {
1818
public static let deleteJournalEntry = "Удалить запись из дневника?"
1919
public static let deleteDialog = "Удалить диалог?"
2020
public static let logout = "Выйти из учетной записи?"
21+
public static let groundFeedback = "Нужно обновить данные о площадке?"
2122
public static let resetSuccessful = "Инструкция для восстановления пароля выслана на email, указанный при регистрации"
2223
public static let locationPermissionDenied = "Запрещен доступ к геолокации"
2324
public static let needLocationPermission =

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

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import DesignSystem
2+
import FeedbackSender
23
import NetworkStatus
34
import SwiftUI
45
import SWModels
@@ -12,21 +13,24 @@ struct SportsGroundDetailView: View {
1213
@State private var showErrorAlert = false
1314
@State private var alertMessage = ""
1415
@State private var isCreatingComment = false
15-
@State private var showDeleteDialog = false
1616
@State private var trainHere = false
1717
@State private var editComment: CommentResponse?
18+
@State private var dialogs = ConfirmationDialogs()
1819
@State private var changeTrainHereTask: Task<Void, Never>?
1920
@State private var deleteCommentTask: Task<Void, Never>?
2021
@State private var deleteGroundTask: Task<Void, Never>?
2122
@State private var deletePhotoTask: Task<Void, Never>?
2223
@State private var refreshButtonTask: Task<Void, Never>?
24+
private let feedbackSender: FeedbackSender
2325
private let onDeletion: (Int) -> Void
2426

2527
init(
2628
for ground: SportsGround,
29+
feedbackSender: FeedbackSender = FeedbackSenderImp(),
2730
onDeletion: @escaping (Int) -> Void
2831
) {
2932
_viewModel = StateObject(wrappedValue: .init(with: ground))
33+
self.feedbackSender = feedbackSender
3034
self.onDeletion = onDeletion
3135
}
3236

@@ -86,6 +90,8 @@ struct SportsGroundDetailView: View {
8690
editGroundButton
8791
}
8892
.disabled(viewModel.isLoading || !network.isConnected)
93+
} else {
94+
feedbackButton
8995
}
9096
}
9197
}
@@ -217,13 +223,33 @@ private extension SportsGroundDetailView {
217223
}
218224
}
219225

226+
var feedbackButton: some View {
227+
Button(action: { dialogs.showFeedback.toggle() }) {
228+
Image(systemName: Icons.Regular.exclamationArrowCircle.rawValue)
229+
}
230+
.disabled(viewModel.isLoading)
231+
.confirmationDialog(
232+
.init(Constants.Alert.groundFeedback),
233+
isPresented: $dialogs.showFeedback,
234+
titleVisibility: .visible
235+
) {
236+
Button("Написать письмо") {
237+
feedbackSender.sendFeedback(
238+
subject: Feedback.makeSubject(for: viewModel.ground.shortTitle),
239+
messageBody: Feedback.body,
240+
recipients: Constants.feedbackRecipient
241+
)
242+
}
243+
}
244+
}
245+
220246
var deleteButton: some View {
221-
Button(action: { showDeleteDialog.toggle() }) {
222-
Image(systemName: "trash")
247+
Button(action: { dialogs.showDelete.toggle() }) {
248+
Image(systemName: Icons.Regular.trash.rawValue)
223249
}
224250
.confirmationDialog(
225251
.init(Constants.Alert.deleteGround),
226-
isPresented: $showDeleteDialog,
252+
isPresented: $dialogs.showDelete,
227253
titleVisibility: .visible
228254
) {
229255
Button("Удалить", role: .destructive) {
@@ -293,6 +319,26 @@ private extension SportsGroundDetailView {
293319
}
294320
}
295321

322+
private extension SportsGroundDetailView {
323+
/// Содержит переключатели для диалогов на экране
324+
struct ConfirmationDialogs {
325+
/// Спросить об удалении площадки
326+
var showDelete = false
327+
/// Спросить о необходимости обновления площадки
328+
var showFeedback = false
329+
}
330+
331+
enum Feedback {
332+
static func makeSubject(for groundNumber: String) -> String {
333+
"\(ProcessInfo.processInfo.processName): Обновление площадки \(groundNumber)"
334+
}
335+
static let body = """
336+
Какую информацию о площадке нужно обновить?
337+
\n
338+
"""
339+
}
340+
}
341+
296342
#if DEBUG
297343
#Preview {
298344
SportsGroundDetailView(for: .preview, onDeletion: { _ in })

0 commit comments

Comments
 (0)