mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-24 10:35:26 +00:00
Fixed shell long dumping to UI
This commit is contained in:
parent
50134a2f9b
commit
23e8a4ce4b
@ -43,6 +43,7 @@ class FlashViewModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val rawItems = ObservableArrayList<String>()
|
private val rawItems = ObservableArrayList<String>()
|
||||||
|
private val logItems = ObservableArrayList<String>()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
rawItems.sendUpdatesTo(items) { it.map { ConsoleRvItem(it) } }
|
rawItems.sendUpdatesTo(items) { it.map { ConsoleRvItem(it) } }
|
||||||
@ -52,19 +53,19 @@ class FlashViewModel(
|
|||||||
val uri = uri ?: Uri.EMPTY
|
val uri = uri ?: Uri.EMPTY
|
||||||
when (action) {
|
when (action) {
|
||||||
Const.Value.FLASH_ZIP -> Flashing
|
Const.Value.FLASH_ZIP -> Flashing
|
||||||
.Install(uri, rawItems, rawItems, this)
|
.Install(uri, rawItems, logItems, this)
|
||||||
.exec()
|
.exec()
|
||||||
Const.Value.UNINSTALL -> Flashing
|
Const.Value.UNINSTALL -> Flashing
|
||||||
.Uninstall(uri, rawItems, rawItems, this)
|
.Uninstall(uri, rawItems, logItems, this)
|
||||||
.exec()
|
.exec()
|
||||||
Const.Value.FLASH_MAGISK -> Patching
|
Const.Value.FLASH_MAGISK -> Patching
|
||||||
.Direct(rawItems, rawItems, this)
|
.Direct(rawItems, logItems, this)
|
||||||
.exec()
|
.exec()
|
||||||
Const.Value.FLASH_INACTIVE_SLOT -> Patching
|
Const.Value.FLASH_INACTIVE_SLOT -> Patching
|
||||||
.SecondSlot(rawItems, rawItems, this)
|
.SecondSlot(rawItems, logItems, this)
|
||||||
.exec()
|
.exec()
|
||||||
Const.Value.PATCH_FILE -> Patching
|
Const.Value.PATCH_FILE -> Patching
|
||||||
.File(uri, rawItems, rawItems, this)
|
.File(uri, rawItems, logItems, this)
|
||||||
.exec()
|
.exec()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -85,13 +86,20 @@ class FlashViewModel(
|
|||||||
|
|
||||||
fun savePressed() = withPermissions(READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE)
|
fun savePressed() = withPermissions(READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE)
|
||||||
.map { now }
|
.map { now }
|
||||||
.map { it.toTime(timeFormatFull) }
|
.map { it.toTime(timeFormatStandard) }
|
||||||
.map { Const.MAGISK_INSTALL_LOG_FILENAME.format(it) }
|
.map { Const.MAGISK_INSTALL_LOG_FILENAME.format(it) }
|
||||||
.map { File(Const.EXTERNAL_PATH, it) }
|
.map { File(Const.EXTERNAL_PATH, it) }
|
||||||
.map { file ->
|
.map { file ->
|
||||||
val log = items.filterIsInstance<ConsoleRvItem>()
|
val log = items.filterIsInstance<ConsoleRvItem>()
|
||||||
.joinToString("\n") { it.item }
|
.joinToString("\n") { it.item }
|
||||||
file.writeText(log)
|
file.writeText(log)
|
||||||
|
|
||||||
|
val rawLog = logItems.toList().joinToString("\n")
|
||||||
|
if (rawLog.isNotBlank()) {
|
||||||
|
file.appendText("\n=== LOG ===\n")
|
||||||
|
file.appendText(rawLog)
|
||||||
|
}
|
||||||
|
|
||||||
file.path
|
file.path
|
||||||
}
|
}
|
||||||
.subscribeK { SnackbarEvent(it).publish() }
|
.subscribeK { SnackbarEvent(it).publish() }
|
||||||
|
Loading…
Reference in New Issue
Block a user