File tree Expand file tree Collapse file tree
library/src/main/java/com/absinthe/rulesbundle Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ object Repositories {
2020 val localCloudVersionFile = File (context.filesDir, LOCAL_RULES_VERSION_FILE )
2121 if (localCloudVersionFile.exists().not ()) return LCRules .getVersion()
2222 if (localCloudVersionFile.isDirectory.not ()) return LCRules .getVersion()
23- localCloudVersionFile.listFiles()?.takeIf { it.isNotEmpty() }?.let {
24- return runCatching { it[ 0 ] .name.toInt() }.getOrDefault(LCRules .getVersion())
23+ localCloudVersionFile.listFiles()?.takeIf { it.isNotEmpty() }?.let { files ->
24+ return runCatching { files.maxOf { it .name.toInt() } }.getOrDefault(LCRules .getVersion())
2525 } ? : return LCRules .getVersion()
2626 }
2727
@@ -54,8 +54,8 @@ object Repositories {
5454 val versionFile = File (context.filesDir, LOCAL_RULES_VERSION_FILE )
5555 if (versionFile.exists().not ()) return false
5656 if (versionFile.isDirectory.not ()) return false
57- versionFile.listFiles()?.takeIf { it.isNotEmpty() }?.let {
58- val version = runCatching { it[ 0 ] .name.toInt() }.getOrDefault(0 )
57+ versionFile.listFiles()?.takeIf { it.isNotEmpty() }?.let { files ->
58+ val version = runCatching { files.maxOf { it .name.toInt() } }.getOrDefault(0 )
5959 return version >= LCRules .getVersion()
6060 } ? : return false
6161 }
You can’t perform that action at this time.
0 commit comments