@@ -43,6 +43,7 @@ import com.infomaniak.mail.data.models.correspondent.MergedContact
43
43
import com.infomaniak.mail.databinding.ViewAvatarBinding
44
44
import com.infomaniak.mail.utils.AccountUtils
45
45
import com.infomaniak.mail.utils.Utils
46
+ import com.infomaniak.mail.utils.Utils.runCatchingRealm
46
47
import com.infomaniak.mail.utils.extensions.MergedContactDictionary
47
48
import com.infomaniak.mail.utils.extensions.getColorOrNull
48
49
import com.infomaniak.mail.utils.extensions.getTransparentColor
@@ -71,11 +72,13 @@ class AvatarView @JvmOverloads constructor(
71
72
}
72
73
73
74
private val avatarUpdateObserver = Observer <Pair <MergedContactDictionary , Boolean >> { (contacts, isBimiEnabled) ->
74
- val (correspondent, bimi) = state
75
- val displayType = getAvatarDisplayType(correspondent, bimi, isBimiEnabled)
75
+ runCatchingRealm {
76
+ val (correspondent, bimi) = state
77
+ val displayType = getAvatarDisplayType(correspondent, bimi, isBimiEnabled)
76
78
77
- if (displayType == AvatarDisplayType .UNKNOWN_CORRESPONDENT ) return @Observer
78
- loadAvatarByDisplayType(displayType, correspondent, bimi, contacts)
79
+ if (displayType == AvatarDisplayType .UNKNOWN_CORRESPONDENT ) return @Observer
80
+ loadAvatarByDisplayType(displayType, correspondent, bimi, contacts)
81
+ }
79
82
}
80
83
81
84
@Inject
0 commit comments