Skip to content

Commit

Permalink
Fix loading
Browse files Browse the repository at this point in the history
  • Loading branch information
greenart7c3 committed Oct 25, 2024
1 parent 49ac067 commit b8d49c6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/src/main/java/com/greenart7c3/citrine/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,15 @@ class MainActivity : ComponentActivity() {

private suspend fun stop() {
try {
isLoading.value = false // TODO: return this to true after finding where its getting the loading stuck forever
isLoading.value = true
val intent = Intent(applicationContext, WebSocketServerService::class.java)
stopService(intent)
if (bound) unbindService(connection)
bound = false
service = null
delay(2000)
} catch (e: Exception) {
isLoading.value = false
if (e is CancellationException) throw e
Log.d(Citrine.TAG, e.message ?: "", e)
} finally {
Expand All @@ -130,12 +131,13 @@ class MainActivity : ComponentActivity() {

private suspend fun start() {
try {
isLoading.value = false // TODO: return this to true after finding where its getting the loading stuck forever
isLoading.value = true
val intent = Intent(applicationContext, WebSocketServerService::class.java)
startService(intent)
bindService(intent, connection, Context.BIND_AUTO_CREATE)
delay(2000)
} catch (e: Exception) {
isLoading.value = false
if (e is CancellationException) throw e
Log.d(Citrine.TAG, e.message ?: "", e)
} finally {
Expand Down

0 comments on commit b8d49c6

Please sign in to comment.