package de.softwareapp_hb.filemanager import android.app.Application import de.softwareapp_hb.filemanager.data.ContentResolverIncomingSource import de.softwareapp_hb.filemanager.data.DeleteRequestFactory import de.softwareapp_hb.filemanager.data.IncomingSource import de.softwareapp_hb.filemanager.data.MediaStoreDeleter import de.softwareapp_hb.filemanager.data.StorageProvider import de.softwareapp_hb.filemanager.domain.OperationNotifier import de.softwareapp_hb.filemanager.service.ServiceOperationNotifier /** * Application entry point and the app's tiny object graph. * * There is no dependency-injection framework here on purpose: four long-lived collaborators * are built once and handed to the one ViewModel that needs them. Nothing holds a reference * to an Activity, so none of this leaks. */ class FileManagerApplication : Application() { /** Where files live and which backend is in effect. */ lateinit var storage: StorageProvider private set /** Keeps the foreground service in step with a running operation. */ lateinit var notifier: OperationNotifier private set /** Builds the platform's own delete confirmation, when it can. */ lateinit var deleteRequests: DeleteRequestFactory private set /** Reads whatever another app shares in. */ lateinit var incoming: IncomingSource private set override fun onCreate() { super.onCreate() storage = StorageProvider(this) notifier = ServiceOperationNotifier(this) deleteRequests = MediaStoreDeleter(this).factory() incoming = ContentResolverIncomingSource(contentResolver) } }