Skip to content

Commit

Permalink
fix(mobile): fix swiper issues around mobile chat (#4491)
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmcg committed Aug 26, 2022
1 parent f0a2c95 commit 53f3519
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/ui/Global/Global.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div>
<UiSvgDefs />
<UiSvgDefs class="hidden" />
<InteractablesContextMenu v-if="ui.contextMenuStatus" />
<transition name="modal">
<SettingsModal v-if="ui.settingsRoute && !$device.isMobile" />
Expand Down
1 change: 1 addition & 0 deletions components/views/navigation/sidebar/list/List.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
v-for="c in sortedConversations"
:key="c.id"
:conversation="c"
@slideNext="$emit('slideNext')"
/>
<FriendsEmptyMessage v-if="!sortedConversations.length" displayImage />
</div>
4 changes: 4 additions & 0 deletions components/views/navigation/sidebar/list/item/Item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ export default Vue.extend({
*/
async openConversation() {
if (this.$device.isMobile) {
if (this.conversation.id === this.$route.params.id) {
this.$emit('slideNext')
return
}
this.$router.push({ params: { id: this.conversation.id } })
return
}
Expand Down
9 changes: 8 additions & 1 deletion pages/mobile/chat/_id.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<menu-icon class="font-color-flair" size="1.5x" />
</button>
</div>
<SidebarList class="mobile-list" />
<SidebarList class="mobile-list" @slideNext="swiper.slideNext()" />
</div>
<div class="swiper-slide">
<MobileToolbar @slidePrev="swiper.slidePrev()" />
Expand Down Expand Up @@ -91,6 +91,13 @@ export default Vue.extend({
},
},
watch: {
isActiveCall(val) {
if (val) {
this.swiper?.slideNext()
}
},
},
// component is remounted anytime the route param changes
mounted() {
this.swiper = new Swiper(
Expand Down

0 comments on commit 53f3519

Please sign in to comment.