mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-06 20:08:48 +02:00
Check app version, fix close stream bug, show audiobook progress, add toasts
This commit is contained in:
+13
-11
@@ -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)
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import Vue from "vue";
|
||||
import Toast from "vue-toastification";
|
||||
import "vue-toastification/dist/index.css";
|
||||
|
||||
const options = {
|
||||
hideProgressBar: true,
|
||||
position: 'bottom-center'
|
||||
};
|
||||
|
||||
Vue.use(Toast, options);
|
||||
Reference in New Issue
Block a user