TrackImportRepositoryImpl

class TrackImportRepositoryImpl @Inject constructor(context: Context, dao: TrackDao, importerFactory: ImporterFactory) : TrackImportRepository

Implementation of TrackImportRepository that handles importing tracks from different file formats.

Parameters

context

Application context, used for content resolver access.

Constructors

Link copied to clipboard
@Inject
constructor(context: Context, dao: TrackDao, importerFactory: ImporterFactory)

Functions

Link copied to clipboard

Detect the file format by reading the first line of the file. Currently supports detecting GPX and KML formats.

Link copied to clipboard
fun getFileName(context: Context, uri: Uri): String?

Helper method to retrieve the display name of a file given its Uri by querying the content resolver.

Link copied to clipboard
fun getFileSize(context: Context, uri: Uri): Long

Helper method to retrieve the size of a file

Link copied to clipboard
open suspend override fun importTrack(fileUri: Uri): Flow<DataStreamProgress>

Import a track from the given file Uri. Detects the file format and uses appropriate parser.