diff --git a/app/src/main/kotlin/com/fox2code/mmm/androidacy/AndroidacyRepoData.kt b/app/src/main/kotlin/com/fox2code/mmm/androidacy/AndroidacyRepoData.kt index 0fcd796..aa3b2bf 100644 --- a/app/src/main/kotlin/com/fox2code/mmm/androidacy/AndroidacyRepoData.kt +++ b/app/src/main/kotlin/com/fox2code/mmm/androidacy/AndroidacyRepoData.kt @@ -306,6 +306,12 @@ class AndroidacyRepoData(cacheRoot: File?, testMode: Boolean) : RepoData( } val newModules = ArrayList() val len = jsonArray.length() + // stringify json array for logging but only log the first 200 characters + val tempJsonArray = jsonArray.toString() + Timber.d( + "AndroidacyRepoData populate loop start with json %s", + if (tempJsonArray.length > 200) tempJsonArray.substring(0, 200) else tempJsonArray + ) var lastLastUpdate: Long = 0 for (i in 0 until len) { jsonObject = jsonArray.getJSONObject(i) diff --git a/app/src/main/kotlin/com/fox2code/mmm/manager/ModuleManager.kt b/app/src/main/kotlin/com/fox2code/mmm/manager/ModuleManager.kt index 80268fe..d3b433d 100644 --- a/app/src/main/kotlin/com/fox2code/mmm/manager/ModuleManager.kt +++ b/app/src/main/kotlin/com/fox2code/mmm/manager/ModuleManager.kt @@ -203,12 +203,13 @@ class ModuleManager private constructor() : SyncManager() { var modules: HashMap = HashMap() get() { afterScan() - return moduleInfos + return field } set(value) { - moduleInfos = value field = value + moduleInfos = value } + @Suppress("unused") fun getUpdatableModuleCount(): Int { afterScan() diff --git a/app/src/main/kotlin/com/fox2code/mmm/repo/RepoData.kt b/app/src/main/kotlin/com/fox2code/mmm/repo/RepoData.kt index b2cbbe9..b3049f7 100644 --- a/app/src/main/kotlin/com/fox2code/mmm/repo/RepoData.kt +++ b/app/src/main/kotlin/com/fox2code/mmm/repo/RepoData.kt @@ -427,7 +427,7 @@ open class RepoData(url: String, cacheRoot: File) : XRepo() { ).allowMainThreadQueries().build() val moduleListCache = db2.moduleListCacheDao().getByRepoId(preferenceId!!) if (repo != null) { - return if (repo.lastUpdate != 0 && moduleListCache.isNotEmpty()) { + return if (repo.lastUpdate != 0 && moduleListCache.isNotEmpty() && moduleListCache.size > 1) { val lastUpdate = repo.lastUpdate.toLong() val currentTime = System.currentTimeMillis() val diff = currentTime - lastUpdate @@ -437,8 +437,7 @@ open class RepoData(url: String, cacheRoot: File) : XRepo() { db2.close() diffMinutes > if (BuildConfig.DEBUG) 15 else 30 } else { - Timber.d("Repo $preferenceId should update could not find repo in database") - Timber.d("This is probably an error, please report this to the developer") + Timber.d("Repo $preferenceId shouldUpdate true: lastUpdate is " + repo.lastUpdate + " and moduleListCache is " + moduleListCache.size) db.close() db2.close() true