Created
June 29, 2020 18:37
-
-
Save jetaggart/02ff32b36e7c2ee63576c6c211e3c1fb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // android/app/src/main/java/io/getstream/thestream/MainActivity.kt:16 | |
| class MainActivity : AppCompatActivity(), CoroutineScope by MainScope() { | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContentView(R.layout.activity_main) | |
| val submit: Button = findViewById(R.id.submit) | |
| val userView: EditText = findViewById(R.id.user) | |
| submit.setOnClickListener { | |
| val user: String = userView.text.toString() | |
| launch(Dispatchers.IO) { | |
| BackendService.signIn(user) | |
| val chatCredentials = BackendService.getChatCredentials() | |
| launch(Dispatchers.Main) { | |
| ChatService.init(applicationContext, user, chatCredentials) | |
| startActivity( | |
| Intent(applicationContext, AuthedMainActivity::class.java) | |
| ) | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment