feat: 用户认证显示

This commit is contained in:
HuanCheng65 2023-10-08 15:02:07 +08:00
parent a3bb46ba46
commit 065e30af12
No known key found for this signature in database
GPG Key ID: 5EC9DD60A32C7360
12 changed files with 208 additions and 7 deletions

View File

@ -37,6 +37,8 @@ import androidx.compose.material.icons.outlined.ContentCopy
import androidx.compose.material.icons.rounded.Add import androidx.compose.material.icons.rounded.Add
import androidx.compose.material.icons.rounded.Edit import androidx.compose.material.icons.rounded.Edit
import androidx.compose.material.icons.rounded.NoAccounts import androidx.compose.material.icons.rounded.NoAccounts
import androidx.compose.material.icons.rounded.SupervisedUserCircle
import androidx.compose.material.icons.rounded.Verified
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable import androidx.compose.runtime.Immutable
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
@ -252,7 +254,7 @@ fun UserProfilePage(
} }
} }
} }
} },
) )
} }
) { paddingValues -> ) { paddingValues ->
@ -656,10 +658,48 @@ private fun UserProfileDetail(
Text( Text(
text = user.get { intro }.takeIf { it.isNotEmpty() } text = user.get { intro }.takeIf { it.isNotEmpty() }
?: stringResource(id = R.string.tip_no_intro), ?: stringResource(id = R.string.tip_no_intro),
style = MaterialTheme.typography.body1, style = MaterialTheme.typography.body2,
maxLines = 1, maxLines = 1,
overflow = TextOverflow.Ellipsis overflow = TextOverflow.Ellipsis
) )
user.getNullableImmutable { bazhu_grade }?.let {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
Icon(
imageVector = Icons.Rounded.SupervisedUserCircle,
contentDescription = null,
modifier = Modifier.size(16.dp),
tint = ExtendedTheme.colors.primary,
)
Text(
text = it.get { desc },
style = MaterialTheme.typography.body2,
color = ExtendedTheme.colors.primary,
)
}
}
user.getNullableImmutable { new_god_data }
?.takeIf { it.get { status } != 0 }
?.let {
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
Icon(
imageVector = Icons.Rounded.Verified,
contentDescription = null,
modifier = Modifier.size(16.dp),
tint = ExtendedTheme.colors.primary,
)
Text(
text = stringResource(id = R.string.text_god_verify, it.get { field_name }),
style = MaterialTheme.typography.body2,
color = ExtendedTheme.colors.primary,
)
}
}
val sexEmoji = when (user.get { sex }) { val sexEmoji = when (user.get { sex }) {
1 -> "" 1 -> ""
2 -> "" 2 -> ""

View File

@ -295,6 +295,8 @@ fun Toolbar(
title: @Composable (() -> Unit), title: @Composable (() -> Unit),
navigationIcon: (@Composable () -> Unit)? = null, navigationIcon: (@Composable () -> Unit)? = null,
actions: @Composable RowScope.() -> Unit = {}, actions: @Composable RowScope.() -> Unit = {},
backgroundColor: Color = ExtendedTheme.colors.topBar,
contentColor: Color = ExtendedTheme.colors.onTopBar,
content: (@Composable ColumnScope.() -> Unit)? = null, content: (@Composable ColumnScope.() -> Unit)? = null,
) { ) {
TopAppBarContainer( TopAppBarContainer(
@ -302,21 +304,21 @@ fun Toolbar(
TopAppBar( TopAppBar(
title = { title = {
ProvideTextStyle(value = MaterialTheme.typography.h6.copy(fontWeight = FontWeight.Bold)) { ProvideTextStyle(value = MaterialTheme.typography.h6.copy(fontWeight = FontWeight.Bold)) {
ProvideContentColor(color = ExtendedTheme.colors.onTopBar, content = title) ProvideContentColor(color = contentColor, content = title)
} }
}, },
actions = { actions = {
ProvideContentColor(color = ExtendedTheme.colors.onTopBar) { ProvideContentColor(color = contentColor) {
actions() actions()
} }
}, },
navigationIcon = (@Composable { navigationIcon = (@Composable {
ProvideContentColor(color = ExtendedTheme.colors.onTopBar) { ProvideContentColor(color = contentColor) {
navigationIcon?.invoke() navigationIcon?.invoke()
} }
}).takeIf { navigationIcon != null }, }).takeIf { navigationIcon != null },
backgroundColor = ExtendedTheme.colors.topBar, backgroundColor = backgroundColor,
contentColor = ExtendedTheme.colors.onTopBar, contentColor = contentColor,
elevation = 0.dp elevation = 0.dp
) )
}, },

View File

@ -0,0 +1,10 @@
syntax = "proto3";
package tieba;
option java_package = "com.huanchengfly.tieba.post.api.models.protos";
message BazhuSign {
string desc = 1;
string level = 2;
}

View File

@ -0,0 +1,17 @@
syntax = "proto3";
package tieba;
option java_package = "com.huanchengfly.tieba.post.api.models.protos";
message GodInfo {
int64 id = 1;
string intro = 2;
int32 type = 3;
int64 fid = 4;
int32 followed = 5;
string recommend_reason = 6;
string forum_name = 7;
int32 can_send_msg = 8;
string prefix = 9;
}

View File

@ -0,0 +1,19 @@
syntax = "proto3";
import "Position.proto";
import "Terminal.proto";
package tieba;
option java_package = "com.huanchengfly.tieba.post.api.models.protos";
message Icon {
string name = 1;
int32 weight = 2;
string url = 3;
string icon = 4;
int32 value = 5;
Terminal terminal = 6;
Position position = 7;
repeated string sprite_info = 8;
}

View File

@ -0,0 +1,10 @@
syntax = "proto3";
package tieba;
option java_package = "com.huanchengfly.tieba.post.api.models.protos";
message LikeForumInfo {
string forum_name = 1;
uint64 forum_id = 2;
}

View File

@ -0,0 +1,13 @@
syntax = "proto3";
package tieba;
option java_package = "com.huanchengfly.tieba.post.api.models.protos";
message NewGodInfo {
int32 status = 1;
uint32 field_id = 2;
string field_name = 3;
uint32 type = 4;
string type_name = 5;
}

View File

@ -0,0 +1,12 @@
syntax = "proto3";
package tieba;
option java_package = "com.huanchengfly.tieba.post.api.models.protos";
message Position {
int32 frs = 1;
int32 pb = 2;
int32 home = 3;
int32 card = 4;
}

View File

@ -0,0 +1,11 @@
syntax = "proto3";
package tieba;
option java_package = "com.huanchengfly.tieba.post.api.models.protos";
message Terminal {
int32 pc = 1;
int32 wap = 2;
int32 client = 3;
}

View File

@ -1,5 +1,14 @@
syntax = "proto3"; syntax = "proto3";
import "BawuThrones.proto";
import "BazhuSign.proto";
import "GodInfo.proto";
import "Icon.proto";
import "LikeForumInfo.proto";
import "NewGodInfo.proto";
import "UserPics.proto";
import "PrivSets.proto"; import "PrivSets.proto";
import "SimpleUser.proto";
package tieba; package tieba;
@ -15,30 +24,77 @@ message User {
int32 type = 7; int32 type = 7;
int32 userhide = 9; int32 userhide = 9;
int32 is_manager = 11; int32 is_manager = 11;
string rank = 12;
string bimg_url = 13;
int32 meizhi_level = 14;
int32 is_verify = 15;
int32 is_interestman = 16;
repeated Icon iconinfo = 17;
int32 user_type = 19;
int32 is_coreuser = 20;
int32 is_huinibuke = 21;
string ios_bimg_format = 22;
int32 level_id = 23; int32 level_id = 23;
int32 is_like = 24;
int32 is_bawu = 25; int32 is_bawu = 25;
string bawu_type = 26; string bawu_type = 26;
string portraith = 27; string portraith = 27;
string ip = 28;
string BDUSS = 29;
int32 fans_num = 30; int32 fans_num = 30;
int32 concern_num = 31; int32 concern_num = 31;
int32 sex = 32; int32 sex = 32;
int32 my_like_num = 33; int32 my_like_num = 33;
string intro = 34; string intro = 34;
int32 has_concerned = 35; int32 has_concerned = 35;
string passwd = 36;
int32 post_num = 37; int32 post_num = 37;
string tb_age = 38; string tb_age = 38;
int32 is_mem = 39;
int32 bimg_end_time = 40;
int32 gender = 42; int32 gender = 42;
int32 is_mask = 43;
repeated UserPics user_pics = 44;
PrivSets privSets = 45; PrivSets privSets = 45;
int32 is_friend = 46;
repeated LikeForumInfo likeForum = 47;
int32 gift_num = 49;
int32 is_select_tail = 51;
int32 is_guanfang = 52;
int32 bookmark_count = 53;
int32 bookmark_new_count = 54;
repeated SimpleUser mute_user = 55;
int64 friend_num = 56; int64 friend_num = 56;
string fansNickname = 57; string fansNickname = 57;
string bg_pic = 58;
GodInfo god_data = 62;
int32 heavy_user = 63;
int32 visitor_num = 75; int32 visitor_num = 75;
int32 total_visitor_num = 76; int32 total_visitor_num = 76;
int32 nickname_update_time = 86;
int32 thread_num = 87; int32 thread_num = 87;
int32 agree_num = 88; int32 agree_num = 88;
int32 left_call_num = 89;
int32 is_invited = 90;
int32 is_fans = 91;
int32 priv_thread = 92; int32 priv_thread = 92;
int32 is_videobiggie = 93;
int32 is_show_redpacket = 94;
int32 can_modify_avatar = 97;
string modify_avatar_desc = 98;
int32 influence = 99;
string level_influence = 100;
optional NewGodInfo new_god_data = 101;
BawuThrones bawu_thrones = 103;
BazhuSign bazhu_grade = 105;
int32 isDefaultAvatar = 106; int32 isDefaultAvatar = 106;
int32 favorite_num = 109; int32 favorite_num = 109;
uint32 total_agree_num = 118; uint32 total_agree_num = 118;
string level_name = 125; string level_name = 125;
string ip_address = 127; string ip_address = 127;
int32 is_nickname_editing = 128;
string editing_nickname = 129;
string display_intro = 138;
repeated string new_icon_url = 139;
string dynamic_url = 140;
} }

View File

@ -0,0 +1,10 @@
syntax = "proto3";
package tieba;
option java_package = "com.huanchengfly.tieba.post.api.models.protos";
message UserPics {
string big = 1;
string small = 2;
}

View File

@ -760,4 +760,5 @@
<string name="menu_add_user_to_black_list">添加到黑名单</string> <string name="menu_add_user_to_black_list">添加到黑名单</string>
<string name="menu_add_user_to_white_list">添加到白名单</string> <string name="menu_add_user_to_white_list">添加到白名单</string>
<string name="btn_block">屏蔽选项</string> <string name="btn_block">屏蔽选项</string>
<string name="text_god_verify">%s领域大神</string>
</resources> </resources>