[8.2.8][i18n] mogo-core-function-map、mogo-core-function-patch、mogo-core-function-startup 中文抽取
This commit is contained in:
@@ -24,24 +24,28 @@ internal object PatchManager {
|
||||
fun applyPatch(ctx: Context, patch: File, newApk: File): Boolean {
|
||||
val oldApkPath = ctx.packageManager.getPackageInfo(ctx.packageName, 0).applicationInfo.sourceDir
|
||||
if (TextUtils.isEmpty(oldApkPath)) {
|
||||
throw AssertionError("旧的apk文件的文件路径为空.")
|
||||
// throw AssertionError("旧的apk文件的文件路径为空.")
|
||||
throw AssertionError(StringUtils.getString(R.string.module_core_file_path_old_apk_empty))
|
||||
}
|
||||
val oldApk = File(oldApkPath)
|
||||
Log.d(TAG, "applyPatch -- 1 --:oldApk -> ${oldApk.absolutePath}, patch: -> ${patch.absolutePath}, newApk: ${newApk.absolutePath}")
|
||||
if (!oldApk.exists()) {
|
||||
throw AssertionError("旧的apk文件不存在, 文件所在路径:${oldApk.absolutePath}")
|
||||
// throw AssertionError("旧的apk文件不存在, 文件所在路径:${oldApk.absolutePath}")
|
||||
throw AssertionError("${StringUtils.getString(R.string.module_core_old_apk_file_does_not_exist)}${oldApk.absolutePath}")
|
||||
}
|
||||
Log.d(TAG, "applyPatch -- 2 --")
|
||||
|
||||
if (!patch.exists()) {
|
||||
throw AssertionError("差分包文件不存在,文件所在路径:${patch.absolutePath}")
|
||||
// throw AssertionError("差分包文件不存在,文件所在路径:${patch.absolutePath}")
|
||||
throw AssertionError("${StringUtils.getString(R.string.module_core_differential_package_file_does_not_exist)}${patch.absolutePath}")
|
||||
}
|
||||
Log.d(TAG, "applyPatch -- 3 --")
|
||||
val newApkParent = newApk.parentFile
|
||||
if (newApkParent != null && !newApkParent.exists()) {
|
||||
val ret = newApkParent.mkdirs()
|
||||
if (!ret) {
|
||||
throw AssertionError("新包创建父目录失败")
|
||||
// throw AssertionError("新包创建父目录失败")
|
||||
throw AssertionError(StringUtils.getString(R.string.module_core_new_package_create_parent_dir_failed))
|
||||
}
|
||||
}
|
||||
Log.d(TAG, "applyPatch -- 4 --")
|
||||
@@ -49,7 +53,8 @@ internal object PatchManager {
|
||||
newApk.delete()
|
||||
}
|
||||
if (newApkParent == null) {
|
||||
throw AssertionError("新包父目录为空")
|
||||
// throw AssertionError("新包父目录为空")
|
||||
throw AssertionError(StringUtils.getString(R.string.module_core_new_package_parent_dir_null))
|
||||
}
|
||||
Log.d(TAG, "applyPatch -- 5 --")
|
||||
val tempFilePath = File(ctx.getExternalFilesDir(null), "temp/temp.patch")
|
||||
@@ -61,7 +66,8 @@ internal object PatchManager {
|
||||
val result = ApkPatch.patch(oldApk.absolutePath, patch.absolutePath, newApk.absolutePath, 4 * 1024 * 1024, "", 4)
|
||||
Log.d(TAG, "applyPatch -- end ---: result: $result")
|
||||
if (result != 0) {
|
||||
throw AssertionError("文件合成失败")
|
||||
// throw AssertionError("文件合成失败")
|
||||
throw AssertionError(StringUtils.getString(R.string.module_core_file_merge_failed))
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user