Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Threema/Threema/Onboarding/   (Social Medium ©)  Datei vom 26.9.2026 mit Größe 2 kB image not shown  

Quelle  SetupApp.swift   Sprache: JAVA

 

import Foundation
import RemoteSecretProtocol
import ThreemaFramework
import ThreemaMacros
import UIKit

// MARK: - SetupApp

/// Migration steps that have to run once an identity is available, both on a normal launch and at the end of
/// onboarding.
///
/// The remote secret and keychain setup that used to live here is now owned by `RemoteSecretResolver`.
enum SetupApp {

    @MainActor @discardableResult static func runDatabaseMigrationIfNeeded(
        remoteSecretManager: RemoteSecretManagerProtocol
    ) async throws -> DatabaseManagerProtocol {
        let databaseManager = AppLaunchManager.shared
            .initializeDatabaseManager(remoteSecretManager: remoteSecretManager)

        #if DEBUG
            AppLaunchManager.shared.importOldVersionDatabase(databaseManager: databaseManager)
        #endif

        if AppLaunchManager.shared.isRepairedDatabaseImportRequired {
            try await SpinnerPresenter.presentSpinner(
                label: #localize("updating_database"),
                window: SharedAppProvider.window
            ) {
                try AppLaunchManager.shared.importRepairedDatabase(databaseManager: databaseManager)
            }
        }

        if try AppLaunchManager.shared.isDatabaseMigrationRequired(databaseManager: databaseManager) {
            try await SpinnerPresenter.presentSpinner(
                label: #localize("updating_database"),
                window: SharedAppProvider.window
            ) {
                try AppLaunchManager.shared.migrateDatabase(databaseManager: databaseManager)
            }
        }

        return databaseManager
    }

    @MainActor static func runAppMigrationIfNeeded(
        businessInjector: BusinessInjectorProtocol
    ) async throws {
        guard AppLaunchManager.shared.isAppMigrationRequired else {
            return
        }

        let appMigration = AppMigration(businessInjector: businessInjector)

        if AppSetup.hasPreexistingDatabaseFile {
            try appMigration.run()
        }
        else {
            appMigration.updateAppMigrationVersionToLatest()
        }
    }
}

Messung
CHZG
939610096

¤ Dauer der Verarbeitung: 0.2 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover


Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.