Bubble/Threaded/ThreadedApp.swift

55 lines
1.5 KiB
Swift

//Made by Lumaa
import SwiftUI
import TipKit
import RevenueCat
@main
struct ThreadedApp: App {
init() {
guard let plist = AppDelegate.readSecret() else { return }
if let apiKey = plist["RevenueCat_public"], let deviceId = UIDevice.current.identifierForVendor?.uuidString {
#if DEBUG
Purchases.logLevel = .debug
#endif
if #available(iOS 18.0, *) {
Purchases.configure(withAPIKey: apiKey, appUserID: deviceId)
}
}
}
var body: some Scene {
WindowGroup {
ContentView()
.background(Color.appBackground)
.onAppear {
HapticManager.prepareHaptics()
}
.task {
#if DEBUG
Tips.showAllTipsForTesting()
UserDefaults.standard.removeObject(forKey: "lastVersion")
#endif
try? Tips.configure([
.displayFrequency(.immediate),
.datastoreLocation(.applicationDefault)
])
}
.modelData()
}
}
}
public extension View {
@ViewBuilder
func modelData() -> some View {
self
.modelContainer(for: [LoggedAccount.self, ModelFilter.self])
}
}
extension AppInfo {
static var appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown"
}