Skip to content

Commit 660d8e3

Browse files
authored
Скрыл кнопки для регистрации
2 parents 7e272d2 + b3c73b7 commit 660d8e3

File tree

5 files changed

+16
-34
lines changed

5 files changed

+16
-34
lines changed

SwiftUI-WorkoutApp.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@
14371437
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
14381438
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
14391439
CODE_SIGN_STYLE = Automatic;
1440-
CURRENT_PROJECT_VERSION = 4;
1440+
CURRENT_PROJECT_VERSION = 5;
14411441
DEVELOPMENT_ASSET_PATHS = "SwiftUI-WorkoutApp/Preview\\ Content/PreviewContent.swift SwiftUI-WorkoutApp/Preview\\ Content";
14421442
DEVELOPMENT_TEAM = CR68PP2Z3F;
14431443
ENABLE_PREVIEWS = YES;
@@ -1473,7 +1473,7 @@
14731473
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
14741474
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
14751475
CODE_SIGN_STYLE = Automatic;
1476-
CURRENT_PROJECT_VERSION = 4;
1476+
CURRENT_PROJECT_VERSION = 5;
14771477
DEVELOPMENT_ASSET_PATHS = "SwiftUI-WorkoutApp/Preview\\ Content/PreviewContent.swift SwiftUI-WorkoutApp/Preview\\ Content";
14781478
DEVELOPMENT_TEAM = CR68PP2Z3F;
14791479
ENABLE_PREVIEWS = YES;

SwiftUI-WorkoutApp/Constants.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ enum Constants {
55
static let photosLimit = 15
66
static let minUserAge = Calendar.current.date(byAdding: .year, value: -13, to: .now) ?? .now
77
static let maxEventFutureDate = Calendar.current.date(byAdding: .year, value: 1, to: .now) ?? .now
8-
static let incognitoInfoText = "Зарегистрируйтесь или авторизуйтесь, чтобы иметь доступ ко всем возможностям"
8+
static let authInvitationText = "Авторизуйтесь, чтобы иметь доступ ко всем возможностям"
9+
static let registrationInfoText = "Регистрация доступна на сайте workout.su"
910
static let appVersion = (Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String).valueOrEmpty
1011
static let appReviewURL = URL(string: "https://apps.apple.com/app/id1035159361?action=write-review")!
1112
static let workoutShopURL = URL(string: "https://workoutshop.ru")!

SwiftUI-WorkoutApp/Screens/Profile/IncognitoProfileView.swift

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@ import SwiftUI
22

33
/// Заглушка для неавторизованного пользователя
44
struct IncognitoProfileView: View {
5-
@State private var openRegistrationPage = false
6-
75
var body: some View {
86
VStack(spacing: 16) {
9-
incognitoInformer
10-
createAccountButton
7+
authInvitation
118
IncognitoUserButton(mode: .authorize(inForm: false))
9+
registrationInfo
1210
}
1311
.toolbar {
1412
ToolbarItem(placement: .navigationBarTrailing) {
@@ -20,22 +18,17 @@ struct IncognitoProfileView: View {
2018
}
2119

2220
private extension IncognitoProfileView {
23-
var incognitoInformer: some View {
24-
Text(Constants.incognitoInfoText)
21+
var authInvitation: some View {
22+
Text(Constants.authInvitationText)
2523
.font(.title3)
2624
.multilineTextAlignment(.center)
27-
.padding()
25+
.padding(.horizontal)
2826
}
2927

30-
var createAccountButton: some View {
31-
Button {
32-
openRegistrationPage.toggle()
33-
} label: {
34-
IncognitoUserButton.Mode.register(inForm: false).label
35-
}
36-
.sheet(isPresented: $openRegistrationPage) {
37-
SafariVCRepresentable(url: Constants.accountCreationURL)
38-
}
28+
var registrationInfo: some View {
29+
Text(Constants.registrationInfoText)
30+
.font(.subheadline)
31+
.multilineTextAlignment(.center)
3932
}
4033
}
4134

SwiftUI-WorkoutApp/Screens/Profile/Settings/ProfileSettingsView.swift

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import SwiftUI
44
struct ProfileSettingsView: View {
55
@EnvironmentObject private var defaults: DefaultsService
66
@StateObject private var viewModel = ProfileSettingsViewModel()
7-
@State private var openRegistrationPage = false
87
@State private var showLogoutDialog = false
98
@State private var showDeleteProfileDialog = false
109
@State private var showErrorAlert = false
@@ -20,7 +19,6 @@ struct ProfileSettingsView: View {
2019
changePasswordButton
2120
logoutButton
2221
} else {
23-
registerButton
2422
authorizeButton
2523
}
2624
} header: {
@@ -76,7 +74,7 @@ private extension ProfileSettingsView.Mode {
7674
case .authorized:
7775
EmptyView()
7876
case .incognito:
79-
Text(Constants.incognitoInfoText)
77+
Text(Constants.registrationInfoText)
8078
}
8179
}
8280

@@ -137,18 +135,6 @@ private extension ProfileSettingsView {
137135
deleteProfileTask = Task { await viewModel.deleteProfile(with: defaults) }
138136
}
139137

140-
var registerButton: some View {
141-
Button {
142-
openRegistrationPage.toggle()
143-
} label: {
144-
IncognitoUserButton.Mode.register(inForm: true).label
145-
.font(.system(.body).bold())
146-
}
147-
.sheet(isPresented: $openRegistrationPage) {
148-
SafariVCRepresentable(url: Constants.accountCreationURL)
149-
}
150-
}
151-
152138
var authorizeButton: some View {
153139
NavigationLink(destination: LoginView()) {
154140
Label("Авторизация", systemImage: "arrow.forward.circle.fill")

SwiftUI-WorkoutApp/Services/APIService.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ struct APIService {
3737
}
3838

3939
/// Выполняет регистрацию пользователя
40+
///
41+
/// Приложение не пропускают в `appstore`, пока на бэке поля "пол" и "дата рождения" являются обязательными
4042
/// - Parameter model: необходимые для регистрации данные
4143
/// - Returns: Вся информация о пользователе
4244
func registration(with model: MainUserForm) async throws {

0 commit comments

Comments
 (0)