mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-07-23 20:25:44 +02:00
Update:Show loading indicator when first connecting to server
This commit is contained in:
parent
d899fd4d89
commit
08ee08c698
4 changed files with 29 additions and 14 deletions
|
@ -269,13 +269,12 @@ export default {
|
||||||
onReady() {
|
onReady() {
|
||||||
// The UI is reporting elsewhere we are ready
|
// The UI is reporting elsewhere we are ready
|
||||||
this.isReady = true
|
this.isReady = true
|
||||||
|
this.notifyOnReady()
|
||||||
// TODO: iOS opens last active playback session on app launch. Should be consistent with Android
|
|
||||||
if (this.isIos) {
|
|
||||||
this.notifyOnReady()
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
notifyOnReady() {
|
notifyOnReady() {
|
||||||
|
// TODO: iOS opens last active playback session on app launch. Should be consistent with Android
|
||||||
|
if (!this.isIos) return
|
||||||
|
|
||||||
// If settings aren't loaded yet, native player will receive incorrect settings
|
// If settings aren't loaded yet, native player will receive incorrect settings
|
||||||
console.log('Notify on ready... settingsLoaded:', this.settingsLoaded, 'isReady:', this.isReady)
|
console.log('Notify on ready... settingsLoaded:', this.settingsLoaded, 'isReady:', this.isReady)
|
||||||
if (this.settingsLoaded && this.isReady && this.$store.state.isFirstAudioLoad) {
|
if (this.settingsLoaded && this.isReady && this.$store.state.isFirstAudioLoad) {
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
<app-appbar />
|
<app-appbar />
|
||||||
<div id="content" class="overflow-hidden relative" :class="playerIsOpen ? 'playerOpen' : ''">
|
<div id="content" class="overflow-hidden relative" :class="playerIsOpen ? 'playerOpen' : ''">
|
||||||
<Nuxt />
|
<Nuxt />
|
||||||
|
|
||||||
|
<div v-if="attemptingConnection" class="absolute top-0 left-0 z-50 w-full h-full flex items-center justify-center">
|
||||||
|
<ui-loading-indicator text="Connecting to server..." />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<app-audio-player-container ref="streamContainer" />
|
<app-audio-player-container ref="streamContainer" />
|
||||||
<modals-libraries-modal />
|
<modals-libraries-modal />
|
||||||
|
|
|
@ -3,7 +3,10 @@
|
||||||
<home-bookshelf-nav-bar />
|
<home-bookshelf-nav-bar />
|
||||||
<home-bookshelf-toolbar v-show="!hideToolbar" />
|
<home-bookshelf-toolbar v-show="!hideToolbar" />
|
||||||
<div id="bookshelf-wrapper" class="main-content overflow-y-auto overflow-x-hidden relative" :class="hideToolbar ? 'no-toolbar' : ''">
|
<div id="bookshelf-wrapper" class="main-content overflow-y-auto overflow-x-hidden relative" :class="hideToolbar ? 'no-toolbar' : ''">
|
||||||
<nuxt-child />
|
<nuxt-child :loading.sync="loading" />
|
||||||
|
</div>
|
||||||
|
<div v-if="loading" class="absolute top-0 left-0 z-50 w-full h-full flex items-center justify-center">
|
||||||
|
<ui-loading-indicator text="Loading..." />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -11,7 +14,9 @@
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {}
|
return {
|
||||||
|
loading: false
|
||||||
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
hideToolbar() {
|
hideToolbar() {
|
||||||
|
|
|
@ -26,18 +26,17 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="loading" class="absolute top-0 left-0 w-full h-full flex items-center justify-center">
|
|
||||||
<ui-loading-indicator text="Loading Library..." />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
|
props: {
|
||||||
|
loading: Boolean
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
shelves: [],
|
shelves: [],
|
||||||
loading: false,
|
|
||||||
isFirstNetworkConnection: true,
|
isFirstNetworkConnection: true,
|
||||||
lastServerFetch: 0,
|
lastServerFetch: 0,
|
||||||
lastServerFetchLibraryId: null,
|
lastServerFetchLibraryId: null,
|
||||||
|
@ -97,6 +96,14 @@ export default {
|
||||||
},
|
},
|
||||||
localMediaProgress() {
|
localMediaProgress() {
|
||||||
return this.$store.state.globals.localMediaProgress
|
return this.$store.state.globals.localMediaProgress
|
||||||
|
},
|
||||||
|
isLoading: {
|
||||||
|
get() {
|
||||||
|
return this.loading
|
||||||
|
},
|
||||||
|
set(val) {
|
||||||
|
this.$emit('update:loading', val)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -213,7 +220,7 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loading = true
|
this.isLoading = true
|
||||||
this.shelves = []
|
this.shelves = []
|
||||||
|
|
||||||
if (this.user && this.currentLibraryId && this.networkConnected) {
|
if (this.user && this.currentLibraryId && this.networkConnected) {
|
||||||
|
@ -229,7 +236,7 @@ export default {
|
||||||
this.shelves = localCategories
|
this.shelves = localCategories
|
||||||
this.lastServerFetch = 0
|
this.lastServerFetch = 0
|
||||||
this.lastLocalFetch = Date.now()
|
this.lastLocalFetch = Date.now()
|
||||||
this.loading = false
|
this.isLoading = false
|
||||||
console.log('[categories] Local shelves set from failure', this.shelves.length, this.lastLocalFetch)
|
console.log('[categories] Local shelves set from failure', this.shelves.length, this.lastLocalFetch)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -267,7 +274,7 @@ export default {
|
||||||
console.log('[categories] Local shelves set', this.shelves.length, this.lastLocalFetch)
|
console.log('[categories] Local shelves set', this.shelves.length, this.lastLocalFetch)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loading = false
|
this.isLoading = false
|
||||||
},
|
},
|
||||||
openMediaPlayerWithMostRecentListening() {
|
openMediaPlayerWithMostRecentListening() {
|
||||||
// If we don't already have a player open
|
// If we don't already have a player open
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue