Skip to content

Commit a3d5fef

Browse files
committed
Cleanup + enable background notifications
1 parent a75b30b commit a3d5fef

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

PennMobile/Dining/SwiftUI/Views/Venue/Detail View/DiningVenueDetailMenuView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ struct DiningVenueDetailMenuView: View {
2020
}.onChange(of: menuDate) { newMenuDate in
2121
diningVM.refreshMenu(for: id, at: newMenuDate)
2222
}
23-
23+
2424
Text("Penn has recently changed the process in which Penn Labs can access menu data. We are working as fast as possible to fix this. We apologize for the inconvenience.")
25-
//
25+
2626
// ForEach(menus, id: \.self) { menu in
2727
// DiningMenuRow(for: menu)
2828
// .transition(.opacity)

PennMobile/Setup + Navigation/AppDelegate+NotificationExtension.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88

99
import Foundation
10+
import SwiftyJSON
1011

1112
extension AppDelegate: UNUserNotificationCenterDelegate {
1213

@@ -43,6 +44,14 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
4344
UNUserNotificationCenter.current().setNotificationCategories([upcomingGSRCategory])
4445
}
4546

47+
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) async -> UIBackgroundFetchResult {
48+
if let (_, _) = try? await URLSession.shared.data(from: URL(string: "https://pennmobile.org/api/")!) {
49+
return .newData
50+
} else {
51+
return .failed
52+
}
53+
}
54+
4655
func userNotificationCenter(
4756
_ center: UNUserNotificationCenter,
4857
didReceive response: UNNotificationResponse,

PennMobile/Setup + Navigation/AppDelegate.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2727

2828
// Register to receive delegate actions from rich notifications
2929
UNUserNotificationCenter.current().delegate = self
30+
UIApplication.shared.registerForRemoteNotifications()
3031

3132
FirebaseApp.configure()
3233
ControllerModel.shared.prepare()

0 commit comments

Comments
 (0)