2023-12-29 11:17:37 +01:00
|
|
|
//Made by Lumaa
|
|
|
|
|
|
|
|
import SwiftUI
|
2024-02-08 08:34:17 +01:00
|
|
|
import TipKit
|
2024-02-22 23:16:08 +01:00
|
|
|
import RevenueCat
|
2023-12-29 11:17:37 +01:00
|
|
|
|
|
|
|
@main
|
|
|
|
struct ThreadedApp: App {
|
2024-02-22 23:16:08 +01:00
|
|
|
init() {
|
2024-08-11 16:25:34 +02:00
|
|
|
guard let plist = AppDelegate.readSecret() else { fatalError("Missing Secret.plist file") }
|
|
|
|
|
2024-02-22 23:16:08 +01:00
|
|
|
if let apiKey = plist["RevenueCat_public"], let deviceId = UIDevice.current.identifierForVendor?.uuidString {
|
|
|
|
#if DEBUG
|
|
|
|
Purchases.logLevel = .debug
|
|
|
|
#endif
|
2024-07-06 00:19:45 +02:00
|
|
|
if #available(iOS 18.0, *) {
|
|
|
|
Purchases.configure(withAPIKey: apiKey, appUserID: deviceId)
|
|
|
|
}
|
2024-02-22 23:16:08 +01:00
|
|
|
}
|
2024-08-11 16:25:34 +02:00
|
|
|
|
2024-08-11 16:31:27 +02:00
|
|
|
ThreadedShortcuts.updateAppShortcutParameters() //might not work?
|
2024-02-22 23:16:08 +01:00
|
|
|
}
|
|
|
|
|
2023-12-29 11:17:37 +01:00
|
|
|
var body: some Scene {
|
|
|
|
WindowGroup {
|
|
|
|
ContentView()
|
|
|
|
.background(Color.appBackground)
|
|
|
|
.onAppear {
|
|
|
|
HapticManager.prepareHaptics()
|
|
|
|
}
|
2024-02-08 08:34:17 +01:00
|
|
|
.task {
|
2024-02-11 18:43:58 +01:00
|
|
|
#if DEBUG
|
|
|
|
Tips.showAllTipsForTesting()
|
2024-08-15 04:36:40 +02:00
|
|
|
UserDefaults.standard.set("ABC", forKey: "lastVersion")
|
2024-02-11 18:43:58 +01:00
|
|
|
#endif
|
2024-02-08 08:34:17 +01:00
|
|
|
|
|
|
|
try? Tips.configure([
|
|
|
|
.displayFrequency(.immediate),
|
|
|
|
.datastoreLocation(.applicationDefault)
|
|
|
|
])
|
|
|
|
}
|
2024-02-22 23:16:08 +01:00
|
|
|
.modelData()
|
2023-12-29 11:17:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-01-27 08:56:54 +01:00
|
|
|
|
2024-06-25 14:33:37 +02:00
|
|
|
public extension View {
|
|
|
|
@ViewBuilder
|
|
|
|
func modelData() -> some View {
|
|
|
|
self
|
2024-08-31 22:41:14 +02:00
|
|
|
.modelContainer(for: [LoggedAccount.self, ModelFilter.self, StatusDraft.self])
|
2024-06-25 14:33:37 +02:00
|
|
|
}
|
|
|
|
}
|