fix animation glitch rowbutton view

fix search tournament city management
fix add team mad memory issue
sync2
Raz 9 months ago
parent 892c5e29dc
commit 31b13125f9
  1. 8
      PadelClub.xcodeproj/project.pbxproj
  2. 2
      PadelClub/Utils/LocationManager.swift
  3. 5
      PadelClub/ViewModel/SearchViewModel.swift
  4. 9
      PadelClub/Views/Components/RowButtonView.swift
  5. 26
      PadelClub/Views/Navigation/Agenda/TournamentLookUpView.swift
  6. 2
      PadelClub/Views/Tournament/Screen/AddTeamView.swift
  7. 2
      PadelClub/Views/Tournament/Screen/InscriptionManagerView.swift

@ -3302,7 +3302,7 @@
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements; CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2; CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
@ -3329,7 +3329,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.1.6; MARKETING_VERSION = 1.1.7;
PRODUCT_BUNDLE_IDENTIFIER = app.padelclub; PRODUCT_BUNDLE_IDENTIFIER = app.padelclub;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
@ -3350,7 +3350,7 @@
CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements; CODE_SIGN_ENTITLEMENTS = PadelClub/PadelClub.entitlements;
CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 2; CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES; DEFINES_MODULE = YES;
DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"PadelClub/Preview Content\"";
DEVELOPMENT_TEAM = BQ3Y44M3Q6; DEVELOPMENT_TEAM = BQ3Y44M3Q6;
@ -3376,7 +3376,7 @@
"$(inherited)", "$(inherited)",
"@executable_path/Frameworks", "@executable_path/Frameworks",
); );
MARKETING_VERSION = 1.1.6; MARKETING_VERSION = 1.1.7;
PRODUCT_BUNDLE_IDENTIFIER = app.padelclub; PRODUCT_BUNDLE_IDENTIFIER = app.padelclub;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";

@ -37,6 +37,8 @@ class LocationManager: NSObject, ObservableObject, CLLocationManagerDelegate {
func requestLocation() { func requestLocation() {
lastError = nil lastError = nil
manager.requestLocation() manager.requestLocation()
city = nil
location = nil
requestStarted = true requestStarted = true
} }

@ -319,10 +319,10 @@ class SearchViewModel: ObservableObject, Identifiable {
// Remove all characters that are not in the allowedCharacterSet // Remove all characters that are not in the allowedCharacterSet
var text = pasteField.canonicalVersion.components(separatedBy: allowedCharacterSet.inverted).joined().trimmedMultiline var text = pasteField.canonicalVersion.components(separatedBy: allowedCharacterSet.inverted).joined().trimmedMultiline
// Define the regex pattern to match digits // Define the regex pattern to match digits
let digitPattern = /\d+/ let digitPattern = /\b\w*\d\w*\b/
// Replace all occurrences of the pattern (digits) with an empty string // Replace all occurrences of the pattern (digits) with an empty string
text = text.replacing(digitPattern, with: "") text = text.replacing(digitPattern, with: "").trimmingCharacters(in: .whitespacesAndNewlines)
let textStrings: [String] = text.components(separatedBy: .whitespacesAndNewlines) let textStrings: [String] = text.components(separatedBy: .whitespacesAndNewlines)
let nonEmptyStrings: [String] = textStrings.compactMap { $0.isEmpty ? nil : $0 } let nonEmptyStrings: [String] = textStrings.compactMap { $0.isEmpty ? nil : $0 }
@ -367,6 +367,7 @@ class SearchViewModel: ObservableObject, Identifiable {
} }
print(predicate)
return predicate return predicate
} }

