完善个人信息编辑
- 修复了从相册选择图片时,如果文件名不包含扩展名导致的崩溃问题。 - 在编辑个人信息页面增加了“修改密码”的入口。 - 修复了新建Agent时,保存按钮状态更新不及时的问题。 - 优化了新建Agent时,对异常的处理。
This commit is contained in:
@@ -82,7 +82,8 @@ fun AccountEditScreen() {
|
|||||||
var newAvatar: UploadImage? = null
|
var newAvatar: UploadImage? = null
|
||||||
cursor?.use { cur ->
|
cursor?.use { cur ->
|
||||||
if (cur.moveToFirst()) {
|
if (cur.moveToFirst()) {
|
||||||
val displayName = cur.getString(cur.getColumnIndex("_display_name"))
|
val columnIndex = cur.getColumnIndex("_display_name")
|
||||||
|
val displayName = if (columnIndex >= 0) cur.getString(columnIndex) else "unknown"
|
||||||
val extension = displayName.substringAfterLast(".")
|
val extension = displayName.substringAfterLast(".")
|
||||||
Log.d("NewPost", "File name: $displayName, extension: $extension")
|
Log.d("NewPost", "File name: $displayName, extension: $extension")
|
||||||
// read as file
|
// read as file
|
||||||
@@ -98,7 +99,8 @@ fun AccountEditScreen() {
|
|||||||
var newBanner: UploadImage? = null
|
var newBanner: UploadImage? = null
|
||||||
cursor?.use { cur ->
|
cursor?.use { cur ->
|
||||||
if (cur.moveToFirst()) {
|
if (cur.moveToFirst()) {
|
||||||
val displayName = cur.getString(cur.getColumnIndex("_display_name"))
|
val columnIndex = cur.getColumnIndex("_display_name")
|
||||||
|
val displayName = if (columnIndex >= 0) cur.getString(columnIndex) else "unknown"
|
||||||
val extension = displayName.substringAfterLast(".")
|
val extension = displayName.substringAfterLast(".")
|
||||||
Log.d("NewPost", "File name: $displayName, extension: $extension")
|
Log.d("NewPost", "File name: $displayName, extension: $extension")
|
||||||
// read as file
|
// read as file
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ fun AddAgentScreen() {
|
|||||||
text = stringResource(R.string.agent_create),
|
text = stringResource(R.string.agent_create),
|
||||||
isLoading = model.isUpdating,
|
isLoading = model.isUpdating,
|
||||||
loadingText = stringResource(R.string.agent_createing),
|
loadingText = stringResource(R.string.agent_createing),
|
||||||
enabled = !model.isUpdating && model.validate() == null
|
enabled = !model.isUpdating && validate()
|
||||||
) {
|
) {
|
||||||
// 验证输入
|
// 验证输入
|
||||||
val validationError = model.validate()
|
val validationError = model.validate()
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ object AddAgentViewModel : ViewModel() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
} catch (e: Exception)
|
} catch (e: Exception) {
|
||||||
throw e
|
throw e
|
||||||
} finally {
|
} finally {
|
||||||
isUpdating = false
|
isUpdating = false
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
<string name="empty_my_post_content">发布一个动态吧</string>
|
<string name="empty_my_post_content">发布一个动态吧</string>
|
||||||
<string name="edit_profile">编辑个人资料</string>
|
<string name="edit_profile">编辑个人资料</string>
|
||||||
<string name="logout">登出</string>
|
<string name="logout">登出</string>
|
||||||
|
<string name="change_password">修改密码</string>
|
||||||
<string name="current_password_tip1">请输入当前密码</string>
|
<string name="current_password_tip1">请输入当前密码</string>
|
||||||
<string name="current_password_tip2">密码长度必须至少为 8 个字符</string>
|
<string name="current_password_tip2">密码长度必须至少为 8 个字符</string>
|
||||||
<string name="current_password_tip3">密码必须至少包含一位数字</string>
|
<string name="current_password_tip3">密码必须至少包含一位数字</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user