Bug fix of database loading / Refactor code / Redesign UI#101
Bug fix of database loading / Refactor code / Redesign UI#101FoxRefire wants to merge 5 commits intoMaintainTeam:stablefrom
Conversation
9ad1d9b to
84cb55b
Compare
|
Looking forward to this one (fix of database loading…). Thank you very much! Appreciated! |
There was a problem hiding this comment.
Thank you for this! This is just a code review, once these concerns are addressed, I will properly test it and clean it up some more.
Please remove the last two comments, if there is to be a new UI, it needs to implemented in a dedicated pull request and at the very least done in JetPack Compose. I would personally like to be the one writing the code for that, but am open to working with others.
| e.printStackTrace() | ||
| } | ||
| } | ||
| }.forEach { it.await() } |
| ) | ||
| val databaseLoading = FileInputStream(databaseLocation) | ||
| loadDatabases(databaseLocation, databaseLoading) | ||
| databaseLoading.close() |
There was a problem hiding this comment.
databaseLoading.close() should be done in a finally block, in case there is an exception.
| } | ||
| }.forEach { it.await() } | ||
| } | ||
| signaturesCount = (signaturesMD5?.approximateElementCount() ?: 0L) + |
There was a problem hiding this comment.
If you re going to do this, then loadDatabase needs to be refactored to not handle signature count.
| @OptIn(DelicateCoroutinesApi::class) | ||
| private fun launchDownload(onionRouting: Boolean, url: String, outPath: String, baseURL: String) { | ||
| val jobRef = arrayOf<Job?>(null) | ||
| val job = GlobalScope.launch(Dispatchers.Main) { |
There was a problem hiding this comment.
I don't think GlobalScope is necessary here, as we don't want something this heavy running constantly. Could potentially use a suspend function with coroutineScope.
| <string name="lblNotificationRealtimeDetection">Malware Detected:</string> | ||
| <string name="lblRealtimeScannerToggle">Realtime Scanner</string> | ||
| <string name="lblReset">Reset</string> | ||
| <string name="lblResetGitHub">GitHub mirror</string> |
There was a problem hiding this comment.
Completely unneeded, use <string name="database_switcher_mirror">GitHub Mirror</string> if you need this string.
| super.onPostExecute(s) | ||
| @OptIn(DelicateCoroutinesApi::class) | ||
| private fun launchDownload(onionRouting: Boolean, url: String, outPath: String, baseURL: String) { | ||
| val jobRef = arrayOf<Job?>(null) |
There was a problem hiding this comment.
jobRef is kind of ugly, you could just use job.invokeOnCompletion { downloadFutures.remove(job) } or something along those lines, instead of hacking it with the array.
No description provided.