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
}
// MARK: - Remote Notifications
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
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(collectionDidUpdate), name: NSNotification.Name.CollectionDidChange, object: nil)
NotificationCenter.default.addObserver(
self,
selector: #selector(_willEnterForegroundNotification),
name: UIScene.willEnterForegroundNotification,
object: nil)
}
deinit {
@ -165,6 +170,12 @@ class DataStore: ObservableObject {
self.objectWillChange.send()
}
@objc func _willEnterForegroundNotification() {
Task {
try await self.purchases.loadDataFromServerIfAllowed(clear: true)
}
}
func disconnect() {
Task {

Loading…
Cancel
Save