Files
iceglass/IceGlass/AppDelegate.swift
T
rzen 57358797e1 Add playoff round view, game numbers, goal scorer notifications, standings
- Fetch NHL standings and surface league/season game counts in the menu bar
- Prefix regular-season rows with the league-wide game number (from gameId)
- New ROUND section shows each active playoff series (matchup, series score,
  next game number + time) derived from /v1/playoff-bracket; rows always open
  the NHL series page so completed series remain clickable
- Goal notifications include scorer sweater, abbreviated name, and strength
  (PPG/SHG/EN), resolved via /v1/gamecenter/{id}/play-by-play
- Drop the per-team filter submenu and NHLTeam enum
- Regenerate AppIcon with the full 10-size macOS set (alpha preserved) so
  notifications render the app icon correctly; rename the iOS marketing PNG
  to icon-ios-1024.png
- gitignore .claude/ local tooling settings
2026-04-18 21:51:27 -04:00

51 lines
1.6 KiB
Swift

//
// AppDelegate.swift
// IceGlass
//
// Copyright 2026 Rouslan Zenetl. All Rights Reserved.
//
import UserNotifications
import AppKit
import CoreServices
class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDelegate {
private let logger = IceGlassLogger(
subsystem: Bundle.main.bundleIdentifier ?? "dev.rzen.indie.IceGlass",
category: "AppDelegate"
)
private var mainService = MainService.shared
func applicationDidFinishLaunching(_ notification: Notification) {
logger.info("applicationDidFinishLaunching")
UNUserNotificationCenter.current().delegate = self
// Force re-register with Launch Services to refresh cached icon
LSRegisterURL(Bundle.main.bundleURL as CFURL, true)
// Set app icon explicitly from .icns (NSImage(named:) doesn't work for App Icon assets)
if let icnsPath = Bundle.main.path(forResource: "AppIcon", ofType: "icns"),
let icon = NSImage(contentsOfFile: icnsPath) {
NSApp.applicationIconImage = icon
}
}
func applicationWillTerminate(_ notification: Notification) {
// nothing to deinit
}
// Notification click handler opens URLs
func userNotificationCenter(
_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void
) {
if let urlString = response.notification.request.content.userInfo["url"] as? String,
let url = URL(string: urlString) {
NSWorkspace.shared.open(url)
}
completionHandler()
}
}