Skip to content

Commit

Permalink
fix: Additional window cannot be opened in production
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed May 6, 2023
1 parent 094e32a commit 5dbf1da
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 10 additions & 0 deletions xmcl-electron-app/main/Controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ export default class Controller implements LauncherAppController {
trafficLightPosition: this.app.platform.name === 'osx' ? { x: 14, y: 10 } : undefined,
minWidth: 600,
minHeight: 600,
width: 1024,
height: 768,

webPreferences: {
contextIsolation: true,
Expand All @@ -79,6 +81,14 @@ export default class Controller implements LauncherAppController {
window.webContents.setWindowOpenHandler(this.windowOpenHandler)
window.webContents.on('will-navigate', this.onWebContentWillNavigate)
window.webContents.on('did-create-window', this.onWebContentCreateWindow)
this.logger.log(`Try to open window ${details.url}`)
window.once('ready-to-show', () => {
window.loadURL(details.url).then(() => {
this.logger.log(`Opened window ${details.url}`)
}, (e) => {
this.logger.log(`Fail to open window ${details.url}`, e)
})
})
}

private onWebContentWillNavigate = (event: Event, url: string) => {
Expand Down
5 changes: 2 additions & 3 deletions xmcl-keystone-ui/src/views/Modpack.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
import FilterCombobox from '@/components/FilterCombobox.vue'
import { useFilterCombobox, useService } from '@/composables'
import { kModpacks } from '@/composables/modpack'
import { kMarketRoute } from '@/composables/useMarketRoute'
import { isStringArrayEquals } from '@/util/equal'
import { injection } from '@/util/inject'
import { CachedFTBModpackVersionManifest, ModpackServiceKey, Resource, ResourceServiceKey } from '@xmcl/runtime-api'
Expand All @@ -125,10 +126,8 @@ import { AddInstanceDialogKey } from '../composables/instanceAdd'
import { ModpackItem } from '../composables/modpack'
import ModpackCard from './ModpackCard.vue'
import DeleteButton from './ModpackDeleteButton.vue'
import { useMarketRoute } from '@/composables/useMarketRoute'
const { t } = useI18n()
const { push } = useRouter()
const dragging = ref(undefined as undefined | ModpackItem)
const { removeResources, updateResources } = useService(ResourceServiceKey)
const { showModpacksFolder } = useService(ModpackServiceKey)
Expand Down Expand Up @@ -176,7 +175,7 @@ function onDrop() {
startDelete(dragging.value)
}
}
const { goToCurseforge, goToModrinth } = useMarketRoute()
const { goToCurseforge, goToModrinth } = injection(kMarketRoute)
function getModpackItem (resource: Resource): ModpackItem {
const metadata = resource.metadata
Expand Down

0 comments on commit 5dbf1da

Please sign in to comment.