File tree 1 file changed +4
-4
lines changed
library/src/main/java/com/absinthe/rulesbundle
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ object Repositories {
20
20
val localCloudVersionFile = File (context.filesDir, LOCAL_RULES_VERSION_FILE )
21
21
if (localCloudVersionFile.exists().not ()) return LCRules .getVersion()
22
22
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())
25
25
} ? : return LCRules .getVersion()
26
26
}
27
27
@@ -54,8 +54,8 @@ object Repositories {
54
54
val versionFile = File (context.filesDir, LOCAL_RULES_VERSION_FILE )
55
55
if (versionFile.exists().not ()) return false
56
56
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 )
59
59
return version >= LCRules .getVersion()
60
60
} ? : return false
61
61
}
You can’t perform that action at this time.
0 commit comments