commit ba2e4617d50deaaa62c61625058e9cf42a351886 parent 16a16df51a573db6d439e95181c51c540bb99fe5 Author: rhunk <101876869+rhunk@users.noreply.github.com> Date: Mon, 21 Aug 2023 19:20:28 +0200 fix: message export Diffstat:
5 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/app/src/main/kotlin/me/rhunk/snapenhance/bridge/BridgeService.kt b/app/src/main/kotlin/me/rhunk/snapenhance/bridge/BridgeService.kt @@ -109,6 +109,8 @@ class BridgeService : Service() { override fun clearMessageLogger() = messageLoggerWrapper.clearMessages() + override fun getApplicationApkPath(): String = applicationInfo.publicSourceDir + override fun fetchLocales(userLocale: String) = LocaleWrapper.fetchLocales(context = this@BridgeService, userLocale).associate { it.locale to it.content diff --git a/core/src/main/aidl/me/rhunk/snapenhance/bridge/BridgeInterface.aidl b/core/src/main/aidl/me/rhunk/snapenhance/bridge/BridgeInterface.aidl @@ -46,6 +46,8 @@ interface BridgeInterface { */ void clearMessageLogger(); + String getApplicationApkPath(); + /** * Fetch the locales * diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/action/impl/ExportChatMessages.kt b/core/src/main/kotlin/me/rhunk/snapenhance/action/impl/ExportChatMessages.kt @@ -114,7 +114,7 @@ class ExportChatMessages : AbstractAction("action.export_chat_messages") { ViewAppearanceHelper.newAlertDialogBuilder(context.mainActivity) .setTitle(context.translation["chat_export.select_conversation"]) .setMultiChoiceItems( - friendFeedEntries.map { it.feedDisplayName ?: it.friendDisplayName!!.split("|").firstOrNull() }.toTypedArray(), + friendFeedEntries.map { it.feedDisplayName ?: it.friendDisplayUsername!!.split("|").firstOrNull() }.toTypedArray(), BooleanArray(friendFeedEntries.size) { false } ) { _, which, isChecked -> if (isChecked) { diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/bridge/BridgeClient.kt b/core/src/main/kotlin/me/rhunk/snapenhance/bridge/BridgeClient.kt @@ -116,6 +116,8 @@ class BridgeClient( LocalePair(it.key, it.value) } + fun getApplicationApkPath() = service.getApplicationApkPath() + fun getAutoUpdaterTime(): Long { createAndReadFile(BridgeFileType.AUTO_UPDATER_TIMESTAMP, "0".toByteArray()).run { return if (isEmpty()) { diff --git a/core/src/main/kotlin/me/rhunk/snapenhance/util/export/MessageExporter.kt b/core/src/main/kotlin/me/rhunk/snapenhance/util/export/MessageExporter.kt @@ -190,9 +190,7 @@ class MessageExporter( printLog("writing template...") runCatching { - ZipFile( - context.androidContext.packageManager.getApplicationInfoCompat(BuildConfig.APPLICATION_ID, PackageManager.GET_META_DATA).publicSourceDir - ).use { apkFile -> + ZipFile(context.bridgeClient.getApplicationApkPath()).use { apkFile -> //export rawinflate.js apkFile.getEntry("assets/web/rawinflate.js").let { entry -> output.write("<script>".toByteArray())