mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Consolidate naming for less ambiguity
Co-authored-by: Janne Savolainen <janne.savolainen@live.fi> Signed-off-by: Iku-turso <mikko.aspiala@gmail.com> # Conflicts: # src/behaviours/quitting-and-restarting-the-app/opening-application-window-using-tray.test.ts # src/main/start-main-application/lens-window/application-window/create-lens-window.injectable.ts
This commit is contained in:
parent
d2cff17e9b
commit
9ffe7aebec
@ -243,6 +243,6 @@ const expectWindowsToBeOpenFor = (di: DiContainer) => (windowIds: string[]) => {
|
||||
const windows = di.injectMany(lensWindowInjectionToken);
|
||||
|
||||
expect(
|
||||
windows.filter((window) => window.visible).map((window) => window.id),
|
||||
windows.filter((window) => window.isVisible).map((window) => window.id),
|
||||
).toEqual(windowIds);
|
||||
};
|
||||
|
||||
@ -41,7 +41,7 @@ describe("quitting the app using application menu", () => {
|
||||
);
|
||||
|
||||
expect(
|
||||
windows.map((window) => ({ id: window.id, visible: window.visible })),
|
||||
windows.map((window) => ({ id: window.id, visible: window.isVisible })),
|
||||
).toEqual([
|
||||
{ id: "only-application-window", visible: true },
|
||||
{ id: "splash", visible: false },
|
||||
@ -59,7 +59,7 @@ describe("quitting the app using application menu", () => {
|
||||
);
|
||||
|
||||
expect(
|
||||
windows.map((window) => ({ id: window.id, visible: window.visible })),
|
||||
windows.map((window) => ({ id: window.id, visible: window.isVisible })),
|
||||
).toEqual([
|
||||
{ id: "only-application-window", visible: false },
|
||||
{ id: "splash", visible: false },
|
||||
|
||||
@ -20,7 +20,7 @@ const hideDockForLastClosedWindowInjectable = getInjectable({
|
||||
run: () => {
|
||||
const visibleWindows = pipeline(
|
||||
getLensWindows(),
|
||||
filter(window => !!window.visible),
|
||||
filter(window => !!window.isVisible),
|
||||
);
|
||||
|
||||
if (isEmpty(visibleWindows)) {
|
||||
|
||||
@ -42,7 +42,7 @@ const createLensWindowInjectable = getInjectable({
|
||||
let browserWindow: ElectronWindow | undefined;
|
||||
|
||||
let windowIsShown = false;
|
||||
let windowIsOpening = false;
|
||||
let windowIsStarting = false;
|
||||
|
||||
const showWindow = () => {
|
||||
assert(browserWindow);
|
||||
@ -54,17 +54,17 @@ const createLensWindowInjectable = getInjectable({
|
||||
return {
|
||||
id: configuration.id,
|
||||
|
||||
get visible() {
|
||||
get isVisible() {
|
||||
return windowIsShown;
|
||||
},
|
||||
|
||||
get opening() {
|
||||
return windowIsOpening;
|
||||
get isStarting() {
|
||||
return windowIsStarting;
|
||||
},
|
||||
|
||||
open: async () => {
|
||||
start: async () => {
|
||||
if (!browserWindow) {
|
||||
windowIsOpening = true;
|
||||
windowIsStarting = true;
|
||||
|
||||
browserWindow = createElectronWindow({
|
||||
...configuration,
|
||||
@ -88,7 +88,7 @@ const createLensWindowInjectable = getInjectable({
|
||||
|
||||
showWindow();
|
||||
|
||||
windowIsOpening = false;
|
||||
windowIsStarting = false;
|
||||
},
|
||||
|
||||
show: showWindow,
|
||||
|
||||
@ -13,12 +13,12 @@ export interface SendToViewArgs {
|
||||
|
||||
export interface LensWindow {
|
||||
id: string;
|
||||
open: () => Promise<void>;
|
||||
start: () => Promise<void>;
|
||||
close: () => void;
|
||||
show: () => void;
|
||||
send: (args: SendToViewArgs) => void;
|
||||
visible: boolean;
|
||||
opening: boolean;
|
||||
isVisible: boolean;
|
||||
isStarting: boolean;
|
||||
}
|
||||
|
||||
export const lensWindowInjectionToken = getInjectionToken<LensWindow>({
|
||||
|
||||
@ -16,7 +16,7 @@ const showApplicationWindowInjectable = getInjectable({
|
||||
const splashWindow = di.inject(splashWindowInjectable);
|
||||
|
||||
return async () => {
|
||||
if (applicationWindow.opening) {
|
||||
if (applicationWindow.isStarting) {
|
||||
applicationWindow.show();
|
||||
splashWindow.close();
|
||||
|
||||
@ -24,17 +24,17 @@ const showApplicationWindowInjectable = getInjectable({
|
||||
}
|
||||
|
||||
const windowIsAlreadyBeingShown = someIsTruthy([
|
||||
applicationWindow.visible,
|
||||
splashWindow.opening,
|
||||
applicationWindow.isVisible,
|
||||
splashWindow.isStarting,
|
||||
]);
|
||||
|
||||
if (windowIsAlreadyBeingShown) {
|
||||
return;
|
||||
}
|
||||
|
||||
await splashWindow.open();
|
||||
await splashWindow.start();
|
||||
|
||||
await applicationWindow.open();
|
||||
await applicationWindow.start();
|
||||
|
||||
splashWindow.close();
|
||||
};
|
||||
|
||||
@ -49,7 +49,7 @@ const startMainApplicationInjectable = getInjectable({
|
||||
await beforeApplicationIsLoading();
|
||||
|
||||
if (!shouldStartHidden) {
|
||||
await splashWindow.open();
|
||||
await splashWindow.start();
|
||||
}
|
||||
|
||||
await onLoadOfApplication();
|
||||
@ -60,7 +60,7 @@ const startMainApplicationInjectable = getInjectable({
|
||||
if (deepLinkUrl) {
|
||||
await openDeepLink(deepLinkUrl);
|
||||
} else {
|
||||
await applicationWindow.open();
|
||||
await applicationWindow.start();
|
||||
}
|
||||
|
||||
splashWindow.close();
|
||||
|
||||
@ -21,10 +21,9 @@ const messageToChannelInjectable = getInjectable({
|
||||
return (channel: MessageChannel<any>, message?: unknown) => {
|
||||
const stringifiedMessage = tentativeStringifyJson(message);
|
||||
|
||||
|
||||
const visibleWindows = pipeline(
|
||||
getAllLensWindows(),
|
||||
filter((lensWindow) => !!lensWindow.visible),
|
||||
filter((lensWindow) => !!lensWindow.isVisible),
|
||||
);
|
||||
|
||||
visibleWindows.forEach((lensWindow) =>
|
||||
|
||||
@ -408,7 +408,7 @@ export const getApplicationBuilder = () => {
|
||||
|
||||
const applicationWindow = mainDi.inject(applicationWindowInjectable);
|
||||
|
||||
await applicationWindow.open();
|
||||
await applicationWindow.start();
|
||||
|
||||
const startFrame = rendererDi.inject(startFrameInjectable);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user