Moved shared config to commons lib

This commit is contained in:
merkost 2023-07-16 09:51:11 +10:00
parent 141ab9f70c
commit 8b815df884
2 changed files with 1 additions and 22 deletions

View File

@ -1,7 +1,6 @@
package com.simplemobiletools.contacts.pro.helpers
import android.content.Context
import android.os.Environment
import com.simplemobiletools.commons.helpers.BaseConfig
import com.simplemobiletools.commons.helpers.SHOW_TABS
@ -14,23 +13,8 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getInt(SHOW_TABS, ALL_TABS_MASK)
set(showTabs) = prefs.edit().putInt(SHOW_TABS, showTabs).apply()
var autoBackup: Boolean
get() = prefs.getBoolean(AUTO_BACKUP, false)
set(enableAutomaticBackups) = prefs.edit().putBoolean(AUTO_BACKUP, enableAutomaticBackups).apply()
var autoBackupFolder: String
get() = prefs.getString(AUTO_BACKUP_FOLDER, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).absolutePath)!!
set(autoBackupPath) = prefs.edit().putString(AUTO_BACKUP_FOLDER, autoBackupPath).apply()
var autoBackupFilename: String
get() = prefs.getString(AUTO_BACKUP_FILENAME, "")!!
set(autoBackupFilename) = prefs.edit().putString(AUTO_BACKUP_FILENAME, autoBackupFilename).apply()
var autoBackupContactSources: Set<String>
get() = prefs.getStringSet(AUTO_BACKUP_CONTACT_SOURCES, setOf())!!
set(autoBackupContactTypes) = prefs.edit().remove(AUTO_BACKUP_CONTACT_SOURCES).putStringSet(AUTO_BACKUP_CONTACT_SOURCES, autoBackupContactTypes).apply()
set(autoBackupContactSources) = prefs.edit().remove(AUTO_BACKUP_CONTACT_SOURCES).putStringSet(AUTO_BACKUP_CONTACT_SOURCES, autoBackupContactSources).apply()
var lastAutoBackupTime: Long
get() = prefs.getLong(LAST_AUTO_BACKUP_TIME, 0L)
set(lastAutoBackupTime) = prefs.edit().putLong(LAST_AUTO_BACKUP_TIME, lastAutoBackupTime).apply()
}

View File

@ -17,11 +17,6 @@ const val AVOID_CHANGING_VISIBILITY_TAG = "avoid_changing_visibility_tag"
const val AUTOMATIC_BACKUP_REQUEST_CODE = 10001
const val AUTO_BACKUP_INTERVAL_IN_DAYS = 1
const val AUTO_BACKUP = "auto_backup"
const val AUTO_BACKUP_FOLDER = "auto_backup_folder"
const val AUTO_BACKUP_FILENAME = "auto_backup_filename"
const val LAST_AUTO_BACKUP_TIME = "last_auto_backup_time"
const val AUTO_BACKUP_CONTACT_SOURCES = "auto_backup_contact_sources"
// extras used at third party intents