Skip to content

Commit

Permalink
fix(message_export): bridge apk path
Browse files Browse the repository at this point in the history
  • Loading branch information
rhunk committed Aug 17, 2023
1 parent 744223a commit c997e67
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,6 @@ interface BridgeInterface {
* Enqueue a download
*/
void enqueueDownload(in Intent intent, DownloadCallback callback);

String getApplicationApkPath();
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ 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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,7 @@ class BridgeService : Service() {
SharedContext.ensureInitialized(this@BridgeService)
DownloadProcessor(this@BridgeService, callback).onReceive(intent)
}

override fun getApplicationApkPath(): String = applicationInfo.publicSourceDir
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit c997e67

Please sign in to comment.