Skip to content
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

feat: Simulate a call to hidesplashscreen on the web #2072

Merged
merged 1 commit into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config/webpack.config.cozy-home.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ module.exports = {
/WebVaultClient/, // EEFLongWordList
/cozy-ui\/transpiled\/react\/Portal\/index\.js/ // preact-portal
]
}),

new webpack.DefinePlugin({
__SIMULATE_FLAGSHIP__: true
})
].filter(Boolean)
}
4 changes: 4 additions & 0 deletions docs/develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ $ yarn start
```

[setup]: https://docs.cozy.io/en/tutorials/app/#install-the-development-environment "Cozy dev docs: Set up the Development Environment"

### Flagship mode

If you want to simulate flagship environment, you can edit the `__SIMULATE_FLAGSHIP__` var in the `webpack.config.cozy-home.js`. It'll simulate a splashscreen during the loading of the application and simulate a call to `hideSplashscreen`.
4 changes: 4 additions & 0 deletions src/containers/App.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global __SIMULATE_FLAGSHIP__ */
import React, { useEffect, useState } from 'react'
import { Navigate, Route, Routes } from 'react-router-dom'

Expand Down Expand Up @@ -119,6 +120,9 @@ const App = ({ accounts, konnectors, triggers }) => {
webviewIntent.call('setTheme', theme)
webviewIntent.call('hideSplashScreen')
}
if (isReady && !webviewIntent && __SIMULATE_FLAGSHIP__) {
document.getElementById('splashscreen').style.display = 'none'
}
}, [isReady, theme, webviewIntent])

return (
Expand Down
5 changes: 4 additions & 1 deletion src/targets/browser/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
{{.ThemeCSS}}
</head>

<body>
<body style="display: block;margin: 0">
<% if (__SIMULATE_FLAGSHIP__) { %>
<div style="position:absolute; z-index: 1000; height: 100%; width: 100%; background-color: blue; opacity: 0.5;" id="splashscreen">splashscreen</div>
<% }; %>
<div role="application" data-cozy="{{.CozyData}}" data-cozy-token="{{.Token}}" data-cozy-domain="{{.Domain}}"
data-cozy-locale="{{.Locale}}" data-cozy-app-editor="{{.AppEditor}}" data-cozy-app-name="{{.AppName}}"
data-cozy-app-name-prefix="{{.AppNamePrefix}}" data-cozy-app-slug="{{.AppSlug}}" data-cozy-tracking="{{.Tracking}}"
Expand Down
Loading