|
|
@ -96,19 +96,7 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(), |
|
|
|
binding.viewPagerMain.postDelayed(3000) { |
|
|
|
binding.viewPagerMain.postDelayed(3000) { |
|
|
|
viewModel.postLoad() |
|
|
|
viewModel.postLoad() |
|
|
|
} |
|
|
|
} |
|
|
|
launch { |
|
|
|
syncAlert() |
|
|
|
val lastBackupFile = withContext(IO) { AppWebDav.lastBackUp().getOrNull() } |
|
|
|
|
|
|
|
?: return@launch |
|
|
|
|
|
|
|
if (lastBackupFile.lastModify - LocalConfig.lastBackup > DateUtils.MINUTE_IN_MILLIS) { |
|
|
|
|
|
|
|
LocalConfig.lastBackup = lastBackupFile.lastModify |
|
|
|
|
|
|
|
alert("恢复", "webDav书源比本地新,是否恢复") { |
|
|
|
|
|
|
|
cancelButton() |
|
|
|
|
|
|
|
okButton { |
|
|
|
|
|
|
|
viewModel.restoreWebDav(lastBackupFile.displayName) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onNavigationItemSelected(item: MenuItem): Boolean = binding.run { |
|
|
|
override fun onNavigationItemSelected(item: MenuItem): Boolean = binding.run { |
|
|
@ -158,6 +146,26 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(), |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 同步提示 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private fun syncAlert() = launch { |
|
|
|
|
|
|
|
val lastBackupFile = withContext(IO) { AppWebDav.lastBackUp().getOrNull() } |
|
|
|
|
|
|
|
?: return@launch |
|
|
|
|
|
|
|
if (lastBackupFile.lastModify - LocalConfig.lastBackup > DateUtils.MINUTE_IN_MILLIS) { |
|
|
|
|
|
|
|
LocalConfig.lastBackup = lastBackupFile.lastModify |
|
|
|
|
|
|
|
alert("恢复", "webDav书源比本地新,是否恢复") { |
|
|
|
|
|
|
|
cancelButton() |
|
|
|
|
|
|
|
okButton { |
|
|
|
|
|
|
|
viewModel.restoreWebDav(lastBackupFile.displayName) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 用户隐私与协议 |
|
|
|
|
|
|
|
*/ |
|
|
|
private fun privacyPolicy() { |
|
|
|
private fun privacyPolicy() { |
|
|
|
if (LocalConfig.privacyPolicyOk) return |
|
|
|
if (LocalConfig.privacyPolicyOk) return |
|
|
|
val privacyPolicy = String(assets.open("privacyPolicy.md").readBytes()) |
|
|
|
val privacyPolicy = String(assets.open("privacyPolicy.md").readBytes()) |
|
|
|