Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: absidue <[email protected]>
  • Loading branch information
kommunarr and absidue authored Jan 2, 2025
1 parent ebbf672 commit cafd511
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
7 changes: 5 additions & 2 deletions src/datastores/handlers/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ class Settings {
// Theater Mode preference through this change.
const defaultTheatreMode = await db.settings.findOneAsync({ _id: 'defaultTheatreMode' })

if (defaultTheatreMode?.value) {
await this.upsert('defaultViewingMode', 'theatre')
if (defaultTheatreMode) {
if (defaultTheatreMode.value) {
await this.upsert('defaultViewingMode', 'theatre')
}

await db.settings.removeAsync({ _id: 'defaultTheatreMode' })
}

Expand Down
20 changes: 10 additions & 10 deletions src/renderer/components/ft-list-video/ft-list-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ export default defineComponent({
},

externalPlayerIsDefaultViewingMode: function () {
return this.externalPlayer !== '' && this.$store.getters.getDefaultViewingMode === 'external_player'
return process.env.IS_ELECTRON && this.externalPlayer !== '' && this.$store.getters.getDefaultViewingMode === 'external_player'
},

defaultPlayback: function () {
Expand Down Expand Up @@ -486,16 +486,16 @@ export default defineComponent({
return this.isInQuickBookmarkPlaylist ? 'base favorite' : 'base'
},

watchVideoRoute() {
return {
path: `/watch/${this.id}`,
query: this.watchPageLinkQuery,
}
},

// For `router-link` attribute `to`
watchVideoRouterLink() {
return !this.externalPlayerIsDefaultViewingMode ? this.watchVideoRoute : {}
// For `router-link` attribute `to`
if (!this.externalPlayerIsDefaultViewingMode) {
return {
path: `/watch/${this.id}`,
query: this.watchPageLinkQuery,
}
} else {
return {}
}
},

watchPageLinkQuery() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2809,7 +2809,7 @@ export default defineComponent({
* it won't be finished in time, as the player destruction is asynchronous.
* To workaround that we destroy the player first and wait for it to finish before we unmount this component.
*
* @returns { startNextVideoInFullscreen: boolean, startNextVideoInFullwindow: boolean, startNextVideoInPip: boolean }
* @returns {Promise<{ startNextVideoInFullscreen: boolean, startNextVideoInFullwindow: boolean, startNextVideoInPip: boolean }>}
*/
async function destroyPlayer() {
ignoreErrors = true
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/player-settings/player-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export default defineComponent({

defaultViewingMode: function () {
const defaultViewingMode = this.$store.getters.getDefaultViewingMode
if ((defaultViewingMode === 'external_player' && this.externalPlayer === '') ||
if ((defaultViewingMode === 'external_player' && (!process.env.IS_ELECTRON || this.externalPlayer === '')) ||
(!process.env.IS_ELECTRON && (defaultViewingMode === 'fullscreen' || defaultViewingMode === 'pip'))) {
return 'default'
}
Expand Down

0 comments on commit cafd511

Please sign in to comment.