Skip to content

Commit 58ebbc0

Browse files
rework again
Signed-off-by: androidacy-user <opensource@androidacy.com>
1 parent e5567c7 commit 58ebbc0

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

app/src/main/kotlin/com/fox2code/mmm/repo/RepoManager.kt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,9 @@ class RepoManager private constructor(mainApplication: MainApplication) : SyncMa
209209
Timber.e(e)
210210
}
211211
updatedModules++
212-
// update the update listener
213-
// STEP1 is done so always add it
214-
// step2 percentage is calculated by the number of modules updated out of total, then multiplied by the percentage of repos done
215-
updateListener.update(
216-
STEP1 + STEP2 * ((updatedModules / moduleToUpdate) * (i + 1) / repoDatas.size)
217-
)
212+
val repoProgressIncrement = STEP2 / repoDatas.size.toDouble()
213+
val moduleProgressIncrement = repoProgressIncrement / repoModules.size.toDouble()
214+
updateListener.update((STEP1 + moduleProgressIncrement * updatedModules).toInt())
218215
}
219216
for (repoModule in repoUpdaters[i]!!.toApply()!!) {
220217
if (repoModule.moduleInfo.flags and ModuleInfo.FLAG_METADATA_INVALID == 0) {
@@ -349,8 +346,8 @@ class RepoManager private constructor(mainApplication: MainApplication) : SyncMa
349346
private const val MAGISK_REPO_MANAGER =
350347
"https://magisk-modules-repo.github.io/submission/modules.json"
351348
private val lock = Any()
352-
private const val STEP1 = 40
353-
private const val STEP2 = 40
349+
private const val STEP1 = 20
350+
private const val STEP2 = 60
354351
private const val STEP3 = 20
355352

356353
@Volatile
@@ -415,4 +412,4 @@ class RepoManager private constructor(mainApplication: MainApplication) : SyncMa
415412
val isAndroidacyRepoEnabled: Boolean
416413
get() = INSTANCE != null && INSTANCE!!.androidacyRepoData != null && INSTANCE!!.androidacyRepoData!!.isEnabled
417414
}
418-
}
415+
}

0 commit comments

Comments
 (0)