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

feat(mobile): background call indicator on mobile #4492

Merged
merged 2 commits into from
Aug 26, 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
1 change: 0 additions & 1 deletion assets/styles/framework/ui.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
@chatbar-size: 78px;
@mobile-nav-height: 60px;
@chatbar-input-height: 48px;
@background-call-height: 36px;
@indicator-size: 32px;

// Popups
Expand Down
13 changes: 8 additions & 5 deletions components/ui/BackgroundCall/BackgroundCall.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<div class="background-call" @click="navigateToActiveConversation">
{{$t('ui.background_call')}}&nbsp;
<span v-if="remoteParticipant" class="background-call-name"
>{{remoteParticipant.name}}</span
>&nbsp;
<span v-if="elapsedTime">- {{elapsedTime}}</span>
<TypographyText size="xs" class="text">
<span>{{ $t('ui.background_call') }} -&nbsp;</span>
<b v-if="remoteParticipant" class="ellipsis">
{{ remoteParticipant.name }}
</b>
&nbsp;-&nbsp;
<span v-if="elapsedTime">{{ elapsedTime }}</span>
</TypographyText>
</div>
22 changes: 5 additions & 17 deletions components/ui/BackgroundCall/BackgroundCall.less
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
.background-call {
&:extend(.background-flair);
&:extend(.font-secondary);
&:extend(.absolute-coverage);
border-radius: 0 0 @corner-rounding @corner-rounding;
height: @background-call-height;
z-index: @fifth-layer-zindex;
font-size: @micro-text-size;
bottom: auto;
background-color: @flair-color;
height: 30px;
text-align: center;
box-shadow: 0px 0px 30px rgba(var(--flair-color-rgb), 0.35),
0px 0px 20px rgba(var(--flair-color-rgb), 0.4);
padding: 10px 10%;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
white-space: nowrap;
&-name {
&:extend(.ellipsis);
&:extend(.font-primary);
font-weight: 700;

.text {
display: flex;
}
}
18 changes: 6 additions & 12 deletions components/ui/BackgroundCall/BackgroundCall.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,18 @@ export default Vue.extend({
},
methods: {
navigateToActiveConversation() {
if (!this.remoteParticipant) {
return
}

if (this.$device.isMobile) {
// mobile, show slide 1 which is chat slide, set showSidebar flag false as css related
this.$store.commit('ui/showSidebar', false)
}

const id = iridium.chat?.directConversationIdFromDid(
this.remoteParticipant.did,
)

if (!id || !iridium.chat?.hasConversation(id)) {
if (
!id ||
!iridium.chat?.hasConversation(id) ||
!this.remoteParticipant
) {
return
}

this.$router.push(`/chat/${id}`)
this.$router.push(`/mobile/chat/${id}`)
},
},
})
Expand Down
2 changes: 1 addition & 1 deletion components/ui/Global/Global.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<transition :name="$device.isMobile ? 'slide' : ''">
<InteractablesQuickProfile v-if="ui.quickProfile" :user="ui.quickProfile" />
</transition>
<UiPip v-if="showBackgroundCall && $device.isDesktop" v-slot="{ dragging }">
<UiPip v-if="$device.isDesktop && isBackgroundCall" v-slot="{ dragging }">
<MediaPreviewCall :dragging="dragging" />
</UiPip>
</div>
6 changes: 0 additions & 6 deletions components/ui/Global/Global.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ export default Vue.extend({
computed: {
...mapState(['ui', 'media', 'conversation', 'files', 'settings']),
ModalWindows: () => ModalWindows,
showBackgroundCall(): boolean {
if (!this.$device.isMobile) {
return this.isBackgroundCall
}
return this.isBackgroundCall || (this.isActiveCall && this.ui.showSidebar)
},
},
watch: {
'settings.audioInput'(audioInput: string) {
Expand Down
8 changes: 8 additions & 0 deletions layouts/mobile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
id="app"
:class="[`theme-${settings.theme}`, { 'hidden-nav': !isMobileNavVisible }]"
>
<UiBackgroundCall v-if="isBackgroundCall" />
<Nuxt />
<MobileNav />
<UiGlobal />
Expand All @@ -21,12 +22,19 @@ import { flairs, Flair } from '~/libraries/Iridium/settings/types'
import 'swiper/css'
import { RootState } from '~/types/store/store'
import { Conversation } from '~/libraries/Iridium/chat/types'
import { useWebRTC } from '~/libraries/Iridium/webrtc/hooks'

export default Vue.extend({
name: 'Mobile',
setup() {
const { isBackgroundCall } = useWebRTC()

return { isBackgroundCall }
},
data() {
return {
settings: iridium.settings.state,
webrtc: iridium.webRTC.state,
}
},
computed: {
Expand Down
2 changes: 1 addition & 1 deletion locales/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default {
edited: 'edited',
online: 'All users are offline | {name} is online | {name} are online',
offline: '{name} is not connected',
background_call: 'You are currently in a call with',
background_call: 'Current call',
},
time: {
now: 'now',
Expand Down
2 changes: 1 addition & 1 deletion pages/mobile/friends/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</button>
</div>
</div>
<FriendsMobileList v-if="friends.length" :list="friendsList" />
<FriendsMobileList v-if="friendsList.length" :list="friendsList" />
<div v-else class="empty-friends-container">
<FriendsEmptyMessage class="empty-friends" @click="setSwiperAsTab" />
</div>
Expand Down