Skip to content

Commit

Permalink
Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Deniz Ozmaden committed Jan 23, 2022
1 parent 84094d5 commit 06d719a
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.ozmaden.wantedbyfbi.android

import android.os.Bundle
import android.widget.Toast
import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.foundation.layout.fillMaxSize
Expand All @@ -20,13 +21,8 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.launch

class MainActivity : AppCompatActivity() {

private val mainScope = MainScope()

private val sdk = WantedSDK(DatabaseDriverFactory(this))
private val api = WantedApi()

lateinit var wanted: List<WantedPerson>
private val mainScope = MainScope()

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand All @@ -38,7 +34,6 @@ class MainActivity : AppCompatActivity() {
mainScope.launch {
kotlin.runCatching {
sdk.getWantedPeople(false)
// WantedApi().getAllPeople()
}.onSuccess {
val wantedPeople = it
setContent {
Expand All @@ -61,15 +56,16 @@ class MainActivity : AppCompatActivity() {
) {
WantedList(
modifier = Modifier.fillMaxSize(),
wantedPeople.shuffled(),
// wantedPeople,
wantedPeople.shuffled()
)
}
}
}
}
}
}.onFailure {
// Toast.makeText(this@MainActivity, it.localizedMessage, Toast.LENGTH_SHORT).show()
Toast.makeText(this@MainActivity, it.localizedMessage, Toast.LENGTH_SHORT).show()
}
}
}
Expand Down

0 comments on commit 06d719a

Please sign in to comment.