pull/1327/merge
deniscerri 3 weeks ago
parent aea0edc3ae
commit a3fb076fa2
No known key found for this signature in database
GPG Key ID: 95C43D517D830350

@ -290,6 +290,7 @@ class MainActivity : BaseActivity() {
}
cookieViewModel.updateCookiesFile()
installLauncher = ApkInstallUtil.registerInstallLauncher(this)
val intent = intent
handleIntents(intent)

@ -101,28 +101,29 @@ object BgUtilsPoTokenGeneratorUtil {
val hasDeno = RuntimeManager.getInstance().denoLocation.isAvailable
progress?.invoke("Downloading node-modules...")
if (hasNode) {
val nodeResponse = RuntimeManager.getInstance().executeNpm(
command = "install --ignore-scripts",
executeDirectory = File(serverFolder, "server")) { _, _, line ->
progress?.invoke(line)
}
if (nodeResponse.exitCode != 0) {
progress?.invoke(nodeResponse.err)
return Result.failure(Exception(nodeResponse.err))
}
progress?.invoke("Building typescript files...")
val nodeResponse2 = RuntimeManager.getInstance().executeNode(
command = "node_modules/typescript/bin/tsc",
executeDirectory = File(serverFolder, "server")) { _, _, line ->
progress?.invoke(line)
}
if (nodeResponse2.exitCode != 0) {
progress?.invoke(nodeResponse2.err)
return Result.failure(Exception(nodeResponse2.err))
}
}
//TODO READD
// if (hasNode) {
// val nodeResponse = RuntimeManager.getInstance().executeNpm(
// command = "install --ignore-scripts",
// executeDirectory = File(serverFolder, "server")) { _, _, line ->
// progress?.invoke(line)
// }
// if (nodeResponse.exitCode != 0) {
// progress?.invoke(nodeResponse.err)
// return Result.failure(Exception(nodeResponse.err))
// }
//
// progress?.invoke("Building typescript files...")
// val nodeResponse2 = RuntimeManager.getInstance().executeNode(
// command = "node_modules/typescript/bin/tsc",
// executeDirectory = File(serverFolder, "server")) { _, _, line ->
// progress?.invoke(line)
// }
// if (nodeResponse2.exitCode != 0) {
// progress?.invoke(nodeResponse2.err)
// return Result.failure(Exception(nodeResponse2.err))
// }
// }
if (hasDeno) {
val denoResponse = RuntimeManager.getInstance().executeDeno(

@ -2764,6 +2764,7 @@ object UiUtil {
installLauncher: ActivityResultLauncher<Intent>
) {
val customView = layoutInflater.inflate(R.layout.layout_update_snackbar, null)
customView.findViewById<TextView>(R.id.newVersionTitle).text = context.getString(R.string.version_ready_to_download, v.tag_name)
val triggerAction = View.OnClickListener {
container.removeView(customView)
showNewAppUpdateDialog(v, context, updateUtil, lifecycleOwner, preferences, installLauncher)
@ -2788,6 +2789,8 @@ object UiUtil {
) {
if (context.isFinishing || context.isDestroyed) return
var positiveButton: Button? = null
var negativeButton: Button? = null
var neutralButton: Button? = null
var tmpDownloadJob: Job? = null
val skippedVersions = preferences.getString("skip_updates", "")?.split(",")?.distinct()?.toMutableList() ?: mutableListOf()
@ -2822,6 +2825,9 @@ object UiUtil {
mw.setMarkdown(textView, v.body)
positiveButton = view.getButton(android.app.AlertDialog.BUTTON_POSITIVE)
negativeButton = view.getButton(android.app.AlertDialog.BUTTON_NEGATIVE)
neutralButton = view.getButton(android.app.AlertDialog.BUTTON_NEUTRAL)
positiveButton?.setOnClickListener {
positiveButton.isEnabled = false
positiveButton.text = "0%"
@ -2853,13 +2859,17 @@ object UiUtil {
fileResp.onSuccess { file ->
lifecycleScope.launch {
withContext(Dispatchers.Main) {
positiveButton.text = context.getString(R.string.please_wait)
negativeButton.isEnabled = false
neutralButton.isEnabled = false
ApkInstallUtil.installApk(context, file, installLauncher) { result ->
result.onSuccess {
}.onFailure { f ->
Snackbar.make(context.findViewById(R.id.frame_layout), f.message ?: "", Snackbar.LENGTH_LONG).show()
}
view.dismiss()
}
view.dismiss()
}
}
}

Loading…
Cancel
Save