Add OSS upload and Kingfisher image support
This commit is contained in:
@ -156,21 +156,11 @@ struct AccountSwitchView: View {
|
||||
@ViewBuilder
|
||||
/// 构造账号头像,网络图加载失败时显示账号类型首字。
|
||||
private func accountAvatar(_ account: AccountSwitchAccount) -> some View {
|
||||
if let url = URL(string: account.avatar), !account.avatar.isEmpty {
|
||||
AsyncImage(url: url) { phase in
|
||||
switch phase {
|
||||
case .success(let image):
|
||||
image.resizable().scaledToFill()
|
||||
default:
|
||||
avatarFallback(account)
|
||||
}
|
||||
}
|
||||
.frame(width: 50, height: 50)
|
||||
.clipShape(Circle())
|
||||
} else {
|
||||
RemoteImage(urlString: account.avatar) {
|
||||
avatarFallback(account)
|
||||
.frame(width: 50, height: 50)
|
||||
}
|
||||
.frame(width: 50, height: 50)
|
||||
.clipShape(Circle())
|
||||
}
|
||||
|
||||
/// 构造账号头像占位。
|
||||
|
||||
Reference in New Issue
Block a user