forked from reya/coop-mobile
chore: re-structure project (#31)
Reviewed-on: https://git.reya.su/reya/coop-mobile/pulls/31
This commit is contained in:
@@ -5,17 +5,21 @@ import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import kotlinx.coroutines.launch
|
||||
import su.reya.coop.LocalAccountViewModel
|
||||
import su.reya.coop.LocalAppViewModel
|
||||
import su.reya.coop.LocalNavigator
|
||||
import su.reya.coop.LocalNostrViewModel
|
||||
import su.reya.coop.LocalProfileViewModel
|
||||
import su.reya.coop.Screen
|
||||
import su.reya.coop.shared.ProfileEditor
|
||||
|
||||
@Composable
|
||||
fun NewIdentityScreen() {
|
||||
val viewModel = LocalNostrViewModel.current
|
||||
val appViewModel = LocalAppViewModel.current
|
||||
val accountViewModel = LocalAccountViewModel.current
|
||||
val profileViewModel = LocalProfileViewModel.current
|
||||
val navigator = LocalNavigator.current
|
||||
val scope = rememberCoroutineScope()
|
||||
val isBusy by viewModel.isBusy.collectAsStateWithLifecycle(false)
|
||||
val isBusy by appViewModel.isBusy.collectAsStateWithLifecycle(false)
|
||||
|
||||
ProfileEditor(
|
||||
title = "Create a new identity",
|
||||
@@ -24,7 +28,7 @@ fun NewIdentityScreen() {
|
||||
onBack = { navigator.goBack() },
|
||||
onConfirm = { name, bio, bytes, type ->
|
||||
scope.launch {
|
||||
viewModel.createIdentity(name, bio, bytes, type)
|
||||
accountViewModel.createIdentity(name, bio, bytes, type, profileViewModel)
|
||||
navigator.navigate(Screen.Home)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user