Corrects some of the keys for Launched effects
This commit is contained in:
+1
-1
@@ -61,7 +61,7 @@ fun NewUserMetadataScreen(
|
||||
postViewModel.init(accountViewModel)
|
||||
val context = LocalContext.current
|
||||
|
||||
LaunchedEffect(accountViewModel) {
|
||||
LaunchedEffect(postViewModel, accountViewModel) {
|
||||
postViewModel.load()
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ fun ReplyCommentPostScreen(
|
||||
|
||||
val context = LocalContext.current
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
LaunchedEffect(postViewModel, accountViewModel) {
|
||||
reply?.let {
|
||||
postViewModel.reply(it)
|
||||
}
|
||||
|
||||
+2
-2
@@ -70,7 +70,7 @@ fun ChatroomView(
|
||||
newPostModel.load(room)
|
||||
|
||||
if (replyToNote != null) {
|
||||
LaunchedEffect(key1 = replyToNote) {
|
||||
LaunchedEffect(key1 = replyToNote, newPostModel, accountViewModel) {
|
||||
accountViewModel.checkGetOrCreateNote(replyToNote) {
|
||||
if (it != null) {
|
||||
newPostModel.reply(it)
|
||||
@@ -79,7 +79,7 @@ fun ChatroomView(
|
||||
}
|
||||
}
|
||||
if (editFromDraft != null) {
|
||||
LaunchedEffect(key1 = replyToNote) {
|
||||
LaunchedEffect(replyToNote, newPostModel, accountViewModel) {
|
||||
accountViewModel.checkGetOrCreateNote(editFromDraft) {
|
||||
if (it != null) {
|
||||
newPostModel.editFromDraft(it)
|
||||
|
||||
+6
-6
@@ -151,12 +151,12 @@ fun NewGroupDMScreen(
|
||||
|
||||
val context = LocalContext.current
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
withContext(Dispatchers.IO) {
|
||||
message?.ifBlank { null }?.let {
|
||||
postViewModel.updateMessage(TextFieldValue(it))
|
||||
}
|
||||
attachment?.let {
|
||||
LaunchedEffect(postViewModel, accountViewModel) {
|
||||
message?.ifBlank { null }?.let {
|
||||
postViewModel.updateMessage(TextFieldValue(it))
|
||||
}
|
||||
attachment?.let {
|
||||
withContext(Dispatchers.IO) {
|
||||
val mediaType = context.contentResolver.getType(it)
|
||||
postViewModel.pickedMedia(persistentListOf(SelectedMedia(it, mediaType)))
|
||||
}
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ fun NewProductScreen(
|
||||
|
||||
val context = LocalContext.current
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
LaunchedEffect(postViewModel, accountViewModel) {
|
||||
postViewModel.reloadRelaySet()
|
||||
draft?.let {
|
||||
postViewModel.editFromDraft(it)
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ fun GeoHashPostScreen(
|
||||
|
||||
val context = LocalContext.current
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
LaunchedEffect(postViewModel, accountViewModel) {
|
||||
geohash?.let {
|
||||
postViewModel.newPostFor(GeohashId(it))
|
||||
}
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ fun HashtagPostScreen(
|
||||
|
||||
val context = LocalContext.current
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
LaunchedEffect(postViewModel, accountViewModel) {
|
||||
hashtag?.let {
|
||||
postViewModel.newPostFor(HashtagId(it))
|
||||
}
|
||||
|
||||
+8
-8
@@ -99,7 +99,7 @@ import kotlinx.collections.immutable.toImmutableList
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class, FlowPreview::class)
|
||||
@Composable
|
||||
@@ -120,13 +120,13 @@ fun ShortNotePostScreen(
|
||||
val context = LocalContext.current
|
||||
val activity = context.getActivity()
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
launch(Dispatchers.IO) {
|
||||
postViewModel.load(baseReplyTo, quote, fork, version, draft)
|
||||
message?.ifBlank { null }?.let {
|
||||
postViewModel.updateMessage(TextFieldValue(it))
|
||||
}
|
||||
attachment?.let {
|
||||
LaunchedEffect(postViewModel, accountViewModel) {
|
||||
postViewModel.load(baseReplyTo, quote, fork, version, draft)
|
||||
message?.ifBlank { null }?.let {
|
||||
postViewModel.updateMessage(TextFieldValue(it))
|
||||
}
|
||||
attachment?.let {
|
||||
withContext(Dispatchers.IO) {
|
||||
val mediaType = context.contentResolver.getType(it)
|
||||
postViewModel.selectImage(persistentListOf(SelectedMedia(it, mediaType)))
|
||||
}
|
||||
|
||||
+1
-1
@@ -111,7 +111,7 @@ fun NewPublicMessageScreen(
|
||||
val postViewModel: NewPublicMessageViewModel = viewModel()
|
||||
postViewModel.init(accountViewModel)
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
LaunchedEffect(postViewModel, accountViewModel) {
|
||||
withContext(Dispatchers.IO) {
|
||||
to?.let {
|
||||
postViewModel.load(it)
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ fun AddDMRelayListDialog(
|
||||
|
||||
postViewModel.init(accountViewModel)
|
||||
|
||||
LaunchedEffect(postViewModel, accountViewModel.account) {
|
||||
LaunchedEffect(postViewModel, accountViewModel) {
|
||||
postViewModel.load()
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -112,7 +112,7 @@ fun LoginPage(
|
||||
val loginViewModel: LoginViewModel = viewModel()
|
||||
loginViewModel.init(accountStateViewModel)
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
LaunchedEffect(loginViewModel, isFirstLogin, newAccountKey) {
|
||||
loginViewModel.load(isFirstLogin, newAccountKey)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user