Merge remote-tracking branch 'origin/HEAD'

This commit is contained in:
Vitor Pamplona
2023-03-27 09:59:04 -04:00
5 changed files with 11 additions and 6 deletions

View File

@@ -75,7 +75,7 @@ fun UserCompose(baseUser: User, accountViewModel: AccountViewModel, navControlle
} else if (userFollows.isFollowingCached(baseUser)) {
UnfollowButton { coroutineScope.launch(Dispatchers.IO) { account.unfollow(baseUser) } }
} else {
FollowButton { coroutineScope.launch(Dispatchers.IO) { account.follow(baseUser) } }
FollowButton({ coroutineScope.launch(Dispatchers.IO) { account.follow(baseUser) } })
}
}
}

View File

@@ -120,7 +120,7 @@ fun ZapNoteCompose(baseNote: Pair<Note, Note>, accountViewModel: AccountViewMode
} else if (userFollows.isFollowingCached(baseAuthor)) {
UnfollowButton { coroutineScope.launch(Dispatchers.IO) { account.unfollow(baseAuthor) } }
} else {
FollowButton { coroutineScope.launch(Dispatchers.IO) { account.follow(baseAuthor) } }
FollowButton({ coroutineScope.launch(Dispatchers.IO) { account.follow(baseAuthor) } })
}
}
}

View File

@@ -111,7 +111,7 @@ fun HashtagHeader(tag: String, account: Account) {
if (userFollows.isFollowingHashtagCached(tag)) {
UnfollowButton { coroutineScope.launch(Dispatchers.IO) { account.unfollow(tag) } }
} else {
FollowButton { coroutineScope.launch(Dispatchers.IO) { account.follow(tag) } }
FollowButton({ coroutineScope.launch(Dispatchers.IO) { account.follow(tag) } })
}
}
}

View File

@@ -389,7 +389,11 @@ private fun ProfileHeader(
} else if (accountUser.isFollowingCached(baseUser)) {
UnfollowButton { coroutineScope.launch(Dispatchers.IO) { account.unfollow(baseUser) } }
} else {
FollowButton { coroutineScope.launch(Dispatchers.IO) { account.follow(baseUser) } }
if (baseUser.isFollowingCached(accountUser)) {
FollowButton({ coroutineScope.launch(Dispatchers.IO) { account.follow(baseUser) } }, R.string.follow_back)
} else {
FollowButton({ coroutineScope.launch(Dispatchers.IO) { account.follow(baseUser) } }, R.string.follow)
}
}
}
}
@@ -949,7 +953,7 @@ fun UnfollowButton(onClick: () -> Unit) {
}
@Composable
fun FollowButton(onClick: () -> Unit) {
fun FollowButton(onClick: () -> Unit, text: Int = R.string.follow) {
Button(
modifier = Modifier.padding(start = 3.dp),
onClick = onClick,
@@ -960,7 +964,7 @@ fun FollowButton(onClick: () -> Unit) {
),
contentPadding = PaddingValues(vertical = 6.dp, horizontal = 16.dp)
) {
Text(text = stringResource(R.string.follow), color = Color.White, textAlign = TextAlign.Center)
Text(text = stringResource(text), color = Color.White, textAlign = TextAlign.Center)
}
}

View File

@@ -122,6 +122,7 @@
<string name="send_a_direct_message">Send a Direct Message</string>
<string name="edits_the_user_s_metadata">Edits the User\'s Metadata</string>
<string name="follow">Follow</string>
<string name="follow_back">Follow back</string>
<string name="unblock">Unblock</string>
<string name="copy_user_id">Copy User ID</string>
<string name="unblock_user">Unblock User</string>