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

sync2
Raz 8 months ago
commit 799341c19c
  1. 2
      PadelClub/AppDelegate.swift
  2. 13
      PadelClub/Data/DataStore.swift

@ -24,6 +24,8 @@ class AppDelegate : NSObject, UIApplicationDelegate, UNUserNotificationCenterDel
return true return true
} }
// MARK: - Remote Notifications
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
if StoreCenter.main.hasToken() { if StoreCenter.main.hasToken() {

@ -98,7 +98,12 @@ class DataStore: ObservableObject {
NotificationCenter.default.addObserver(self, selector: #selector(collectionDidLoad), name: NSNotification.Name.CollectionDidLoad, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(collectionDidLoad), name: NSNotification.Name.CollectionDidLoad, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(collectionDidUpdate), name: NSNotification.Name.CollectionDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(collectionDidUpdate), name: NSNotification.Name.CollectionDidChange, object: nil)
NotificationCenter.default.addObserver(
self,
selector: #selector(_willEnterForegroundNotification),
name: UIScene.willEnterForegroundNotification,
object: nil)
} }
deinit { deinit {
@ -165,6 +170,12 @@ class DataStore: ObservableObject {
self.objectWillChange.send() self.objectWillChange.send()
} }
@objc func _willEnterForegroundNotification() {
Task {
try await self.purchases.loadDataFromServerIfAllowed(clear: true)
}
}
func disconnect() { func disconnect() {
Task { Task {

Loading…
Cancel
Save