Skip to content

Commit 1dfb65b

Browse files
committed
Load only avatar images in supported formats
1 parent dc8843c commit 1dfb65b

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

Packages/com.walletconnect.web3modal/Runtime/Presenters/AccountPresenter.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,20 @@ private void UpdateProfileAvatar()
9696
{
9797
var avatarUrl = Web3Modal.AccountController.ProfileAvatar;
9898

99-
if (string.IsNullOrEmpty(avatarUrl))
100-
{
101-
var address = Web3Modal.AccountController.Address;
102-
var texture = UiUtils.GenerateAvatarTexture(address);
103-
View.ProfileAvatarImage.image = texture;
104-
}
105-
else
99+
if (!string.IsNullOrEmpty(avatarUrl) && (avatarUrl.EndsWith(".jpg") || avatarUrl.EndsWith(".png") || avatarUrl.EndsWith(".jpeg")))
106100
{
107101
var remoteSprite = RemoteSpriteFactory.GetRemoteSprite<Image>(avatarUrl);
108102
_avatar?.UnsubscribeImage(View.ProfileAvatarImage);
109103
_avatar = remoteSprite;
110104
_avatar.SubscribeImage(View.ProfileAvatarImage);
111105
}
106+
else
107+
{
108+
109+
var address = Web3Modal.AccountController.Address;
110+
var texture = UiUtils.GenerateAvatarTexture(address);
111+
View.ProfileAvatarImage.image = texture;
112+
}
112113
}
113114

114115
protected override void OnVisibleCore()

0 commit comments

Comments
 (0)