forked from stream-labs/desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor app platform to use BrowserView instead of webview tags (str…
…eam-labs#1353) * feat:use forked electron release * add instruction on how to update electron fork version * udpate yarn.lock * tmp commit * making progress with working partition and guest API, lots of hacks * working resizing of browserviews * working for non-persistent pages * intermediate cleanup * more cleanup * fix chat, more cleanup/refactoring * working display, still some bugs to find * fix some bugs * prevent app navigation * dev tools for beta apps * refactoring to load/unload/refresh and enable production apps * minor fixes for production apps * remove outdated comment * TODO Comments * only start up containers for enabled apps * fix app reload issues * remove console.log * code review
- Loading branch information
Showing
34 changed files
with
765 additions
and
575 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<template> | ||
<div | ||
class="platform-app-container" | ||
ref="appContainer" /> | ||
</template> | ||
|
||
<script lang="ts" src="./PlatformAppPageView.vue.ts"></script> | ||
<style lang="less" scoped> | ||
@import "../styles/index"; | ||
.platform-app-container { | ||
display: flex; | ||
flex-direction: column; | ||
width: 100%; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import Vue from 'vue'; | ||
import { Component, Prop } from 'vue-property-decorator'; | ||
import { PlatformAppsService, EAppPageSlot } from 'services/platform-apps'; | ||
import { Inject } from 'util/injector'; | ||
import electron from 'electron'; | ||
import Utils from 'services/utils'; | ||
import { Subscription } from 'rxjs'; | ||
|
||
@Component({}) | ||
export default class PlatformAppPageView extends Vue { | ||
@Inject() platformAppsService: PlatformAppsService; | ||
@Prop() appId: string; | ||
@Prop() pageSlot: EAppPageSlot; | ||
|
||
$refs: { | ||
appContainer: HTMLDivElement; | ||
}; | ||
|
||
resizeInterval: number; | ||
containerId: number; | ||
loadSub: Subscription; | ||
currentPosition: IVec2; | ||
currentSize: IVec2; | ||
|
||
mounted() { | ||
this.mountContainer(); | ||
|
||
this.resizeInterval = window.setInterval(() => { | ||
this.checkResize(); | ||
}, 100); | ||
|
||
this.loadSub = this.platformAppsService.appLoad.subscribe(app => { | ||
if (this.appId === app.id) { | ||
this.unmountContainer(); | ||
this.mountContainer(); | ||
} | ||
}); | ||
} | ||
|
||
mountContainer() { | ||
this.containerId = this.platformAppsService.mountContainer( | ||
this.appId, | ||
this.pageSlot, | ||
electron.remote.getCurrentWindow().id, | ||
Utils.getWindowId(), | ||
); | ||
this.checkResize(); | ||
} | ||
|
||
unmountContainer() { | ||
this.currentPosition = null; | ||
this.currentSize = null; | ||
this.platformAppsService.unmountContainer( | ||
this.containerId, | ||
electron.remote.getCurrentWindow().id, | ||
); | ||
} | ||
|
||
destroyed() { | ||
if (this.resizeInterval) clearInterval(this.resizeInterval); | ||
this.loadSub.unsubscribe(); | ||
this.unmountContainer(); | ||
} | ||
|
||
checkResize() { | ||
const rect = this.$refs.appContainer.getBoundingClientRect(); | ||
|
||
if (this.currentPosition == null || this.currentSize == null || this.rectChanged(rect)) { | ||
this.currentPosition = { x: rect.left, y: rect.top }; | ||
this.currentSize = { x: rect.width, y: rect.height }; | ||
|
||
this.platformAppsService.setContainerBounds( | ||
this.containerId, | ||
this.currentPosition, | ||
this.currentSize, | ||
); | ||
} | ||
} | ||
|
||
private rectChanged(rect: ClientRect) { | ||
return ( | ||
rect.left !== this.currentPosition.x || | ||
rect.top !== this.currentPosition.y || | ||
rect.width !== this.currentSize.x || | ||
rect.height !== this.currentSize.y | ||
); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.