Merge pull request #1172 from kiwix/remove-live-activities

Remove live activities for release
This commit is contained in:
Kelson 2025-04-20 14:10:12 +02:00 committed by GitHub
commit 0ca1320c0e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 64 deletions

View File

@ -17,7 +17,6 @@
import SwiftUI
import Combine
import UserNotifications
import BackgroundTasks
import os
@main
@ -29,23 +28,14 @@ struct Kiwix: App {
@StateObject private var navigation = NavigationViewModel()
@UIApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
private let fileMonitor: DirectoryMonitor
private let activityService: ActivityService?
init() {
fileMonitor = DirectoryMonitor(url: URL.documentDirectory) { LibraryOperations.scanDirectory($0) }
// MARK: - live activities
switch AppType.current {
case .kiwix:
activityService = ActivityService.shared()
case .custom:
activityService = nil
}
UNUserNotificationCenter.current().delegate = appDelegate
// MARK: - migrations
if !ProcessInfo.processInfo.arguments.contains("testing") {
_ = MigrationService().migrateAll()
}
}
var body: some Scene {
@ -69,7 +59,8 @@ struct Kiwix: App {
library.start(isUserInitiated: false)
}
case .background:
reScheduleBackgroundDownloadTask()
break
// reScheduleBackgroundDownloadTask()
@unknown default:
break
}
@ -78,14 +69,7 @@ struct Kiwix: App {
if url.isFileURL {
NotificationCenter.openFiles([url], context: .file)
} else if url.isZIMURL {
switch url {
case DownloadActivityAttributes.downloadsDeepLink:
if FeatureFlags.hasLibrary {
navigation.showDownloads.send()
}
default:
NotificationCenter.openURL(url)
}
NotificationCenter.openURL(url)
}
}
.task {
@ -97,7 +81,6 @@ struct Kiwix: App {
LibraryOperations.scanDirectory(URL.documentDirectory)
LibraryOperations.applyFileBackupSetting()
DownloadService.shared.restartHeartbeatIfNeeded()
activityService?.start()
case let .custom(zimFileURL):
await LibraryOperations.open(url: zimFileURL)
ZimMigration.forCustomApps()
@ -118,33 +101,6 @@ struct Kiwix: App {
PageZoomCommands()
}
}
.backgroundTask(.appRefresh(BackgroundDownloads.identifier)) { _ in
await reScheduleBackgroundDownloadTask()
await ActivityService.shared().forceUpdate()
}
}
func reScheduleBackgroundDownloadTask() {
guard case .kiwix = AppType.current else { return }
do {
let date = BackgroundDownloads.nextDate()
let request = BGAppRefreshTaskRequest(identifier: BackgroundDownloads.identifier)
request.earliestBeginDate = date
os_log(
"BackgroundDownloads task re-scheduled for: %s",
log: Log.DownloadService,
type: .debug,
date.formatted()
)
try BGTaskScheduler.shared.submit(request)
} catch {
os_log(
"BackgroundDownloads re-schedule failed: %s",
log: Log.DownloadService,
type: .error,
error.localizedDescription
)
}
}
private class AppDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCenterDelegate {

View File

@ -121,10 +121,6 @@ targets:
- path: Kiwix/SplashScreenKiwix.storyboard
destinationFilters:
- iOS
dependencies:
- target: Widgets
destinationFilters:
- iOS
UnitTests:
type: bundle.unit-test
supportedDestinations: [iOS, macOS]
@ -143,19 +139,6 @@ targets:
- path: Tests
dependencies:
- target: Kiwix
Widgets:
type: app-extension
supportedDestinations: [iOS]
settings:
base:
PRODUCT_BUNDLE_IDENTIFIER: self.Kiwix.ioswidgets
INFOPLIST_FILE: Widgets/Info.plist
sources:
- path: Common
- path: Widgets
dependencies:
- framework: SwiftUI.framework
- framework: WidgetKit.framework
schemes:
Kiwix: