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/flow 8078 savencia #29
Conversation
proper toggle and key forwarding to wexond and flowr TODO: handle input field focus/blur
TODO: handle the switch between wexond (tab input) and Views We need to be able to have a single timeout for all components
Automatic build reaches timeout after 10 minutes when generating the dmg
pls add usage examples for this command...
@@ -119,16 +94,16 @@ export class ApplicationManager { | |||
|
|||
initLocalApps(clearStore: boolean = false): Promise<void[]> { | |||
return new Promise((resolve, reject) => { | |||
fs.readdir(join(app.getAppPath(), 'build', 'applications'), (err, files) => { | |||
// TODO: open ticket @ electron "withFileTypes" option is not working inside of the asar archive, it only returns the file names |
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.
What about we create a ticket with that task 😊
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.
Actually already done by other peoples: electron/electron#25349
Also cf electron/electron#24062
keyPress: this.onKeyPress.bind(this), | ||
keyUp: this.onKeyUp.bind(this), | ||
} | ||
Object.entries(ipcEvents).forEach(event => ipcMain.on(...event)) |
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.
Neat syntax 👌
src/applications/keyboard/preload.ts
Outdated
global.ipcRenderer = ipcRenderer | ||
}) | ||
|
||
export {} |
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.
Why ? What does it do ?
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.
Hmmmmm right... I think it was to be able to use a declare
statement above so it's considered as a module, but since there already is an import statement I might be able to remove it
@@ -0,0 +1,3 @@ | |||
.hg-button.hg-highlight { | |||
box-shadow: 0 0 40px 5px rgba(64, 150, 255, 0.696); |
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.
That's an oddly specific value for opacity 🤔
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.
Just used the color selector from VSCode, it's more or less random 😄
keyboardWindow?: KeyboardWindow | ||
|
||
get isEnabled(): boolean { | ||
return this.flowrStore?.get('enableVirtualKeyboard') ?? false |
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.
return this.flowrStore?.get('enableVirtualKeyboard') ?? false | |
return !!this.flowrStore?.get('enableVirtualKeyboard') |
src/barcoKeyboard/keyboardOpener.ts
Outdated
import { VirtualKeyboardEvent } from './events' | ||
|
||
// tslint:disable-next-line: function-name | ||
export function KeyboardOpener<T extends new (...args: any[]) => {}>(yo: T) { |
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.
Is it missing a =
to make an arrow function =>
or is it some syntax i've never seen ?
{}>(yo: T)
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.
I'll delete this file, it was an attempt that was unneeded in the end
src/barcoKeyboard/keyboardOpener.ts
Outdated
|
||
// tslint:disable-next-line: function-name | ||
export function KeyboardOpener<T extends new (...args: any[]) => {}>(yo: T) { | ||
return class extends yo { |
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.
What is yo
?
src/wexond/main/view.ts
Outdated
import { parse } from 'tldts' | ||
import { buildPreloadPath } from '../../common/preload' | ||
|
||
// function BrowserWindowExtend(electronClass: BrowserWindow) { |
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.
Is this big chunk of commented code needed ?
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.
No it's not, I did not push the message I wrote earlier but it's going to be removed.
It's related to the fact that extending electron's base classes is not supported, so I wanted to create a simple class that would implement the exact same interface and just act as a bridge. Might be needed in the future but overkill for now.
|
||
const GlobalStyle = createGlobalStyle`${Style}`; | ||
|
||
window.onbeforeunload = () => { | ||
ipcRenderer.send('browserview-clear'); | ||
}; | ||
|
||
export const App = observer(() => { | ||
export default observer((data: App) => { |
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.
Why this change ? Just to not have the same name as App
in models/app
?
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.
Actually I just used the same logic than what was done in other Wexond components without even trying to think of something better...
<NavigationButtons /> | ||
{buttons} | ||
</StyledToolbar> | ||
) | ||
} | ||
|
||
return ( | ||
<StyledToolbar isHTMLFullscreen={store.isHTMLFullscreen}> | ||
<NavigationButtons /> | ||
<Tabbar /> | ||
<Find /> |
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.
The only difference between the two renders are <Tabbar />
and <Find />
It would have been much easier and less awkward to condtionnaly render them instead of having two returns and all the buttons stored in a variable
{!data.disableTabs && (<>
<Tabbar />
<Find />
</>)}
webpack.main.js
Outdated
const { getOptimization, webpackModule, resolve, Mode, output, deleteDir, OUTPUT_DIR } = require('./webpack/utils') | ||
|
||
module.exports = async (env) => { | ||
await deleteDir(OUTPUT_DIR) |
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.
Will replace with CleanWebpackPlugin
webpack.config.js
Outdated
@@ -0,0 +1,249 @@ | |||
|
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.
Will delete this file
new URL(url) | ||
ipc.send('setExtUrl', url) | ||
} catch (e) { | ||
invalidUrl() |
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.
Will add console.error
for debugging
src/wexond/main/view.ts
Outdated
import { parse } from 'tldts' | ||
import { buildPreloadPath } from '../../common/preload' | ||
|
||
// function BrowserWindowExtend(electronClass: BrowserWindow) { |
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 was wip, I will remove it
} | ||
|
||
export class KeyboardWindow extends BrowserWindow { | ||
capsLock: boolean = false |
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.
capsLock: boolean = false | |
capsLock = false |
class: 'hg-highlight', | ||
buttons: SimpleKeyboardKeys.CAPS_LOCK, | ||
}] | ||
case KeyboardState.DEFAULT: |
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.
case KeyboardState.DEFAULT: |
return KeyboardState.CAPS_LOCK | ||
} | ||
default: | ||
switch (this.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.
We don't have a default case for this switch ?
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.
The default case is supposed to do nothing. It could be replaced with an if
statement, I just kept the same syntax as for the rest of the function
import { ACTIVITY_EVENT, INACTIVITY_THROTTLE } from './utils' | ||
|
||
export async function watchForInactivity(baseWindow: BrowserWindow | BrowserView, timeoutDuration: number, callback: (baseWindow: BrowserWindow | BrowserView) => any) { | ||
let timeout: number | undefined = undefined |
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.
let timeout: number | undefined = undefined | |
let timeout?: number |
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.
No description provided.