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

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

@ -319,10 +319,10 @@ class SearchViewModel: ObservableObject, Identifiable {
// Remove all characters that are not in the allowedCharacterSet
var text = pasteField.canonicalVersion.components(separatedBy: allowedCharacterSet.inverted).joined().trimmedMultiline
// 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
text = text.replacing(digitPattern, with: "")
text = text.replacing(digitPattern, with: "").trimmingCharacters(in: .whitespacesAndNewlines)
let textStrings: [String] = text.components(separatedBy: .whitespacesAndNewlines)
let nonEmptyStrings: [String] = textStrings.compactMap { $0.isEmpty ? nil : $0 }
@ -367,6 +367,7 @@ class SearchViewModel: ObservableObject, Identifiable {
}
print(predicate)
return predicate
}

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

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

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

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

Loading…
Cancel
Save