Merge pull request #1253 from Aga-C/remove-remembering-settings-file-name

Removed remembering settings file name
This commit is contained in:
Tibor Kaputa 2022-01-14 13:11:54 +01:00 committed by GitHub
commit 2c0e2de12d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 12 deletions

View file

@ -733,13 +733,8 @@ abstract class BaseSimpleActivity : AppCompatActivity() {
}
private fun getExportSettingsFilename(): String {
var defaultFilename = baseConfig.lastExportedSettingsFile
if (defaultFilename.isEmpty()) {
val appName = baseConfig.appId.removeSuffix(".debug").removeSuffix(".pro").removePrefix("com.simplemobiletools.")
defaultFilename = "$appName-settings_${getCurrentFormattedDateTime()}.txt"
}
return defaultFilename
val appName = baseConfig.appId.removeSuffix(".debug").removeSuffix(".pro").removePrefix("com.simplemobiletools.")
return "$appName-settings_${getCurrentFormattedDateTime()}.txt"
}
@SuppressLint("InlinedApi")

View file

@ -45,7 +45,6 @@ class ExportSettingsDialog(val activity: BaseSimpleActivity, val defaultFilename
return@setOnClickListener
}
activity.baseConfig.lastExportedSettingsFile = filename
val newPath = "${folder.trimEnd('/')}/$filename"
if (!newPath.getFilenameFromPath().isAValidFilename()) {
activity.toast(R.string.filename_invalid_characters)

View file

@ -440,10 +440,6 @@ open class BaseConfig(val context: Context) {
get() = prefs.getString(LAST_EXPORTED_SETTINGS_FOLDER, "")!!
set(lastExportedSettingsFolder) = prefs.edit().putString(LAST_EXPORTED_SETTINGS_FOLDER, lastExportedSettingsFolder).apply()
var lastExportedSettingsFile: String
get() = prefs.getString(LAST_EXPORTED_SETTINGS_FILE, "")!!
set(lastExportedSettingsFile) = prefs.edit().putString(LAST_EXPORTED_SETTINGS_FILE, lastExportedSettingsFile).apply()
var lastBlockedNumbersExportPath: String
get() = prefs.getString(LAST_BLOCKED_NUMBERS_EXPORT_PATH, "")!!
set(lastBlockedNumbersExportPath) = prefs.edit().putString(LAST_BLOCKED_NUMBERS_EXPORT_PATH, lastBlockedNumbersExportPath).apply()