From d4963dfb31212b1e9354b0f6fbab7f098d6d3278 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 3 Nov 2020 09:17:07 +0100 Subject: [PATCH] Use the same name for the 2 db log methods --- .../matrix/android/sdk/api/session/Session.kt | 2 +- .../sdk/internal/session/DefaultSession.kt | 2 +- .../app/features/rageshake/BugReporter.kt | 32 ++++++++++--------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/Session.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/Session.kt index 4cf46cbbc0..56609610f1 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/Session.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/Session.kt @@ -242,5 +242,5 @@ interface Session : /** * Maintenance API, allows to print outs info on DB size to logcat */ - fun dbgTraceDbInfo() + fun logDbUsageInfo() } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultSession.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultSession.kt index 3b1fc73bc9..2a6df81e72 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultSession.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultSession.kt @@ -287,7 +287,7 @@ internal class DefaultSession @Inject constructor( return "$myUserId - ${sessionParams.deviceId}" } - override fun dbgTraceDbInfo() { + override fun logDbUsageInfo() { Realm.getInstance(realmConfiguration).use { realm -> val info = StringBuilder() diff --git a/vector/src/main/java/im/vector/app/features/rageshake/BugReporter.kt b/vector/src/main/java/im/vector/app/features/rageshake/BugReporter.kt index 4514c9ef80..96248187aa 100755 --- a/vector/src/main/java/im/vector/app/features/rageshake/BugReporter.kt +++ b/vector/src/main/java/im/vector/app/features/rageshake/BugReporter.kt @@ -212,20 +212,20 @@ class BugReporter @Inject constructor( } activeSessionHolder.getSafeActiveSession() - ?.takeIf { !mIsCancelled && withKeyRequestHistory } - ?.cryptoService() - ?.getGossipingEvents() - ?.let { GossipingEventsSerializer().serialize(it) } - ?.toByteArray() - ?.let { rawByteArray -> - File(context.cacheDir.absolutePath, KEY_REQUESTS_FILENAME) - .also { - it.outputStream() + ?.takeIf { !mIsCancelled && withKeyRequestHistory } + ?.cryptoService() + ?.getGossipingEvents() + ?.let { GossipingEventsSerializer().serialize(it) } + ?.toByteArray() + ?.let { rawByteArray -> + File(context.cacheDir.absolutePath, KEY_REQUESTS_FILENAME) + .also { + it.outputStream() .use { os -> os.write(rawByteArray) } - } - } - ?.let { compressFile(it) } - ?.let { gzippedFiles.add(it) } + } + } + ?.let { compressFile(it) } + ?.let { gzippedFiles.add(it) } var deviceId = "undefined" var userId = "undefined" @@ -446,8 +446,10 @@ class BugReporter @Inject constructor( */ fun openBugReportScreen(activity: FragmentActivity, forSuggestion: Boolean = false) { screenshot = takeScreenshot(activity) - activeSessionHolder.getSafeActiveSession()?.dbgTraceDbInfo() - activeSessionHolder.getSafeActiveSession()?.cryptoService()?.logDbUsageInfo() + activeSessionHolder.getSafeActiveSession()?.let { + it.logDbUsageInfo() + it.cryptoService().logDbUsageInfo() + } val intent = Intent(activity, BugReportActivity::class.java) intent.putExtra("FOR_SUGGESTION", forSuggestion)