Merge remote-tracking branch 'refs/remotes/origin/main'

paca_championship
Raz 1 year ago
commit 87758354c6
  1. 4
      PadelClub/Data/DataStore.swift
  2. 11
      PadelClub/Views/Tournament/Subscription/Guard.swift
  3. 5
      PadelClub/Views/User/AccountView.swift

@ -101,6 +101,10 @@ class DataStore: ObservableObject {
}
deinit {
NotificationCenter.default.removeObserver(self)
}
func saveUser() {
do {
if user.username.count > 0 {

@ -20,7 +20,6 @@ import LeStorage
var updateListenerTask: Task<Void, Never>? = nil
override init() {
super.init()
@ -34,10 +33,20 @@ import LeStorage
Logger.error(error)
}
}
NotificationCenter.default.addObserver(self, selector: #selector(collectionDidLoad), name: NSNotification.Name.CollectionDidLoad, object: nil)
}
deinit {
self.updateListenerTask?.cancel()
NotificationCenter.default.removeObserver(self)
}
@objc func collectionDidLoad(notification: Notification) {
if let _ = notification.object as? StoredCollection<Purchase> {
self._updateBestPlan()
}
}
func productIds() async -> [String] {

@ -15,6 +15,11 @@ struct AccountView: View {
var body: some View {
Form {
#if DEBUG
if let purchase = Guard.main.currentBestPurchase, let item = StoreItem(rawValue: purchase.productId) {
PurchaseView(purchaseRow: PurchaseRow(id: purchase.id, name: purchase.productId, item: item))
}
#endif
Section {
NavigationLink("Changer de mot de passe") {
ChangePasswordView()

Loading…
Cancel
Save