Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(call): show avatar in incoming call #3511

Merged
merged 2 commits into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions components/views/media/incomingCall/IncomingCall.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
<div>
<div class="content">
<div class="gradient-cover" data-cy="incoming-call"></div>
<div v-if="callType === 'friend' && friend" class="caller--user">
<div
v-if="Boolean(caller)"
class="caller"
molimauro marked this conversation as resolved.
Show resolved Hide resolved
:class="callType === 'friend' ? 'caller--user' : 'caller--group'"
>
<div
class="user-profile-picture"
v-bind:style="`background:url(${friend.profilePicture})`"
v-bind:style="`background:url(${callerAvatar})`"
/>
<div class="user-info">
<p class="user-name">{{friend.name}}</p>
<p class="user-status">{{friend.status}}</p>
</div>
</div>
<div v-else-if="callType === 'group' && group" class="caller--group">
<div class="user-info">
<p class="user-name">{{group.name}}</p>
<p class="user-status">{{group.status}}</p>
<p class="user-name">{{caller.name}}</p>
<p class="user-status">{{caller.status}}</p>
</div>
<div
class="user-profile-picture"
v-bind:style="`background:url(${group.profilePicture})`"
/>
</div>
</div>
<footer class="modal-card-foot">
Expand Down
4 changes: 4 additions & 0 deletions components/views/media/incomingCall/IncomingCall.less
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
height: 400px;
}

.caller {
height: 100%;
}

.user-profile-picture {
background-size: cover !important;
background-position: center !important;
Expand Down
35 changes: 18 additions & 17 deletions components/views/media/incomingCall/IncomingCall.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,6 @@ export default Vue.extend({
},
computed: {
...mapState(['conversation', 'groups', 'friends']),
group() {
return (
this.callType === 'group' &&
this.$store.state.groups.all.find(
(g: any) => g.id === this.$store.state.webrtc.incomingCall?.callId,
)
)
},
friend() {
return (
this.callType === 'friend' &&
this.$store.state.friends.all.find(
(f: any) =>
f.peerId === this.$store.state.webrtc.incomingCall?.callId,
)
)
},
callType() {
return this.$store.state.webrtc.incomingCall?.callId &&
RegExp(this.$Config.regex.uuidv4).test(
Expand All @@ -60,6 +43,24 @@ export default Vue.extend({
? 'group'
: 'friend'
},
caller() {
if (!this.callType) {
return
}
if (this.callType === 'friend') {
return this.$store.state.friends.all.find(
(f: any) =>
f.peerId === this.$store.state.webrtc.incomingCall?.callId,
)
}
return this.$store.state.groups.all.find(
(g: any) => g.id === this.$store.state.webrtc.incomingCall?.callId,
)
},
callerAvatar(): string {
const hash = this.caller?.profilePicture
return hash ? `${this.$Config.textile.browser}/ipfs/${hash}` : ''
},
},
watch: {
'$store.state.webrtc.incomingCall': {
Expand Down