Skip to content

Commit

Permalink
fix closing DevTools when there is no real activity (after catched ex…
Browse files Browse the repository at this point in the history
…ceptions)
  • Loading branch information
hg42 committed Nov 2, 2024
1 parent 2648587 commit 9bf3558
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
19 changes: 14 additions & 5 deletions src/main/java/com/machiav3lli/backup/activities/MainActivityX.kt
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,13 @@ class MainActivityX : BaseActivity() {

"beforeContent" -> {
when (command) {
null -> {}
null -> {
return false
}

"android.intent.action.MAIN" -> {
if (data == null) return false
if (data == null)
return false
when (data.toString()) {
RESCUE_NAV -> {
setContent {
Expand All @@ -342,15 +345,21 @@ class MainActivityX : BaseActivity() {
}
}

else -> {}
else -> {
return false
}
}
}

"afterContent", "newIntent" -> {
when (command) {
null -> {}
null -> {
return false
}

"android.intent.action.MAIN" -> {
if (data == null) return false
if (data == null)
return false
moveTo(data.toString())
}

Expand Down
19 changes: 13 additions & 6 deletions src/main/java/com/machiav3lli/backup/ui/compose/item/DevTools.kt
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,14 @@ import com.machiav3lli.backup.OABX.Companion.endBusy
import com.machiav3lli.backup.OABX.Companion.hitBusy
import com.machiav3lli.backup.OABX.Companion.isDebug
import com.machiav3lli.backup.PREFS_BACKUP_FILE
import com.machiav3lli.backup.handler.LogsHandler.Companion.logException
import com.machiav3lli.backup.handler.findBackups
import com.machiav3lli.backup.entity.LaunchPref
import com.machiav3lli.backup.entity.Pref
import com.machiav3lli.backup.entity.Pref.Companion.preferencesFromSerialized
import com.machiav3lli.backup.entity.Pref.Companion.preferencesToSerialized
import com.machiav3lli.backup.entity.StorageFile
import com.machiav3lli.backup.entity.UndeterminedStorageFile
import com.machiav3lli.backup.handler.LogsHandler.Companion.logException
import com.machiav3lli.backup.handler.findBackups
import com.machiav3lli.backup.plugins.Plugin
import com.machiav3lli.backup.plugins.Plugin.Companion.displayPath
import com.machiav3lli.backup.plugins.Plugin.Companion.fileFor
Expand Down Expand Up @@ -108,14 +112,11 @@ import com.machiav3lli.backup.ui.compose.icons.phosphor.MagnifyingGlass
import com.machiav3lli.backup.ui.compose.icons.phosphor.Pencil
import com.machiav3lli.backup.ui.compose.icons.phosphor.X
import com.machiav3lli.backup.ui.compose.recycler.InnerBackground
import com.machiav3lli.backup.entity.LaunchPref
import com.machiav3lli.backup.entity.Pref
import com.machiav3lli.backup.entity.Pref.Companion.preferencesFromSerialized
import com.machiav3lli.backup.entity.Pref.Companion.preferencesToSerialized
import com.machiav3lli.backup.utils.SystemUtils
import com.machiav3lli.backup.utils.TraceUtils.trace
import com.machiav3lli.backup.utils.getBackupRoot
import com.machiav3lli.backup.utils.recreateActivities
import com.machiav3lli.backup.utils.restartApp
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toPersistentList
import kotlinx.coroutines.Dispatchers
Expand Down Expand Up @@ -1085,6 +1086,12 @@ fun DevTools(
" close "
) {
expanded.value = false
try {
if (OABX.main?.navController != null)
;
} catch (e: Throwable) {
OABX.main?.restartApp()
}
}
}

Expand Down

0 comments on commit 9bf3558

Please sign in to comment.