diff --git a/src/cli.ts b/src/cli.ts index a83c298..ef910ab 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -4,7 +4,7 @@ import chalk from 'chalk' import Listr from 'listr' import tempy from 'tempy' -import patchApk from './patch-apk' +import patchApk, { showAppBundleWarning } from './patch-apk' import { patchXapkBundle, patchApksBundle } from './patch-app-bundle' import Apktool from './tools/apktool' @@ -64,7 +64,9 @@ async function main() { console.log(chalk.dim(` Using temporary directory:\n ${tmpDir}\n`)) taskFunction({ inputPath, outputPath, tmpDir, apktool }).run().then(context => { - if (context.onFinished) context.onFinished() + if (taskFunction === patchApk && context.usesAppBundle) { + showAppBundleWarning() + } console.log( chalk`\n {green.inverse Done! } Patched file: {bold ./${outputName}}\n`, diff --git a/src/patch-apk.ts b/src/patch-apk.ts index 482adc7..b6a0398 100644 --- a/src/patch-apk.ts +++ b/src/patch-apk.ts @@ -30,9 +30,7 @@ export default function patchApk({ inputPath, outputPath, tmpDir, apktool }: Tas ) nscName = result.nscName - if (result.usesAppBundle) { - context.onFinished = showAppBundleWarning - } + context.usesAppBundle = result.usesAppBundle }, }, { @@ -87,7 +85,7 @@ export default function patchApk({ inputPath, outputPath, tmpDir, apktool }: Tas ]) } -function showAppBundleWarning() { +export function showAppBundleWarning() { console.log(chalk`{yellow {inverse.bold WARNING }