Merge pull request #459 from benonymity/hapticFeedback

Add haptic feedback
This commit is contained in:
advplyr
2022-12-09 17:08:17 -06:00
committed by GitHub
17 changed files with 113 additions and 65 deletions
+20 -10
View File
@@ -335,15 +335,18 @@ export default {
this.showFullscreen = false
}
},
touchstartTrack(e) {
async touchstartTrack(e) {
await this.$hapticsImpactMedium()
if (!e || !e.touches || !this.$refs.track || !this.showFullscreen || this.lockUi) return
this.touchTrackStart = true
},
selectChapter(chapter) {
async selectChapter(chapter) {
await this.$hapticsImpactMedium()
this.seek(chapter.start)
this.showChapterModal = false
},
castClick() {
async castClick() {
await this.$hapticsImpactMedium()
if (this.isLocalPlayMethod) {
this.$eventBus.$emit('cast-local-item')
return
@@ -362,12 +365,14 @@ export default {
this.showFullscreen = false
this.forceCloseDropdownMenu()
},
jumpNextChapter() {
async jumpNextChapter() {
await this.$hapticsImpactMedium()
if (this.isLoading) return
if (!this.nextChapter) return
this.seek(this.nextChapter.start)
},
jumpChapterStart() {
async jumpChapterStart() {
await this.$hapticsImpactMedium()
if (this.isLoading) return
if (!this.currentChapter) {
return this.restart()
@@ -387,7 +392,8 @@ export default {
showSleepTimerModal() {
this.$emit('showSleepTimer')
},
setPlaybackSpeed(speed) {
async setPlaybackSpeed(speed) {
await this.$hapticsImpactMedium()
console.log(`[AudioPlayer] Set Playback Rate: ${speed}`)
this.currentPlaybackRate = speed
AbsAudioPlayer.setPlaybackSpeed({ value: speed })
@@ -395,11 +401,13 @@ export default {
restart() {
this.seek(0)
},
jumpBackwards() {
async jumpBackwards() {
await this.$hapticsImpactMedium()
if (this.isLoading) return
AbsAudioPlayer.seekBackward({ value: this.jumpBackwardsTime })
},
jumpForward() {
async jumpForward() {
await this.$hapticsImpactMedium()
if (this.isLoading) return
AbsAudioPlayer.seekForward({ value: this.jumpForwardTime })
},
@@ -539,6 +547,7 @@ export default {
this.seek(time)
},
async playPauseClick() {
await this.$hapticsImpactMedium()
if (this.isLoading) return
this.isPlaying = !!((await AbsAudioPlayer.playPause()) || {}).playing
@@ -641,7 +650,8 @@ export default {
ts.innerText = currTimeStr
}
},
clickMenuAction(action) {
async clickMenuAction(action) {
await this.$hapticsImpactMedium()
this.showMoreMenuDialog = false
this.$nextTick(() => {
if (action === 'lock') {
@@ -969,4 +979,4 @@ export default {
.fullscreen #playerControls .play-btn .material-icons {
font-size: 2.1rem;
}
</style>
</style>
+1
View File
@@ -137,6 +137,7 @@ export default {
this.show = false
},
async logout() {
await this.$hapticsImpactMedium()
if (this.user) {
await this.$axios.$post('/logout').catch((error) => {
console.error(error)
+2 -1
View File
@@ -401,12 +401,13 @@ export default {
// Server books may have a local library item
this.localLibraryItem = localLibraryItem
},
clickCard(e) {
async clickCard(e) {
if (this.isSelectionMode) {
e.stopPropagation()
e.preventDefault()
this.selectBtnClick()
} else if (this.recentEpisode) {
await this.$hapticsImpactMedium()
var eventBus = this.$eventBus || this.$nuxt.$eventBus
if (this.streamIsPlaying) {
eventBus.$emit('pause-item')
+5 -2
View File
@@ -132,6 +132,7 @@ export default {
}
},
async connectToServer(config) {
await this.$hapticsImpactMedium()
console.log('[ServerConnectForm] connectToServer', config.address)
this.processing = true
this.serverConfig = {
@@ -159,6 +160,7 @@ export default {
},
async removeServerConfigClick() {
if (!this.serverConfig.id) return
await this.$hapticsImpactMedium()
const { value } = await Dialog.confirm({
title: 'Confirm',
@@ -189,7 +191,8 @@ export default {
this.showForm = true
this.showAuth = true
},
newServerConfigClick() {
async newServerConfigClick() {
await this.$hapticsImpactMedium()
this.serverConfig = {
address: '',
userId: '',
@@ -348,4 +351,4 @@ export default {
this.init()
}
}
</script>
</script>
+6 -2
View File
@@ -8,7 +8,7 @@
<p v-show="!selectedSeriesName" class="font-book pt-1">{{ totalEntities }} {{ entityTitle }}</p>
<p v-show="selectedSeriesName" class="ml-2 font-book pt-1">{{ selectedSeriesName }} ({{ totalEntities }})</p>
<div class="flex-grow" />
<span v-if="page == 'library' || seriesBookPage" class="material-icons px-2" @click="bookshelfListView = !bookshelfListView">{{ !bookshelfListView ? 'view_list' : 'grid_view' }}</span>
<span v-if="page == 'library' || seriesBookPage" class="material-icons px-2" @click="changeView">{{ !bookshelfListView ? 'view_list' : 'grid_view' }}</span>
<template v-if="page === 'library'">
<div class="relative flex items-center px-2">
<span class="material-icons" @click="showFilterModal = true">filter_alt</span>
@@ -102,6 +102,10 @@ export default {
},
setTotalEntities(total) {
this.totalEntities = total
},
async changeView() {
this.bookshelfListView = !this.bookshelfListView
await this.$hapticsImpactMedium()
}
},
mounted() {
@@ -120,4 +124,4 @@ export default {
#bookshelf-toolbar {
box-shadow: 0px 5px 5px #11111155;
}
</style>
</style>
+6 -2
View File
@@ -46,6 +46,7 @@
<script>
import { Dialog } from '@capacitor/dialog'
export default {
props: {
value: Boolean,
@@ -94,6 +95,7 @@ export default {
this.showBookmarkTitleInput = true
},
async deleteBookmark(bm) {
await this.$hapticsImpactMedium()
const { value } = await Dialog.confirm({
title: 'Remove Bookmark',
message: `Are you sure you want to remove bookmark?`
@@ -111,7 +113,8 @@ export default {
})
this.show = false
},
clickBookmark(bm) {
async clickBookmark(bm) {
await this.$hapticsImpactMedium()
this.$emit('select', bm)
},
submitUpdateBookmark(updatedBookmark) {
@@ -155,7 +158,8 @@ export default {
this.newBookmarkTitle = this.$formatDate(Date.now(), 'MMM dd, yyyy HH:mm')
this.showBookmarkTitleInput = true
},
submitBookmark() {
async submitBookmark() {
await this.$hapticsImpactMedium()
if (this.selectedBookmark) {
var updatePayload = {
...this.selectedBookmark,
+5 -3
View File
@@ -212,7 +212,8 @@ export default {
}
},
methods: {
clearSelected() {
async clearSelected() {
await this.$hapticsImpactMedium()
this.selected = 'all'
this.show = false
this.$nextTick(() => this.$emit('change', 'all'))
@@ -220,7 +221,7 @@ export default {
clickedSublistOption(item) {
this.clickedOption({ value: `${this.sublist}.${item}` })
},
clickedOption(option) {
async clickedOption(option) {
if (option.sublist) {
this.sublist = option.value
return
@@ -231,6 +232,7 @@ export default {
this.show = false
return
}
await this.$hapticsImpactMedium()
this.selected = val
this.show = false
this.$nextTick(() => this.$emit('change', val))
@@ -244,4 +246,4 @@ export default {
.filter-modal-wrapper {
max-height: calc(100% - 320px);
}
</style>
</style>
+1
View File
@@ -49,6 +49,7 @@ export default {
},
methods: {
async clickedOption(lib) {
await this.$hapticsImpactMedium()
this.show = false
if (lib.id === this.currentLibraryId) return
await this.$store.dispatch('libraries/fetch', lib.id)
+3 -2
View File
@@ -126,7 +126,8 @@ export default {
}
},
methods: {
clickedOption(val) {
async clickedOption(val) {
await this.$hapticsImpactMedium()
if (this.selected === val) {
this.selectedDesc = !this.selectedDesc
} else {
@@ -139,4 +140,4 @@ export default {
},
mounted() {}
}
</script>
</script>
+14 -7
View File
@@ -89,30 +89,37 @@ export default {
}
},
methods: {
clickedChapterOption() {
async clickedChapterOption() {
await this.$hapticsImpactMedium()
this.show = false
this.$nextTick(() => this.$emit('change', { time: this.currentEndOfChapterTime * 1000, isChapterTime: true }))
},
clickedOption(timeoutMin) {
async clickedOption(timeoutMin) {
await this.$hapticsImpactMedium()
var timeout = timeoutMin * 1000 * 60
this.show = false
this.manualTimerModal = false
this.$nextTick(() => this.$emit('change', { time: timeout, isChapterTime: false }))
},
cancelSleepTimer() {
async cancelSleepTimer() {
await this.$hapticsImpactMedium()
this.$emit('cancel')
this.show = false
},
increaseSleepTime() {
async increaseSleepTime() {
await this.$hapticsImpactMedium()
this.$emit('increase')
},
decreaseSleepTime() {
async decreaseSleepTime() {
await this.$hapticsImpactMedium()
this.$emit('decrease')
},
increaseManualTimeout() {
async increaseManualTimeout() {
await this.$hapticsImpactMedium()
this.manualTimeoutMin++
},
decreaseManualTimeout() {
async decreaseManualTimeout() {
await this.$hapticsImpactMedium()
if (this.manualTimeoutMin > 1) this.manualTimeoutMin--
}
},
@@ -114,7 +114,8 @@ export default {
this.loading = false
})
},
clickPlaylist(playlist) {
async clickPlaylist(playlist) {
await this.$hapticsImpactMedium()
if (playlist.isItemIncluded) {
this.removeFromPlaylist(playlist)
} else {
@@ -163,7 +164,8 @@ export default {
this.newPlaylistName = ''
this.showPlaylistNameInput = true
},
submitCreatePlaylist() {
async submitCreatePlaylist() {
await this.$hapticsImpactMedium()
if (!this.newPlaylistName || !this.selectedPlaylistItems.length) {
return
}
+6 -3
View File
@@ -148,8 +148,9 @@ export default {
}
return folderObj
},
downloadClick() {
async downloadClick() {
if (this.downloadItem) return
await this.$hapticsImpactMedium()
if (this.isIos) {
// no local folders on iOS
this.startDownload()
@@ -209,7 +210,8 @@ export default {
this.$toast.error(errorMsg)
}
},
playClick() {
async playClick() {
await this.$hapticsImpactMedium()
if (this.streamIsPlaying) {
this.$eventBus.$emit('pause-item')
} else {
@@ -231,6 +233,7 @@ export default {
}
},
async toggleFinished() {
await this.$hapticsImpactMedium()
this.isProcessingReadUpdate = true
if (this.isLocal || this.localEpisode) {
var isFinished = !this.userIsFinished
@@ -278,4 +281,4 @@ export default {
}
}
}
</script>
</script>