Skip to content

Bug fix of database loading / Refactor code / Redesign UI#101

Open
FoxRefire wants to merge 5 commits intoMaintainTeam:stablefrom
FoxRefire:stable
Open

Bug fix of database loading / Refactor code / Redesign UI#101
FoxRefire wants to merge 5 commits intoMaintainTeam:stablefrom
FoxRefire:stable

Conversation

@FoxRefire
Copy link
Copy Markdown

No description provided.

@FoxRefire FoxRefire force-pushed the stable branch 2 times, most recently from 9ad1d9b to 84cb55b Compare March 8, 2026 05:15
@FoxRefire FoxRefire changed the title Bug fix of database loading Bug fix of database loading / Refactor code / Redesign UI Mar 8, 2026
@zWhdmB5T
Copy link
Copy Markdown

zWhdmB5T commented Mar 8, 2026

Looking forward to this one (fix of database loading…). Thank you very much! Appreciated!

Copy link
Copy Markdown
Member

@Inhishonor Inhishonor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FoxRefire

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() }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use awaitAll()

)
val databaseLoading = FileInputStream(databaseLocation)
loadDatabases(databaseLocation, databaseLoading)
databaseLoading.close()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

databaseLoading.close() should be done in a finally block, in case there is an exception.

}
}.forEach { it.await() }
}
signaturesCount = (signaturesMD5?.approximateElementCount() ?: 0L) +
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants