Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

fix: exit app after qs tile recording launch #250

Merged
merged 1 commit into from Feb 21, 2024
Merged
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
21 changes: 19 additions & 2 deletions app/src/main/java/com/bnyro/recorder/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ import com.bnyro.recorder.ui.models.ThemeModel
import com.bnyro.recorder.ui.theme.RecordYouTheme

class MainActivity : ComponentActivity() {
private var initialRecorder = RecorderType.NONE
private var exit = false
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

val themeModel: ThemeModel by viewModels()

val initialRecorder = when (intent?.getStringExtra("action")) {
initialRecorder = when (intent?.getStringExtra("action")) {
"audio" -> RecorderType.AUDIO
"screen" -> RecorderType.VIDEO
else -> RecorderType.NONE
Expand Down Expand Up @@ -51,4 +52,20 @@ class MainActivity : ComponentActivity() {
}
}
}

override fun onPause() {
super.onPause()
if (initialRecorder != RecorderType.NONE) {
exit = true
initialRecorder = RecorderType.NONE
}
}

override fun onResume() {
super.onResume()
if (exit) {
exit = false
finish()
}
}
}
Loading