@ -15,28 +15,31 @@ struct RowButtonView: View {
var systemImage: String? = nil var systemImage: String? = nil
var image: String? = nil var image: String? = nil
let confirmationMessage: String let confirmationMessage: String
let cornerRadius: CGFloat
var action: (() -> ())? = nil var action: (() -> ())? = nil
var asyncAction: (() async -> ())? = nil var asyncAction: (() async -> ())? = nil
@State private var askConfirmation: Bool = false @State private var askConfirmation: Bool = false
@State private var isLoading = false @State private var isLoading = false
init(_ title: String, role: ButtonRole? = nil, systemImage: String? = nil, image: String? = nil, confirmationMessage: String? = nil, action: @escaping (() -> ())) { init(_ title: String, role: ButtonRole? = nil, systemImage: String? = nil, image: String? = nil, cornerRadius: CGFloat = 8, confirmationMessage: String? = nil, action: @escaping (() -> ())) {
self.role = role self.role = role
self.title = title self.title = title
self.systemImage = systemImage self.systemImage = systemImage
self.image = image self.image = image
self.confirmationMessage = confirmationMessage ?? defaultConfirmationMessage self.confirmationMessage = confirmationMessage ?? defaultConfirmationMessage
self.action = action self.action = action
self.cornerRadius = cornerRadius
} }
init(_ title: String, role: ButtonRole? = nil, systemImage: String? = nil, image: String? = nil, confirmationMessage: String? = nil, asyncAction: @escaping (() async -> ())) { init(_ title: String, role: ButtonRole? = nil, systemImage: String? = nil, image: String? = nil, cornerRadius: CGFloat = 8, confirmationMessage: String? = nil, asyncAction: @escaping (() async -> ())) {
self.role = role self.role = role
self.title = title self.title = title
self.systemImage = systemImage self.systemImage = systemImage
self.image = image self.image = image
self.confirmationMessage = confirmationMessage ?? defaultConfirmationMessage self.confirmationMessage = confirmationMessage ?? defaultConfirmationMessage
self.asyncAction = asyncAction self.asyncAction = asyncAction
self.cornerRadius = cornerRadius
} }
var body: some View { var body: some View {
@ -79,7 +82,7 @@ struct RowButtonView: View {
if isLoading { if isLoading {
ZStack { ZStack {
Color.master Color.master
.cornerRadius(20) .cornerRadius(cornerRadius)
ProgressView() ProgressView()
.tint(.white) .tint(.white)
} }

@ -14,6 +14,7 @@ struct TournamentLookUpView: View {
@Environment(FederalDataViewModel.self) var federalDataViewModel: FederalDataViewModel @Environment(FederalDataViewModel.self) var federalDataViewModel: FederalDataViewModel
@StateObject var locationManager = LocationManager() @StateObject var locationManager = LocationManager()
@Environment(\.dismiss) private var dismiss @Environment(\.dismiss) private var dismiss
@FocusState private var isFocused: Bool
@State private var searchField: String = "" @State private var searchField: String = ""
@State var page: Int = 0 @State var page: Int = 0
@ -24,6 +25,7 @@ struct TournamentLookUpView: View {
@State private var revealSearchParameters: Bool = true @State private var revealSearchParameters: Bool = true
@State private var presentAlert: Bool = false @State private var presentAlert: Bool = false
@State private var confirmSearch: Bool = false @State private var confirmSearch: Bool = false
@State private var locationRequested = false
var tournaments: [FederalTournament] { var tournaments: [FederalTournament] {
federalDataViewModel.searchedFederalTournaments federalDataViewModel.searchedFederalTournaments
@ -96,8 +98,9 @@ struct TournamentLookUpView: View {
.navigationTitle("Chercher un tournoi") .navigationTitle("Chercher un tournoi")
.navigationBarTitleDisplayMode(.inline) .navigationBarTitleDisplayMode(.inline)
.onChange(of: locationManager.city) { .onChange(of: locationManager.city) {
if let newValue = locationManager.city, dataStore.appSettings.city.isEmpty { if locationRequested, let newValue = locationManager.city {
dataStore.appSettings.city = newValue dataStore.appSettings.city = newValue
locationRequested = false
} }
} }
.toolbarTitleDisplayMode(.large) .toolbarTitleDisplayMode(.large)
@ -309,19 +312,32 @@ struct TournamentLookUpView: View {
HStack { HStack {
TextField("Ville", text: $appSettings.city) TextField("Ville", text: $appSettings.city)
if let city = locationManager.city { .onSubmit(of: .text) {
Divider() locationManager.city = nil
Text(city).italic() locationManager.location = nil
} }
.focused($isFocused)
.onChange(of: isFocused) {
if isFocused {
appSettings.city = ""
}
}
// if let city = locationManager.city {
// Divider()
// Text(city).italic()
// }
if locationManager.requestStarted { if locationManager.requestStarted {
ProgressView() ProgressView()
} else if locationManager.manager.authorizationStatus != .restricted { } else if locationManager.manager.authorizationStatus != .restricted {
LocationButton { LocationButton {
if locationManager.manager.authorizationStatus == .notDetermined { if locationManager.manager.authorizationStatus == .notDetermined {
locationRequested = true
locationManager.manager.requestWhenInUseAuthorization() locationManager.manager.requestWhenInUseAuthorization()
} else if locationManager.manager.authorizationStatus == .denied { } else if locationManager.manager.authorizationStatus == .denied {
showingSettingsAlert = true showingSettingsAlert = true
} else { } else {
locationRequested = true
locationManager.requestLocation() locationManager.requestLocation()
} }
} }

@ -16,7 +16,7 @@ struct AddTeamView: View {
private var fetchRequest: FetchRequest<ImportedPlayer> private var fetchRequest: FetchRequest<ImportedPlayer>
private var fetchPlayers: FetchedResults<ImportedPlayer> { fetchRequest.wrappedValue } private var fetchPlayers: FetchedResults<ImportedPlayer> { fetchRequest.wrappedValue }
var tournament: Tournament let tournament: Tournament
var cancelShouldDismiss: Bool = false var cancelShouldDismiss: Bool = false
enum FocusField: Hashable { enum FocusField: Hashable {
case pasteField case pasteField

@ -247,7 +247,7 @@ struct InscriptionManagerView: View {
} }
if tournament.enableOnlineRegistration { if tournament.enableOnlineRegistration {
RowButtonView("Rafraîchir la liste") { RowButtonView("Rafraîchir la liste", cornerRadius: 20) {
await _refreshList() await _refreshList()
} }
} else if tournament.onlineRegistrationCanBeEnabled() { } else if tournament.onlineRegistrationCanBeEnabled() {

Loading…
Cancel
Save