-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webengine projection #291
webengine projection #291
Changes from 5 commits
fdacd9e
247bcb0
bd917c0
35be399
8d26c24
ab9eaef
89d551f
a9d1f48
a1ab7d8
51ed7e7
be87645
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,11 +55,25 @@ class AppStore extends React.Component { | |
return; | ||
} | ||
|
||
var style = {}; | ||
if (manifest.category === 'WEB_VIEW') { | ||
style = { | ||
position: 'absolute', | ||
width: '960px', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The size of the web view needs to take into account the dynamic height and width parameters set in the config and used by the scss files. It might be cleaner to define these styles in an scss file and pass a className within the js code instead. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, I applied these changes here: ab9eaef |
||
height: '600px', | ||
top: '75px', | ||
left: '0px' | ||
} | ||
} else { | ||
style.display = 'none'; | ||
} | ||
|
||
store.dispatch(addAppPendingSetAppProperties(Object.assign(appDirEntry, { | ||
policyAppID: manifest.appId, | ||
version: manifest.appVersion, | ||
entrypoint: manifest.entrypoint, | ||
appUrl: params.appUrl | ||
appUrl: params.appUrl, | ||
style: style | ||
}), true)); | ||
|
||
let addIfExists = (key) => { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,9 @@ import { | |
closeAlert, | ||
setGlobalProperties, | ||
deactivateInteraction, | ||
showAppMenu | ||
showAppMenu, | ||
appStoreShowWebView, | ||
appStoreHideWebView | ||
} from '../actions' | ||
import store from '../store' | ||
import sdlController from './SDLController' | ||
|
@@ -295,6 +297,11 @@ class UIController { | |
this.listener.send(RpcFactory.UIPerformInteractionResponse(choiceID, appID, msgID)) | ||
} | ||
onSystemContext(context, appID) { | ||
if (context === 'MAIN' || context === 'ALERT') { | ||
store.dispatch(appStoreShowWebView()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should you check that the current route is the appstore/webview before dispatching these actions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right, there's an issue here if an app registers as WEB_VIEW and changes templates. That app's iframe would still be shown. I will look into this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In a9d1f48 I added a variable to the state to check whether we were in |
||
} else { | ||
store.dispatch(appStoreHideWebView()); | ||
} | ||
this.listener.send(RpcFactory.OnSystemContextNotification(context, appID)) | ||
} | ||
onCommand(cmdID, appID) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import AppHeader from '../../containers/Header'; | ||
|
||
class WebView extends React.Component { | ||
render() { | ||
return ( | ||
<div className="webView"> | ||
<AppHeader backLink="/" menuName="Apps" icon="false"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume WebengineAppContainer was not included in this component because the iframe needs to be running when not in view? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly, the iframe has to be outside the route context so it can run when we are in a menu etc. |
||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default WebView; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -434,6 +434,9 @@ function ui(state = {}, action) { | |
case "NON-MEDIA": | ||
app.displayLayout = "nonmedia" | ||
break | ||
case "WEB_VIEW": | ||
app.displayLayout = "webview" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think web-view would be more inline with the naming conventions, except nonmedia is kind of ruining my claim. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated in 89d551f If we changed nonmedia we could fix this special case and just use .toLower() for the registerApp call. |
||
break | ||
case "LARGE_GRAPHIC_ONLY": | ||
app.displayLayout = "large-graphic-only" | ||
break | ||
|
@@ -472,10 +475,8 @@ function ui(state = {}, action) { | |
app.nightColorScheme = action.nightColorScheme | ||
} | ||
return newState | ||
case Actions.REGISTER_APPLICATION: | ||
if (!app.displayLayout) { | ||
app.displayLayout = action.isMediaApplication ? "media" : "nonmedia" | ||
} | ||
case Actions.REGISTER_APPLICATION: | ||
app.displayLayout = action.displayLayout; | ||
return newState | ||
case Actions.UNREGISTER_APPLICATION: | ||
if (newState[action.appID]) { | ||
|
@@ -553,6 +554,7 @@ function system(state = {}, action) { | |
|
||
function appStore(state = { | ||
isConnected: false, | ||
showWebView: false, | ||
availableApps: [], | ||
installedApps: [], | ||
appsPendingSetAppProperties: [] | ||
|
@@ -579,14 +581,12 @@ function appStore(state = { | |
); | ||
return newState; | ||
} | ||
// Update the existing app's properties | ||
existingApp = Object.assign(existingApp, action.installedApp); | ||
return newState; | ||
case Actions.ADD_APP_PENDING_SET_APP_PROPERTIES: | ||
newState.appsPendingSetAppProperties.push({ app: action.app, enable: action.enable}); | ||
return newState; | ||
case Actions.APPSTORE_APP_INSTALLED: | ||
// @shobhit, should we add a length check here like we did in SetAppProperties RPC? | ||
var pendingAppInstall = newState.appsPendingSetAppProperties.shift()['app']; | ||
if (!action.success) { return newState; } | ||
var newInstalled = [ pendingAppInstall ].concat(newState.installedApps); | ||
|
@@ -595,7 +595,6 @@ function appStore(state = { | |
if (appStoreAppInstalled) { appStoreAppInstalled.pendingInstall = false; } | ||
return newState; | ||
case Actions.APPSTORE_APP_UNINSTALLED: | ||
// @shobhit, should we add a length check here like we did in SetAppProperties RPC? | ||
let pendingAppUninstall = newState.appsPendingSetAppProperties.shift()['app']; | ||
if (!action.success) { return newState; } | ||
newState.installedApps = state.installedApps.filter(app => app.policyAppID !== pendingAppUninstall.policyAppID); | ||
|
@@ -612,6 +611,12 @@ function appStore(state = { | |
let appStoreAppToInstall = newState.availableApps.find(app => app.policyAppID === action.policyAppID); | ||
if (appStoreAppToInstall) { appStoreAppToInstall.pendingInstall = true; } | ||
return newState; | ||
case Actions.SHOW_WEB_VIEW: | ||
newState.showWebView = true; | ||
return newState; | ||
case Actions.HIDE_WEB_VIEW: | ||
newState.showWebView = false; | ||
return newState; | ||
default: | ||
return state; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the app is taking up too much memory, should the HMI also "delete" the iframe? Does that happen indirectly after the OnExitApplication message is sent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will indirectly remove the iframe after OnAppUnregistered is received by the HMI.