Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 SportApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@
CODE_SIGN_ENTITLEMENTS = SportApp/SportApp.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = G479H54RSF;
DEVELOPMENT_TEAM = B2YMYHDTYQ;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = SportApp/Info.plist;
Expand All @@ -464,7 +464,7 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = SportAppIOSqwertyu;
PRODUCT_BUNDLE_IDENTIFIER = SportAppIOSqwertyuqqwerty;
PRODUCT_NAME = "$(TARGET_NAME)";
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor;
Expand All @@ -483,7 +483,7 @@
CODE_SIGN_ENTITLEMENTS = SportApp/SportApp.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = G479H54RSF;
DEVELOPMENT_TEAM = B2YMYHDTYQ;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = SportApp/Info.plist;
Expand All @@ -498,7 +498,7 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = SportAppIOSqwertyu;
PRODUCT_BUNDLE_IDENTIFIER = SportAppIOSqwertyuqqwerty;
PRODUCT_NAME = "$(TARGET_NAME)";
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor;
Expand Down
25 changes: 23 additions & 2 deletions SportApp/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,26 @@ struct HomeView: View {
sheetView(for: sheet)
.interactiveDismissDisabled(true)
}
// .onAppear() {
// if let token = UserDefaults.standard.string(forKey: "auth_token") {
// print(token + " aaaaaaaaaaaaaa")
// if viewModelOfRegistration.getTokenExpiration(token) ?? Date() > Date() {
// isAuthenticated = true
// viewModelOfRegistration.token = token
// viewModelOfRegistration.loadUser(token)
// //coordinator.user = viewModelOfRegistration.user
// print(0)
// }
// }
// }
// .onChange(of: viewModelOfRegistration.user) {
// if let user = viewModelOfRegistration.user {
// coordinator.user = user
// print(1111111111)
// print(user)
// print(1111111111)
// }
// }
}

var tabbar: some View {
Expand All @@ -46,13 +66,14 @@ struct HomeView: View {
.tag(0) // исправить потом

NavigationStack() {
ProfileView()
ProfileView(isActive: $isAuthenticated)
.environmentObject(coordinator)
.environmentObject(viewModelOfRegistration)
}
.tabItem {
Label("Профиль", systemImage: "person.crop.circle")
}
.tag(1)
.tag(1)
}
}

Expand Down
23 changes: 22 additions & 1 deletion SportApp/Navigation/Coordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Combine
class Coordinator: ObservableObject {
@Published var tournirListPath = NavigationPath()
@Published var presentedSheet: ModalSheet?
@Published var user: User = User(phio: "", password: "", email: "", isAdmin: false)
@Published var user: User = User(id: UUID(), phio: "", password: "", email: "", isAdmin: false)
@Published var currentTournir: Tournir?

func presentSheet(_ sheet: ModalSheet) {
Expand All @@ -32,4 +32,25 @@ class Coordinator: ObservableObject {
print(currentTournir!.users)
}
}

func updateUser() {
Task {
let userEndpoint = UserPatchEndpoint(userId: user.id.uuidString)
let userRequest = UserDTO(user: user)
//userRequest.age = 123456789

//print(user.id.uuidString)
//print(userRequest)

do {
let _: UserDTO = try await NetworkService.shared.request(
endpoint: userEndpoint,
requestDTO: userRequest
)
//print(respone)
} catch {
print(error)
}
}
}
}
1 change: 1 addition & 0 deletions SportApp/NetworkService/Data/APIRoutes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ struct APIRoutes {
let getTournirs: String = "/api/v1/tournaments"
let login: String = "/api/v1/auth/login"
let register: String = "/api/v1/auth/register"
let getUserInfo: String = "/api/v1/users/<id>"
}
1 change: 1 addition & 0 deletions SportApp/NetworkService/Data/HTTP/HTTPMethod.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ struct HTTPMethod {
static let post = "POST"
static let put = "PUT"
static let delete = "DELETE"
static let patch = "PATCH"
}
Loading
Loading