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/flow 8078 savencia #29

Merged
merged 10 commits into from Nov 17, 2020
Merged

Feat/flow 8078 savencia #29

merged 10 commits into from Nov 17, 2020

Conversation

lmancel
Copy link

@lmancel lmancel commented Nov 6, 2020

No description provided.

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
Copy link

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 😊

Copy link
Author

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))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat syntax 👌

global.ipcRenderer = ipcRenderer
})

export {}

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 ?

Copy link
Author

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);

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 🤔

Copy link
Author

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return this.flowrStore?.get('enableVirtualKeyboard') ?? false
return !!this.flowrStore?.get('enableVirtualKeyboard')

import { VirtualKeyboardEvent } from './events'

// tslint:disable-next-line: function-name
export function KeyboardOpener<T extends new (...args: any[]) => {}>(yo: T) {

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)

Copy link
Author

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


// tslint:disable-next-line: function-name
export function KeyboardOpener<T extends new (...args: any[]) => {}>(yo: T) {
return class extends yo {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is yo ?

import { parse } from 'tldts'
import { buildPreloadPath } from '../../common/preload'

// function BrowserWindowExtend(electronClass: BrowserWindow) {

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 ?

Copy link
Author

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) => {

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 ?

Copy link
Author

@lmancel lmancel Nov 6, 2020

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 />

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)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will replace with CleanWebpackPlugin

@@ -0,0 +1,249 @@

Copy link
Author

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()
Copy link
Author

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

import { parse } from 'tldts'
import { buildPreloadPath } from '../../common/preload'

// function BrowserWindowExtend(electronClass: BrowserWindow) {
Copy link
Author

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
capsLock: boolean = false
capsLock = false

class: 'hg-highlight',
buttons: SimpleKeyboardKeys.CAPS_LOCK,
}]
case KeyboardState.DEFAULT:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
case KeyboardState.DEFAULT:

return KeyboardState.CAPS_LOCK
}
default:
switch (this.state) {

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 ?

Copy link
Author

@lmancel lmancel Nov 16, 2020

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let timeout: number | undefined = undefined
let timeout?: number

Copy link
Author

@lmancel lmancel Nov 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't use this syntax, it's not a class property
Screenshot 2020-11-16 at 10 47 16

@lmancel lmancel merged commit 56f41b4 into base Nov 17, 2020
@lmancel lmancel deleted the feat/FLOW-8078-savencia branch November 17, 2020 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants