mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
add auto backup on permissions granted (#1632)
* add auto backup on permissions granted * change to set and add logic to else * no longer need counter --------- Co-authored-by: Seishirou <Seishirou@sol-horizon.xyz>
This commit is contained in:
parent
2e7fbf2059
commit
60dd9716ad
3 changed files with 4 additions and 2 deletions
|
@ -246,7 +246,6 @@ class PreferencesHelper(val context: Context) {
|
|||
fun numberOfBackups() = flowPrefs.getInt(Keys.numberOfBackups, 2)
|
||||
|
||||
fun backupInterval() = flowPrefs.getInt(Keys.backupInterval, 0)
|
||||
|
||||
fun removeAfterReadSlots() = flowPrefs.getInt(Keys.removeAfterReadSlots, -1)
|
||||
|
||||
fun removeAfterMarkedAsRead() = prefs.getBoolean(Keys.removeAfterMarkedAsRead, false)
|
||||
|
|
|
@ -39,7 +39,6 @@ class SettingsBackupController : SettingsController() {
|
|||
* Flags containing information of what to backup.
|
||||
*/
|
||||
private var backupFlags = 0
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
requestFilePermissionsSafe(500, preferences)
|
||||
|
|
|
@ -46,6 +46,7 @@ import com.bluelinelabs.conductor.ControllerChangeType
|
|||
import com.bluelinelabs.conductor.Router
|
||||
import com.bluelinelabs.conductor.RouterTransaction
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.backup.BackupCreatorJob
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.databinding.MainActivityBinding
|
||||
import eu.kanade.tachiyomi.ui.base.SmallToolbarInterface
|
||||
|
@ -774,6 +775,9 @@ fun Controller.requestFilePermissionsSafe(
|
|||
}
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show()
|
||||
} else if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.R || Environment.isExternalStorageManager()) && preferences.backupInterval().isNotSet()) {
|
||||
preferences.backupInterval().set(24)
|
||||
BackupCreatorJob.setupTask(activity, 24)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue