Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app: refine LogsActivity & LogcatActivity #431

Merged
merged 1 commit into from
Jan 22, 2025
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
2 changes: 1 addition & 1 deletion app/src/main/java/com/github/kr328/clash/LogcatActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class LogcatActivity : BaseActivity<LogcatDesign>() {
when (it) {
LogcatDesign.Request.Close -> {
stopService(LogcatService::class.intent)

startActivity(LogsActivity::class.intent)
finish()
}
else -> Unit
Expand Down
6 changes: 1 addition & 5 deletions app/src/main/java/com/github/kr328/clash/LogsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ import kotlinx.coroutines.selects.select
import kotlinx.coroutines.withContext

class LogsActivity : BaseActivity<LogsDesign>() {
override suspend fun main() {
if (LogcatService.running) {
return startActivity(LogcatActivity::class.intent)
}

override suspend fun main() {
val design = LogsDesign(this)

setContentDesign(design)
Expand All @@ -38,7 +35,6 @@ class LogsActivity : BaseActivity<LogsDesign>() {
when (it) {
LogsDesign.Request.StartLogcat -> {
startActivity(LogcatActivity::class.intent)

finish()
}
LogsDesign.Request.DeleteAll -> {
Expand Down
9 changes: 7 additions & 2 deletions app/src/main/java/com/github/kr328/clash/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,13 @@ class MainActivity : BaseActivity<MainDesign>() {
startActivity(ProfilesActivity::class.intent)
MainDesign.Request.OpenProviders ->
startActivity(ProvidersActivity::class.intent)
MainDesign.Request.OpenLogs ->
startActivity(LogsActivity::class.intent)
MainDesign.Request.OpenLogs -> {
if (LogcatService.running) {
startActivity(LogcatActivity::class.intent)
} else {
startActivity(LogsActivity::class.intent)
}
}
MainDesign.Request.OpenSettings ->
startActivity(SettingsActivity::class.intent)
MainDesign.Request.OpenHelp ->
Expand Down
Loading