feat: add haptic feedback to all action buttons

This commit is contained in:
benonymity
2022-12-08 00:28:28 -05:00
parent 96dde8cf31
commit 1aa6a441f3
16 changed files with 113 additions and 42 deletions
+9 -3
View File
@@ -142,6 +142,8 @@
<script>
import { Dialog } from '@capacitor/dialog'
import { AbsFileSystem, AbsDownloader } from '@/plugins/capacitor'
import { Haptics, ImpactStyle } from '@capacitor/haptics';
export default {
async asyncData({ store, params, redirect, app }) {
@@ -406,8 +408,9 @@ export default {
readBook() {
this.$store.commit('openReader', this.libraryItem)
},
playClick() {
async playClick() {
var episodeId = null
await Haptics.impact({ style: ImpactStyle.Medium });
if (this.isPodcast) {
this.episodes.sort((a, b) => {
@@ -461,6 +464,7 @@ export default {
this.$eventBus.$emit('play-item', { libraryItemId: this.libraryItemId, episodeId })
},
async clearProgressClick() {
await Haptics.impact({ style: ImpactStyle.Medium });
const { value } = await Dialog.confirm({
title: 'Confirm',
message: 'Are you sure you want to reset your progress?'
@@ -506,13 +510,14 @@ export default {
this.showSelectLocalFolder = false
this.download(localFolder)
},
downloadClick() {
async downloadClick() {
if (this.downloadItem) {
return
}
if (!this.numTracks) {
return
}
await Haptics.impact({ style: ImpactStyle.Medium });
if (this.isIos) {
// no local folders on iOS
this.startDownload()
@@ -580,6 +585,7 @@ export default {
}
},
async toggleFinished() {
await Haptics.impact({ style: ImpactStyle.Medium });
this.isProcessingReadUpdate = true
if (this.isLocal) {
var isFinished = !this.userIsFinished
@@ -647,4 +653,4 @@ export default {
width: calc(100% - 64px);
max-width: calc(100% - 64px);
}
</style>
</style>