use new cores model

This commit is contained in:
SrGooglo 2023-06-09 14:24:41 +00:00
parent 1d2ab113a4
commit 163cf09eab
16 changed files with 42 additions and 42 deletions

View File

@ -39,6 +39,7 @@
"@emotion/css": "11.0.0",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@ionic/react": "^7.0.12",
"@loadable/component": "5.15.2",
"@mui/material": "^5.11.9",
"@paciolan/remote-component": "^2.13.0",
@ -53,7 +54,7 @@
"electron-is": "^3.0.0",
"electron-log": "^4.4.8",
"electron-squirrel-startup": "^1.0.0",
"evite": "0.15.3",
"evite": "^0.15.6",
"fast-average-color": "^9.2.0",
"faye": "1.4.0",
"feather-reactjs": "2.0.13",
@ -175,4 +176,4 @@
]
}
}
}
}

View File

@ -1,38 +0,0 @@
import SettingsCore from "./settings"
import TasksQueue from "./tasksQueue"
import APICore from "./api"
import StyleCore from "./style"
import PermissionsCore from "./permissions"
import ContextMenuCore from "./contextMenu"
import I18nCore from "./i18n"
import NotificationsCore from "./notifications"
import ShortcutsCore from "./shortcuts"
import SoundCore from "./sound"
import Player from "./player"
import RemoteStorage from "./remoteStorage"
import WidgetsCore from "./widgets"
import SyncCore from "./sync"
// DEFINE LOAD ORDER HERE
export default [
SettingsCore,
TasksQueue,
APICore,
PermissionsCore,
StyleCore,
I18nCore,
SoundCore,
NotificationsCore,
ShortcutsCore,
RemoteStorage,
Player,
ContextMenuCore,
WidgetsCore,
SyncCore,
]

View File

@ -54,9 +54,9 @@ export default class Player extends Core {
state = Observable.from({
loading: false,
minimized: false,
audioMuted: AudioPlayerStorage.get("mute") ?? false,
audioMuted: app.isMobile ? false : (AudioPlayerStorage.get("mute") ?? false),
playbackMode: AudioPlayerStorage.get("mode") ?? "repeat",
audioVolume: AudioPlayerStorage.get("volume") ?? 0.3,
audioVolume: app.isMobile ? 1 : (AudioPlayerStorage.get("volume") ?? 0.3),
velocity: AudioPlayerStorage.get("velocity") ?? 1,
coverColorAnalysis: null,
@ -340,6 +340,12 @@ export default class Player extends Core {
this.observeStateChanges()
}
async initializeBeforeRuntimeInitialize() {
if (app.isMobile) {
this.state.audioVolume = 1
}
}
//
// UI Methods
//
@ -350,6 +356,11 @@ export default class Player extends Core {
return false
}
if (!app.layout.floatingStack) {
console.error("Floating stack not found")
return false
}
this.currentDomWindow = app.layout.floatingStack.add("mediaPlayer", EmbbededMediaPlayer)
}
@ -359,6 +370,11 @@ export default class Player extends Core {
return false
}
if (!app.layout.floatingStack) {
console.error("Floating stack not found")
return false
}
app.layout.floatingStack.remove("mediaPlayer")
this.currentDomWindow = null
@ -892,6 +908,11 @@ export default class Player extends Core {
}
toogleMute(to) {
if (app.isMobile) {
console.warn("Cannot mute on mobile")
return false
}
this.state.audioMuted = to ?? !this.state.audioMuted
if (this.currentAudioInstance) {
@ -912,6 +933,11 @@ export default class Player extends Core {
return this.state.audioVolume
}
if (app.isMobile) {
console.warn("Cannot change volume on mobile")
return false
}
if (volume > 1) {
console.log(app.cores.settings.get("player.allowVolumeOver100"))

View File

@ -65,6 +65,7 @@ export class ThemeProvider extends React.Component {
export default class StyleCore extends Core {
static refName = "style"
static dependencies = ["settings"]
static namespace = "style"

View File

@ -234,6 +234,11 @@ class MusicSyncSubCore {
return false
}
if (!app.layout.floatingStack) {
console.error("Floating stack not found")
return false
}
this.syncRoomCardRendered = app.layout.floatingStack.add("sync-room-card", SyncRoomCard)
}
@ -242,6 +247,11 @@ class MusicSyncSubCore {
return false
}
if (!app.layout.floatingStack) {
console.error("Floating stack not found")
return false
}
app.layout.floatingStack.remove("sync-room-card")
this.syncRoomCardRendered = null