Use the same name for the 2 db log methods

This commit is contained in:
Benoit Marty 2020-11-03 09:17:07 +01:00
parent 3c7f61e45c
commit d4963dfb31
3 changed files with 19 additions and 17 deletions

View File

@ -242,5 +242,5 @@ interface Session :
/** /**
* Maintenance API, allows to print outs info on DB size to logcat * Maintenance API, allows to print outs info on DB size to logcat
*/ */
fun dbgTraceDbInfo() fun logDbUsageInfo()
} }

View File

@ -287,7 +287,7 @@ internal class DefaultSession @Inject constructor(
return "$myUserId - ${sessionParams.deviceId}" return "$myUserId - ${sessionParams.deviceId}"
} }
override fun dbgTraceDbInfo() { override fun logDbUsageInfo() {
Realm.getInstance(realmConfiguration).use { realm -> Realm.getInstance(realmConfiguration).use { realm ->
val info = StringBuilder() val info = StringBuilder()

View File

@ -212,20 +212,20 @@ class BugReporter @Inject constructor(
} }
activeSessionHolder.getSafeActiveSession() activeSessionHolder.getSafeActiveSession()
?.takeIf { !mIsCancelled && withKeyRequestHistory } ?.takeIf { !mIsCancelled && withKeyRequestHistory }
?.cryptoService() ?.cryptoService()
?.getGossipingEvents() ?.getGossipingEvents()
?.let { GossipingEventsSerializer().serialize(it) } ?.let { GossipingEventsSerializer().serialize(it) }
?.toByteArray() ?.toByteArray()
?.let { rawByteArray -> ?.let { rawByteArray ->
File(context.cacheDir.absolutePath, KEY_REQUESTS_FILENAME) File(context.cacheDir.absolutePath, KEY_REQUESTS_FILENAME)
.also { .also {
it.outputStream() it.outputStream()
.use { os -> os.write(rawByteArray) } .use { os -> os.write(rawByteArray) }
} }
} }
?.let { compressFile(it) } ?.let { compressFile(it) }
?.let { gzippedFiles.add(it) } ?.let { gzippedFiles.add(it) }
var deviceId = "undefined" var deviceId = "undefined"
var userId = "undefined" var userId = "undefined"
@ -446,8 +446,10 @@ class BugReporter @Inject constructor(
*/ */
fun openBugReportScreen(activity: FragmentActivity, forSuggestion: Boolean = false) { fun openBugReportScreen(activity: FragmentActivity, forSuggestion: Boolean = false) {
screenshot = takeScreenshot(activity) screenshot = takeScreenshot(activity)
activeSessionHolder.getSafeActiveSession()?.dbgTraceDbInfo() activeSessionHolder.getSafeActiveSession()?.let {
activeSessionHolder.getSafeActiveSession()?.cryptoService()?.logDbUsageInfo() it.logDbUsageInfo()
it.cryptoService().logDbUsageInfo()
}
val intent = Intent(activity, BugReportActivity::class.java) val intent = Intent(activity, BugReportActivity::class.java)
intent.putExtra("FOR_SUGGESTION", forSuggestion) intent.putExtra("FOR_SUGGESTION", forSuggestion)