Add comprehensive offline bookmark support with sync capabilities: - Implement offline bookmark storage using Core Data with App Group sharing - Add Share Extension support for saving bookmarks when server unavailable - Create LocalBookmarksSyncView for managing offline bookmark queue - Add OfflineSyncManager for automatic and manual sync operations - Implement ServerConnectivity monitoring and status handling - Add badge notifications on More tab for pending offline bookmarks - Fix tag pagination in Share Extension with unique IDs for proper rendering - Update PhoneTabView with event-based badge count updates - Add App Group entitlements for data sharing between main app and extension The offline system provides seamless bookmark saving when disconnected, with automatic sync when connection is restored and manual sync options.
60 lines
1.7 KiB
Swift
60 lines
1.7 KiB
Swift
//
|
|
// readeckApp.swift
|
|
// readeck
|
|
//
|
|
// Created by Ilyas Hallak on 10.06.25.
|
|
//
|
|
|
|
import SwiftUI
|
|
import netfox
|
|
|
|
@main
|
|
struct readeckApp: App {
|
|
@State private var hasFinishedSetup = true
|
|
@StateObject private var appSettings = AppSettings()
|
|
|
|
var body: some Scene {
|
|
WindowGroup {
|
|
Group {
|
|
if hasFinishedSetup {
|
|
MainTabView()
|
|
} else {
|
|
SettingsServerView()
|
|
.padding()
|
|
}
|
|
}
|
|
.environmentObject(appSettings)
|
|
.preferredColorScheme(appSettings.theme.colorScheme)
|
|
.onAppear {
|
|
#if DEBUG
|
|
NFX.sharedInstance().start()
|
|
#endif
|
|
// Initialize server connectivity monitoring
|
|
_ = ServerConnectivity.shared
|
|
Task {
|
|
await loadSetupStatus()
|
|
}
|
|
}
|
|
.onReceive(NotificationCenter.default.publisher(for: NSNotification.Name("SetupStatusChanged"))) { _ in
|
|
Task {
|
|
await loadSetupStatus()
|
|
}
|
|
}
|
|
.onReceive(NotificationCenter.default.publisher(for: NSNotification.Name("SettingsChanged"))) { _ in
|
|
Task {
|
|
await loadSetupStatus()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private func loadSetupStatus() async {
|
|
let settingsRepository = SettingsRepository()
|
|
hasFinishedSetup = settingsRepository.hasFinishedSetup
|
|
let settings = try? await settingsRepository.loadSettings()
|
|
await MainActor.run {
|
|
appSettings.settings = settings
|
|
}
|
|
}
|
|
}
|