Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ xcuserdata
/module/network/ktor3/schemas/*
/sample/shared/schemas/*
/.gradle-home/*
/.refact/*
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ internal actual object LaunchUtils {
private const val SHARE_FILE_NAME = "android.log"
private const val SHARE_TEXT_TITLE = "Share logs as text"
private const val SHARE_FILE_TITLE = "Share logs as file"
private const val MAX_SHARE_TEXT_CHARS = 120_000

internal actual fun canCopyLogs(): Boolean = true
internal actual fun canSaveLogsToFile(): Boolean = true
Expand Down Expand Up @@ -57,6 +58,10 @@ internal actual object LaunchUtils {
internal actual fun shareLogsAsText(context: PlatformContext, logs: List<LogEntity>) {
val androidContext = context.get()
val text = logs.joinToString(separator = "\n") { it.toLogString() }
if (text.length > MAX_SHARE_TEXT_CHARS) {
shareLogsAsFile(context = context, logs = logs)
return
}
Intent(Intent.ACTION_SEND).apply {
type = LOG_MIME_TYPE
putExtra(Intent.EXTRA_TEXT, text)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ClearAll
import androidx.compose.material.icons.filled.FileDownload
Expand Down Expand Up @@ -91,12 +92,14 @@ internal fun LogViewerContent(
LabelsBar(component = component, state = state)
}
ErrorBox(modifier = Modifier.fillMaxSize(), error = state.error) {
LazyColumn(
state = listState,
modifier = Modifier.fillMaxSize().testTag("log_list"),
) {
items(state.log) { item ->
Item(item)
SelectionContainer {
LazyColumn(
state = listState,
modifier = Modifier.fillMaxSize().testTag("log_list"),
) {
items(state.log) { item ->
Item(item)
}
}
}
}
Expand Down
Loading