Files
KisaniCal/KisaniCal/KisaniCalApp.swift
Robin Kutesa ea869f51b0 feat: Sign in with Apple authentication
- AuthManager: native AuthenticationServices, session in Keychain
- AuthView: branded screen with Apple Sign In button
- App gates ContentView behind auth; animates on sign-in/out
- Settings: Account section shows name/email + Sign Out button
- Entitlements: added com.apple.developer.applesignin

Co-Authored-By: Kutesir <tqwyy79vzn@privaterelay.appleid.com>
2026-06-01 00:44:02 +03:00

55 lines
1.7 KiB
Swift

import SwiftUI
@main
struct KisaniCalApp: App {
@UIApplicationDelegateAdaptor private var appDelegate: AppDelegate
@ObservedObject private var auth = AuthManager.shared
@State private var splashDone = false
var body: some Scene {
WindowGroup {
ZStack {
if auth.isAuthenticated {
ContentView()
.transition(.opacity)
} else {
AuthView()
.transition(.opacity)
}
if !splashDone {
SplashView { splashDone = true }
.transition(.opacity)
}
}
.animation(.easeIn(duration: 0.25), value: splashDone)
.animation(KisaniSpring.entrance, value: auth.isAuthenticated)
}
}
}
final class AppDelegate: NSObject, UIApplicationDelegate {
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
NotificationManager.shared.requestPermission()
ShortcutHandler.registerShortcuts()
// Cold launch from a shortcut
if let item = launchOptions?[.shortcutItem] as? UIApplicationShortcutItem {
ShortcutHandler.shared.handle(item.type)
return false // tells UIKit we handled it
}
return true
}
func application(
_ application: UIApplication,
performActionFor shortcutItem: UIApplicationShortcutItem,
completionHandler: @escaping (Bool) -> Void
) {
ShortcutHandler.shared.handle(shortcutItem.type)
completionHandler(true)
}
}