Check app version, fix close stream bug, show audiobook progress, add toasts

This commit is contained in:
advplyr 2021-09-04 12:31:00 -05:00
parent 98076927ff
commit 619b6f3686
51 changed files with 551 additions and 141 deletions

View file

@ -1,17 +1,6 @@
import Vue from 'vue'
Vue.prototype.$isDev = process.env.NODE_ENV !== 'production'
import { Toast } from '@capacitor/toast'
Vue.prototype.$toast = (text) => {
if (!Toast) {
return console.error('No Toast Plugin')
}
Toast.show({
text: text
})
}
Vue.prototype.$bytesPretty = (bytes, decimals = 2) => {
if (bytes === 0) {
return '0 Bytes'
@ -23,6 +12,19 @@ Vue.prototype.$bytesPretty = (bytes, decimals = 2) => {
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]
}
Vue.prototype.$elapsedPretty = (seconds) => {
var minutes = Math.floor(seconds / 60)
if (minutes < 70) {
return `${minutes} min`
}
var hours = Math.floor(minutes / 60)
minutes -= hours * 60
if (!minutes) {
return `${hours} hr`
}
return `${hours} hr ${minutes} min`
}
Vue.prototype.$secondsToTimestamp = (seconds) => {
var _seconds = seconds
var _minutes = Math.floor(seconds / 60)