More renaming for chatRoom vs chatMessage list
This commit is contained in:
1 parent
3d6df8b231
commit
1d59cf00a8
8 files changed
+79
-77
No files matched your search
+23
-23
@@ -45,35 +45,35 @@ import at.torch.compose.ui.composable.navigation.routes.Route
|
|||||||
import at.torch.compose.ui.composable.navigation.routes.SearchMemberToAddToChatRoomRoute
|
import at.torch.compose.ui.composable.navigation.routes.SearchMemberToAddToChatRoomRoute
|
||||||
import at.torch.compose.ui.composable.widgets.LoadingDataIndicator
|
import at.torch.compose.ui.composable.widgets.LoadingDataIndicator
|
||||||
import at.torch.compose.ui.theme.TorchTheme
|
import at.torch.compose.ui.theme.TorchTheme
|
||||||
import at.torch.compose.ui.view.model.ChatRoomMessagingListViewModel
|
import at.torch.compose.ui.view.model.ChatRoomMessagingViewModel
|
||||||
import at.torch.compose.ui.view.state.ChatRoomMessagingListUIState
|
import at.torch.compose.ui.view.state.ChatRoomMessagingUIState
|
||||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3ExpressiveApi::class, ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3ExpressiveApi::class, ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun ChatRoomMessagingListScreen(
|
fun ChatRoomMessagingScreen(
|
||||||
activeUserPublicKey: HexKey,
|
activeUserPublicKey: HexKey,
|
||||||
chatRoomId: String,
|
chatRoomId: String,
|
||||||
relayHint: String?,
|
relayHint: String?,
|
||||||
initialChatRoomMessagingListUIState: ChatRoomMessagingListUIState = ChatRoomMessagingListUIState.Loading,
|
initialChatRoomMessagingUIState: ChatRoomMessagingUIState = ChatRoomMessagingUIState.Loading,
|
||||||
nostrRepository: NostrRepository,
|
nostrRepository: NostrRepository,
|
||||||
chatRepository: ChatRepository,
|
chatRepository: ChatRepository,
|
||||||
onNavigateToRouteAndPopUpInclusive: (Route) -> Unit,
|
onNavigateToRouteAndPopUpInclusive: (Route) -> Unit,
|
||||||
onNavigateToRoute: (Route) -> Unit,
|
onNavigateToRoute: (Route) -> Unit,
|
||||||
) {
|
) {
|
||||||
val chatRoomMessagingListViewModel: ChatRoomMessagingListViewModel = viewModel(
|
val chatRoomMessagingViewModel: ChatRoomMessagingViewModel = viewModel(
|
||||||
factory = ChatRoomMessagingListViewModel.factory(
|
factory = ChatRoomMessagingViewModel.factory(
|
||||||
chatRoomId = chatRoomId,
|
chatRoomId = chatRoomId,
|
||||||
relayHint = relayHint,
|
relayHint = relayHint,
|
||||||
initialChatRoomMessagingListUIState = initialChatRoomMessagingListUIState,
|
initialChatRoomMessagingUIState = initialChatRoomMessagingUIState,
|
||||||
nostrRepository = nostrRepository,
|
nostrRepository = nostrRepository,
|
||||||
chatRepository = chatRepository,
|
chatRepository = chatRepository,
|
||||||
activeUserPublicKey = activeUserPublicKey
|
activeUserPublicKey = activeUserPublicKey
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
when (val chatRoomDetailUIState = chatRoomMessagingListViewModel.chatRoomMessagingListUIState) {
|
when (val chatRoomDetailUIState = chatRoomMessagingViewModel.chatRoomMessagingUIState) {
|
||||||
is ChatRoomMessagingListUIState.Error -> {
|
is ChatRoomMessagingUIState.Error -> {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
@@ -86,11 +86,11 @@ fun ChatRoomMessagingListScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is ChatRoomMessagingListUIState.Loaded -> {
|
is ChatRoomMessagingUIState.Loaded -> {
|
||||||
val textFieldState = rememberTextFieldState()
|
val textFieldState = rememberTextFieldState()
|
||||||
|
|
||||||
val chatRoomDetailMessageListViewModel: at.torch.compose.ui.view.model.ChatRoomDetailMessageListViewModel = viewModel(
|
val chatMessageListViewModel: at.torch.compose.ui.view.model.ChatMessageListViewModel = viewModel(
|
||||||
factory = at.torch.compose.ui.view.model.ChatRoomDetailMessageListViewModel.factory(
|
factory = at.torch.compose.ui.view.model.ChatMessageListViewModel.factory(
|
||||||
localChatRoom = chatRoomDetailUIState.localChatRoom,
|
localChatRoom = chatRoomDetailUIState.localChatRoom,
|
||||||
nostrRepository = nostrRepository,
|
nostrRepository = nostrRepository,
|
||||||
chatRepository = chatRepository
|
chatRepository = chatRepository
|
||||||
@@ -132,12 +132,12 @@ fun ChatRoomMessagingListScreen(
|
|||||||
modifier = Modifier.weight(1f).fillMaxWidth()
|
modifier = Modifier.weight(1f).fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
key(true) {
|
key(true) {
|
||||||
chatRoomDetailMessageListViewModel.RenderMessages()
|
chatMessageListViewModel.RenderMessages()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
key(true) {
|
key(true) {
|
||||||
chatRoomDetailMessageListViewModel.initiate()
|
chatMessageListViewModel.initiate()
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Check that we have direct message relays for this user...
|
// TODO: Check that we have direct message relays for this user...
|
||||||
@@ -179,7 +179,7 @@ fun ChatRoomMessagingListScreen(
|
|||||||
} else {
|
} else {
|
||||||
IconButton(
|
IconButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
chatRoomDetailMessageListViewModel.sendMessage(
|
chatMessageListViewModel.sendMessage(
|
||||||
textFieldState = textFieldState
|
textFieldState = textFieldState
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -246,7 +246,7 @@ fun ChatRoomMessagingListScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ChatRoomMessagingListUIState.Loading -> {
|
ChatRoomMessagingUIState.Loading -> {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxWidth().padding(
|
modifier = Modifier.fillMaxWidth().padding(
|
||||||
20.dp
|
20.dp
|
||||||
@@ -279,7 +279,7 @@ fun ChatRoomMessagingListScreen(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ChatRoomMessagingListUIState.InitiatingNewChat -> {
|
ChatRoomMessagingUIState.InitiatingNewChat -> {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxWidth().padding(
|
modifier = Modifier.fillMaxWidth().padding(
|
||||||
20.dp
|
20.dp
|
||||||
@@ -306,7 +306,7 @@ fun ChatRoomMessagingListScreen(
|
|||||||
)
|
)
|
||||||
|
|
||||||
LaunchedEffect(true) {
|
LaunchedEffect(true) {
|
||||||
chatRoomMessagingListViewModel.initiateNewChat(
|
chatRoomMessagingViewModel.initiateNewChat(
|
||||||
onNavigateToRouteAndPopUpInclusive
|
onNavigateToRouteAndPopUpInclusive
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -315,24 +315,24 @@ fun ChatRoomMessagingListScreen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
LaunchedEffect(true) {
|
LaunchedEffect(true) {
|
||||||
if (initialChatRoomMessagingListUIState == ChatRoomMessagingListUIState.Loading) {
|
if (initialChatRoomMessagingUIState == ChatRoomMessagingUIState.Loading) {
|
||||||
chatRoomMessagingListViewModel.initiateChatRoomDetail()
|
chatRoomMessagingViewModel.initiateChatRoomDetail()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
private fun ChatRoomMessagingListScreenPreview() {
|
private fun ChatRoomMessagingScreenPreview() {
|
||||||
TorchTheme {
|
TorchTheme {
|
||||||
Surface(
|
Surface(
|
||||||
modifier = Modifier.fillMaxSize()
|
modifier = Modifier.fillMaxSize()
|
||||||
) {
|
) {
|
||||||
ChatRoomMessagingListScreen(
|
ChatRoomMessagingScreen(
|
||||||
activeUserPublicKey = "",
|
activeUserPublicKey = "",
|
||||||
chatRoomId = "publicKey",
|
chatRoomId = "publicKey",
|
||||||
relayHint = null,
|
relayHint = null,
|
||||||
initialChatRoomMessagingListUIState = ChatRoomMessagingListUIState.Loaded(
|
initialChatRoomMessagingUIState = ChatRoomMessagingUIState.Loaded(
|
||||||
localChatRoom = LocalChatRoom(
|
localChatRoom = LocalChatRoom(
|
||||||
chatRoom = ChatRoom(
|
chatRoom = ChatRoom(
|
||||||
id = "",
|
id = "",
|
||||||
|
|||||||
+2
-2
@@ -21,7 +21,7 @@ import at.torch.compose.managers.AuxDatabaseManager
|
|||||||
import at.torch.compose.ui.composable.ActiveProfileScreen
|
import at.torch.compose.ui.composable.ActiveProfileScreen
|
||||||
import at.torch.compose.ui.composable.AddMemberToChatRoomConfirmationScreen
|
import at.torch.compose.ui.composable.AddMemberToChatRoomConfirmationScreen
|
||||||
import at.torch.compose.ui.composable.ChatRoomCreationScreen
|
import at.torch.compose.ui.composable.ChatRoomCreationScreen
|
||||||
import at.torch.compose.ui.composable.ChatRoomMessagingListScreen
|
import at.torch.compose.ui.composable.ChatRoomMessagingScreen
|
||||||
import at.torch.compose.ui.composable.CreateProfileScreen
|
import at.torch.compose.ui.composable.CreateProfileScreen
|
||||||
import at.torch.compose.ui.composable.HomeScreen
|
import at.torch.compose.ui.composable.HomeScreen
|
||||||
import at.torch.compose.ui.composable.ImplementationPendingScreen
|
import at.torch.compose.ui.composable.ImplementationPendingScreen
|
||||||
@@ -557,7 +557,7 @@ fun TorchNavHost(
|
|||||||
composable<ChatRoomDetailRoute> { backStackEntry ->
|
composable<ChatRoomDetailRoute> { backStackEntry ->
|
||||||
val route = backStackEntry.toRoute<ChatRoomDetailRoute>()
|
val route = backStackEntry.toRoute<ChatRoomDetailRoute>()
|
||||||
|
|
||||||
ChatRoomMessagingListScreen(
|
ChatRoomMessagingScreen(
|
||||||
activeUserPublicKey = route.activeUserPublicKey,
|
activeUserPublicKey = route.activeUserPublicKey,
|
||||||
chatRoomId = route.chatRoomId,
|
chatRoomId = route.chatRoomId,
|
||||||
relayHint = route.relayHint,
|
relayHint = route.relayHint,
|
||||||
|
|||||||
+12
-12
@@ -50,7 +50,7 @@ import at.torch.compose.nostr.Relays
|
|||||||
import at.torch.compose.repository.ChatRepository
|
import at.torch.compose.repository.ChatRepository
|
||||||
import at.torch.compose.repository.NostrRepository
|
import at.torch.compose.repository.NostrRepository
|
||||||
import at.torch.compose.ui.composable.widgets.profile.ProfileColor
|
import at.torch.compose.ui.composable.widgets.profile.ProfileColor
|
||||||
import at.torch.compose.ui.view.state.ChatRoomMessageListUIState
|
import at.torch.compose.ui.view.state.ChatMessageListUIState
|
||||||
import co.touchlab.kermit.Logger
|
import co.touchlab.kermit.Logger
|
||||||
import com.vitorpamplona.quartz.marmot.mip03GroupMessages.GroupEvent
|
import com.vitorpamplona.quartz.marmot.mip03GroupMessages.GroupEvent
|
||||||
import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent
|
import com.vitorpamplona.quartz.nip17Dm.settings.ChatMessageRelayListEvent
|
||||||
@@ -60,14 +60,14 @@ import kotlinx.coroutines.IO
|
|||||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
class ChatRoomDetailMessageListViewModel(
|
class ChatMessageListViewModel(
|
||||||
initialChatRoomMessageListUIState: ChatRoomMessageListUIState,
|
initialChatMessageListUIState: ChatMessageListUIState,
|
||||||
val localChatRoom: LocalChatRoom,
|
val localChatRoom: LocalChatRoom,
|
||||||
val nostrRepository: NostrRepository,
|
val nostrRepository: NostrRepository,
|
||||||
val chatRepository: ChatRepository
|
val chatRepository: ChatRepository
|
||||||
): ViewModel() {
|
): ViewModel() {
|
||||||
val logger = Logger.withTag(TAG)
|
val logger = Logger.withTag(TAG)
|
||||||
var chatRoomMessageListUIState: ChatRoomMessageListUIState by mutableStateOf(initialChatRoomMessageListUIState)
|
var chatMessageListUIState: ChatMessageListUIState by mutableStateOf(initialChatMessageListUIState)
|
||||||
private set
|
private set
|
||||||
|
|
||||||
val isReceiverChatMessageRelayListMissing: MutableState<Boolean> = mutableStateOf(false)
|
val isReceiverChatMessageRelayListMissing: MutableState<Boolean> = mutableStateOf(false)
|
||||||
@@ -85,7 +85,7 @@ class ChatRoomDetailMessageListViewModel(
|
|||||||
localChatRoom.chatRoom.id
|
localChatRoom.chatRoom.id
|
||||||
).distinctUntilChanged().collect { chatMessages ->
|
).distinctUntilChanged().collect { chatMessages ->
|
||||||
logger.d("getChatMessageListByChatRoomId: $chatMessages")
|
logger.d("getChatMessageListByChatRoomId: $chatMessages")
|
||||||
chatRoomMessageListUIState = ChatRoomMessageListUIState.Loaded(
|
chatMessageListUIState = ChatMessageListUIState.Loaded(
|
||||||
chatMessageList = chatMessages
|
chatMessageList = chatMessages
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -203,8 +203,8 @@ class ChatRoomDetailMessageListViewModel(
|
|||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
) {
|
) {
|
||||||
when (val chatRoomDetailMessageListUIState = this@ChatRoomDetailMessageListViewModel.chatRoomMessageListUIState) {
|
when (val chatRoomDetailMessageListUIState = this@ChatMessageListViewModel.chatMessageListUIState) {
|
||||||
ChatRoomMessageListUIState.Error -> {
|
ChatMessageListUIState.Error -> {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
@@ -217,7 +217,7 @@ class ChatRoomDetailMessageListViewModel(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is ChatRoomMessageListUIState.Loaded -> {
|
is ChatMessageListUIState.Loaded -> {
|
||||||
Spacer(
|
Spacer(
|
||||||
modifier = Modifier.weight(1f)
|
modifier = Modifier.weight(1f)
|
||||||
)
|
)
|
||||||
@@ -385,7 +385,7 @@ class ChatRoomDetailMessageListViewModel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ChatRoomMessageListUIState.Loading -> {
|
ChatMessageListUIState.Loading -> {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
@@ -427,14 +427,14 @@ class ChatRoomDetailMessageListViewModel(
|
|||||||
const val TAG = "ChatRoomDetailMessageListViewModel"
|
const val TAG = "ChatRoomDetailMessageListViewModel"
|
||||||
|
|
||||||
fun factory(
|
fun factory(
|
||||||
initialChatRoomMessageListUIState: ChatRoomMessageListUIState = ChatRoomMessageListUIState.Loading,
|
initialChatMessageListUIState: ChatMessageListUIState = ChatMessageListUIState.Loading,
|
||||||
localChatRoom: LocalChatRoom,
|
localChatRoom: LocalChatRoom,
|
||||||
nostrRepository: NostrRepository,
|
nostrRepository: NostrRepository,
|
||||||
chatRepository: ChatRepository
|
chatRepository: ChatRepository
|
||||||
): ViewModelProvider.Factory = viewModelFactory {
|
): ViewModelProvider.Factory = viewModelFactory {
|
||||||
initializer {
|
initializer {
|
||||||
ChatRoomDetailMessageListViewModel(
|
ChatMessageListViewModel(
|
||||||
initialChatRoomMessageListUIState = initialChatRoomMessageListUIState,
|
initialChatMessageListUIState = initialChatMessageListUIState,
|
||||||
localChatRoom = localChatRoom,
|
localChatRoom = localChatRoom,
|
||||||
nostrRepository = nostrRepository,
|
nostrRepository = nostrRepository,
|
||||||
chatRepository = chatRepository
|
chatRepository = chatRepository
|
||||||
+13
-13
@@ -13,23 +13,23 @@ import at.torch.compose.repository.ChatRepository
|
|||||||
import at.torch.compose.repository.NostrRepository
|
import at.torch.compose.repository.NostrRepository
|
||||||
import at.torch.compose.ui.composable.navigation.routes.ChatRoomDetailRoute
|
import at.torch.compose.ui.composable.navigation.routes.ChatRoomDetailRoute
|
||||||
import at.torch.compose.ui.composable.navigation.routes.Route
|
import at.torch.compose.ui.composable.navigation.routes.Route
|
||||||
import at.torch.compose.ui.view.state.ChatRoomMessagingListUIState
|
import at.torch.compose.ui.view.state.ChatRoomMessagingUIState
|
||||||
import co.touchlab.kermit.Logger
|
import co.touchlab.kermit.Logger
|
||||||
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
import com.vitorpamplona.quartz.nip01Core.core.HexKey
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.IO
|
import kotlinx.coroutines.IO
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
class ChatRoomMessagingListViewModel(
|
class ChatRoomMessagingViewModel(
|
||||||
val chatRoomId: String,
|
val chatRoomId: String,
|
||||||
val activeUserPublicKey: HexKey,
|
val activeUserPublicKey: HexKey,
|
||||||
val relayHint: String?,
|
val relayHint: String?,
|
||||||
initialChatRoomMessagingListUIState: ChatRoomMessagingListUIState,
|
initialChatRoomMessagingUIState: ChatRoomMessagingUIState,
|
||||||
val nostrRepository: NostrRepository,
|
val nostrRepository: NostrRepository,
|
||||||
val chatRepository: ChatRepository
|
val chatRepository: ChatRepository
|
||||||
): ViewModel() {
|
): ViewModel() {
|
||||||
|
|
||||||
var chatRoomMessagingListUIState: ChatRoomMessagingListUIState by mutableStateOf(initialChatRoomMessagingListUIState)
|
var chatRoomMessagingUIState: ChatRoomMessagingUIState by mutableStateOf(initialChatRoomMessagingUIState)
|
||||||
private set
|
private set
|
||||||
|
|
||||||
|
|
||||||
@@ -44,11 +44,11 @@ class ChatRoomMessagingListViewModel(
|
|||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
val localChatRoom = chatRepository.getChatRoomByIdentifier(chatRoomId)
|
val localChatRoom = chatRepository.getChatRoomByIdentifier(chatRoomId)
|
||||||
|
|
||||||
chatRoomMessagingListUIState = if (localChatRoom == null) {
|
chatRoomMessagingUIState = if (localChatRoom == null) {
|
||||||
// Initiate new chat... and navigate to new chat...
|
// Initiate new chat... and navigate to new chat...
|
||||||
ChatRoomMessagingListUIState.InitiatingNewChat
|
ChatRoomMessagingUIState.InitiatingNewChat
|
||||||
} else {
|
} else {
|
||||||
ChatRoomMessagingListUIState.Loaded(
|
ChatRoomMessagingUIState.Loaded(
|
||||||
localChatRoom = localChatRoom
|
localChatRoom = localChatRoom
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -110,7 +110,7 @@ class ChatRoomMessagingListViewModel(
|
|||||||
val keyPackageEvent = chatRepository.getMarmotKeyPackageForPublicKey(chatRoomId)
|
val keyPackageEvent = chatRepository.getMarmotKeyPackageForPublicKey(chatRoomId)
|
||||||
|
|
||||||
if (keyPackageEvent == null) {
|
if (keyPackageEvent == null) {
|
||||||
chatRoomMessagingListUIState = ChatRoomMessagingListUIState.Error("Missing Key Package") // TODO: Introduce missing key package UI State...
|
chatRoomMessagingUIState = ChatRoomMessagingUIState.Error("Missing Key Package") // TODO: Introduce missing key package UI State...
|
||||||
} else {
|
} else {
|
||||||
// Create new chat and invite local
|
// Create new chat and invite local
|
||||||
try {
|
try {
|
||||||
@@ -128,13 +128,13 @@ class ChatRoomMessagingListViewModel(
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
chatRoomMessagingListUIState = ChatRoomMessagingListUIState.Error("Failed to create chat")
|
chatRoomMessagingUIState = ChatRoomMessagingUIState.Error("Failed to create chat")
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
chatRoomMessagingListUIState = ChatRoomMessagingListUIState.Error("Couldn't find profile...")
|
chatRoomMessagingUIState = ChatRoomMessagingUIState.Error("Couldn't find profile...")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,16 +147,16 @@ class ChatRoomMessagingListViewModel(
|
|||||||
activeUserPublicKey: HexKey,
|
activeUserPublicKey: HexKey,
|
||||||
chatRoomId: String,
|
chatRoomId: String,
|
||||||
relayHint: String?,
|
relayHint: String?,
|
||||||
initialChatRoomMessagingListUIState: ChatRoomMessagingListUIState = ChatRoomMessagingListUIState.Loading,
|
initialChatRoomMessagingUIState: ChatRoomMessagingUIState = ChatRoomMessagingUIState.Loading,
|
||||||
nostrRepository: NostrRepository,
|
nostrRepository: NostrRepository,
|
||||||
chatRepository: ChatRepository
|
chatRepository: ChatRepository
|
||||||
): ViewModelProvider.Factory = viewModelFactory {
|
): ViewModelProvider.Factory = viewModelFactory {
|
||||||
initializer {
|
initializer {
|
||||||
ChatRoomMessagingListViewModel(
|
ChatRoomMessagingViewModel(
|
||||||
activeUserPublicKey = activeUserPublicKey,
|
activeUserPublicKey = activeUserPublicKey,
|
||||||
chatRoomId = chatRoomId,
|
chatRoomId = chatRoomId,
|
||||||
relayHint = relayHint,
|
relayHint = relayHint,
|
||||||
initialChatRoomMessagingListUIState = initialChatRoomMessagingListUIState,
|
initialChatRoomMessagingUIState = initialChatRoomMessagingUIState,
|
||||||
nostrRepository = nostrRepository,
|
nostrRepository = nostrRepository,
|
||||||
chatRepository = chatRepository
|
chatRepository = chatRepository
|
||||||
)
|
)
|
||||||
Executable
+13
@@ -0,0 +1,13 @@
|
|||||||
|
package at.torch.compose.ui.view.state
|
||||||
|
|
||||||
|
import at.torch.compose.database.model.intermdiate.LocalChatMessage
|
||||||
|
|
||||||
|
sealed interface ChatMessageListUIState {
|
||||||
|
data class Loaded(
|
||||||
|
val chatMessageList: List<LocalChatMessage>
|
||||||
|
): ChatMessageListUIState
|
||||||
|
|
||||||
|
data object Error: ChatMessageListUIState
|
||||||
|
data object Loading: ChatMessageListUIState
|
||||||
|
}
|
||||||
|
|
||||||
-11
@@ -1,11 +0,0 @@
|
|||||||
package at.torch.compose.ui.view.state
|
|
||||||
|
|
||||||
sealed interface ChatRoomMessageListUIState {
|
|
||||||
data class Loaded(
|
|
||||||
val chatMessageList: List<at.torch.compose.database.model.intermdiate.LocalChatMessage>
|
|
||||||
): ChatRoomMessageListUIState
|
|
||||||
|
|
||||||
data object Error: ChatRoomMessageListUIState
|
|
||||||
data object Loading: ChatRoomMessageListUIState
|
|
||||||
}
|
|
||||||
|
|
||||||
-16
@@ -1,16 +0,0 @@
|
|||||||
package at.torch.compose.ui.view.state
|
|
||||||
|
|
||||||
import at.torch.compose.database.model.intermdiate.LocalChatRoom
|
|
||||||
|
|
||||||
sealed interface ChatRoomMessagingListUIState {
|
|
||||||
data class Loaded(
|
|
||||||
val localChatRoom: LocalChatRoom
|
|
||||||
): ChatRoomMessagingListUIState
|
|
||||||
|
|
||||||
data class Error(
|
|
||||||
val message: String
|
|
||||||
): ChatRoomMessagingListUIState
|
|
||||||
data object Loading: ChatRoomMessagingListUIState
|
|
||||||
data object InitiatingNewChat: ChatRoomMessagingListUIState
|
|
||||||
}
|
|
||||||
|
|
||||||
Executable
+16
@@ -0,0 +1,16 @@
|
|||||||
|
package at.torch.compose.ui.view.state
|
||||||
|
|
||||||
|
import at.torch.compose.database.model.intermdiate.LocalChatRoom
|
||||||
|
|
||||||
|
sealed interface ChatRoomMessagingUIState {
|
||||||
|
data class Loaded(
|
||||||
|
val localChatRoom: LocalChatRoom
|
||||||
|
): ChatRoomMessagingUIState
|
||||||
|
|
||||||
|
data class Error(
|
||||||
|
val message: String
|
||||||
|
): ChatRoomMessagingUIState
|
||||||
|
data object Loading: ChatRoomMessagingUIState
|
||||||
|
data object InitiatingNewChat: ChatRoomMessagingUIState
|
||||||
|
}
|
||||||
|
|
||||||
Reference in new issue
Block a user