Skip to content

Commit

Permalink
add file name saving for export
Browse files Browse the repository at this point in the history
  • Loading branch information
Razeeman committed Oct 5, 2024
1 parent b82e5e9 commit cf8a880
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ class PrefsRepoImpl @Inject constructor(
KEY_FILE_EXPORT_RANGE_LAST_DAYS, RANGE_LAST_DAYS_DEFAULT,
)

override var csvExportCustomFileName: String by prefs.delegate(
KEY_CSV_EXPORT_CUSTOM_FILENAME, "",
)

override var icsExportCustomFileName: String by prefs.delegate(
KEY_ICS_EXPORT_CUSTOM_FILENAME, "",
)

override var keepStatisticsRange: Boolean by prefs.delegate(
KEY_KEEP_STATISTICS_RANGE, false,
)
Expand Down Expand Up @@ -529,6 +537,8 @@ class PrefsRepoImpl @Inject constructor(
const val KEY_FILE_EXPORT_RANGE_CUSTOM_START = "fileExportRangeCustomStart"
const val KEY_FILE_EXPORT_RANGE_CUSTOM_END = "fileExportRangeCustomEnd"
const val KEY_FILE_EXPORT_RANGE_LAST_DAYS = "fileExportRangeLastDays"
const val KEY_CSV_EXPORT_CUSTOM_FILENAME = "csvExportCustomFilename"
const val KEY_ICS_EXPORT_CUSTOM_FILENAME = "icsExportCustomFilename"
const val KEY_KEEP_STATISTICS_RANGE = "keepStatisticsRange"
const val KEY_FIRST_DAY_OF_WEEK = "firstDayOfWeek"
const val KEY_START_OF_DAY_SHIFT = "startOfDayShift"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.example.util.simpletimetracker.data_local.repo.PrefsRepoImpl.Companio
import com.example.util.simpletimetracker.data_local.repo.PrefsRepoImpl.Companion.KEY_CATEGORY_ORDER
import com.example.util.simpletimetracker.data_local.repo.PrefsRepoImpl.Companion.KEY_CATEGORY_ORDER_MANUAL
import com.example.util.simpletimetracker.data_local.repo.PrefsRepoImpl.Companion.KEY_CHART_FILTER_TYPE
import com.example.util.simpletimetracker.data_local.repo.PrefsRepoImpl.Companion.KEY_CSV_EXPORT_CUSTOM_FILENAME
import com.example.util.simpletimetracker.data_local.repo.PrefsRepoImpl.Companion.KEY_DARK_MODE_2
import com.example.util.simpletimetracker.data_local.repo.PrefsRepoImpl.Companion.KEY_DAYS_IN_CALENDAR
import com.example.util.simpletimetracker.data_local.repo.PrefsRepoImpl.Companion.KEY_DEFAULT_TYPES_HIDDEN
Expand All @@ -25,6 +26,7 @@ import com.example.util.simpletimetracker.data_local.repo.PrefsRepoImpl.Companio
import com.example.util.simpletimetracker.data_local.repo.PrefsRepoImpl.Companion.KEY_FILE_EXPORT_RANGE_CUSTOM_START
import com.example.util.simpletimetracker.data_local.repo.PrefsRepoImpl.Companion.KEY_FILE_EXPORT_RANGE_LAST_DAYS
import com.example.util.simpletimetracker.data_local.repo.PrefsRepoImpl.Companion.KEY_FIRST_DAY_OF_WEEK
import com.example.util.simpletimetracker.data_local.repo.PrefsRepoImpl.Companion.KEY_ICS_EXPORT_CUSTOM_FILENAME
import com.example.util.simpletimetracker.data_local.repo.PrefsRepoImpl.Companion.KEY_IGNORE_SHORT_RECORDS_DURATION
import com.example.util.simpletimetracker.data_local.repo.PrefsRepoImpl.Companion.KEY_IGNORE_SHORT_UNTRACKED_DURATION
import com.example.util.simpletimetracker.data_local.repo.PrefsRepoImpl.Companion.KEY_INACTIVITY_REMINDER_DND_END
Expand Down Expand Up @@ -148,6 +150,8 @@ class BackupPrefsRepo @Inject constructor(
PrefsProcessor(KEY_FILE_EXPORT_RANGE_CUSTOM_START, ::fileExportRangeCustomStart),
PrefsProcessor(KEY_FILE_EXPORT_RANGE_CUSTOM_END, ::fileExportRangeCustomEnd),
PrefsProcessor(KEY_FILE_EXPORT_RANGE_LAST_DAYS, ::fileExportRangeLastDays),
PrefsProcessor(KEY_CSV_EXPORT_CUSTOM_FILENAME, ::csvExportCustomFileName),
PrefsProcessor(KEY_ICS_EXPORT_CUSTOM_FILENAME, ::icsExportCustomFileName),
PrefsProcessor(KEY_KEEP_STATISTICS_RANGE, ::keepStatisticsRange),
PrefsProcessor(KEY_FIRST_DAY_OF_WEEK, ::firstDayOfWeek),
PrefsProcessor(KEY_START_OF_DAY_SHIFT, ::startOfDayShift),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,22 @@ class PrefsInteractor @Inject constructor(
prefsRepo.fileExportRangeLastDays
}

suspend fun getCsvExportCustomFileName(): String = withContext(Dispatchers.IO) {
prefsRepo.csvExportCustomFileName
}

suspend fun setCsvExportCustomFileName(value: String) = withContext(Dispatchers.IO) {
prefsRepo.csvExportCustomFileName = value
}

suspend fun getIcsExportCustomFileName(): String = withContext(Dispatchers.IO) {
prefsRepo.icsExportCustomFileName
}

suspend fun setIcsExportCustomFileName(value: String) = withContext(Dispatchers.IO) {
prefsRepo.icsExportCustomFileName = value
}

suspend fun getKeepStatisticsRange(): Boolean = withContext(Dispatchers.IO) {
prefsRepo.keepStatisticsRange
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ interface PrefsRepo {
var fileExportRangeCustomEnd: Long
var fileExportRangeLastDays: Int

var csvExportCustomFileName: String
var icsExportCustomFileName: String

var keepStatisticsRange: Boolean

var firstDayOfWeek: Int
Expand Down

0 comments on commit cf8a880

Please sign in to comment.