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);
|
const windows = di.injectMany(lensWindowInjectionToken);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
windows.filter((window) => window.visible).map((window) => window.id),
|
windows.filter((window) => window.isVisible).map((window) => window.id),
|
||||||
).toEqual(windowIds);
|
).toEqual(windowIds);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -41,7 +41,7 @@ describe("quitting the app using application menu", () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
windows.map((window) => ({ id: window.id, visible: window.visible })),
|
windows.map((window) => ({ id: window.id, visible: window.isVisible })),
|
||||||
).toEqual([
|
).toEqual([
|
||||||
{ id: "only-application-window", visible: true },
|
{ id: "only-application-window", visible: true },
|
||||||
{ id: "splash", visible: false },
|
{ id: "splash", visible: false },
|
||||||
@ -59,7 +59,7 @@ describe("quitting the app using application menu", () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
windows.map((window) => ({ id: window.id, visible: window.visible })),
|
windows.map((window) => ({ id: window.id, visible: window.isVisible })),
|
||||||
).toEqual([
|
).toEqual([
|
||||||
{ id: "only-application-window", visible: false },
|
{ id: "only-application-window", visible: false },
|
||||||
{ id: "splash", visible: false },
|
{ id: "splash", visible: false },
|
||||||
|
|||||||
@ -20,7 +20,7 @@ const hideDockForLastClosedWindowInjectable = getInjectable({
|
|||||||
run: () => {
|
run: () => {
|
||||||
const visibleWindows = pipeline(
|
const visibleWindows = pipeline(
|
||||||
getLensWindows(),
|
getLensWindows(),
|
||||||
filter(window => !!window.visible),
|
filter(window => !!window.isVisible),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isEmpty(visibleWindows)) {
|
if (isEmpty(visibleWindows)) {
|
||||||
|
|||||||
@ -42,7 +42,7 @@ const createLensWindowInjectable = getInjectable({
|
|||||||
let browserWindow: ElectronWindow | undefined;
|
let browserWindow: ElectronWindow | undefined;
|
||||||
|
|
||||||
let windowIsShown = false;
|
let windowIsShown = false;
|
||||||
let windowIsOpening = false;
|
let windowIsStarting = false;
|
||||||
|
|
||||||
const showWindow = () => {
|
const showWindow = () => {
|
||||||
assert(browserWindow);
|
assert(browserWindow);
|
||||||
@ -54,17 +54,17 @@ const createLensWindowInjectable = getInjectable({
|
|||||||
return {
|
return {
|
||||||
id: configuration.id,
|
id: configuration.id,
|
||||||
|
|
||||||
get visible() {
|
get isVisible() {
|
||||||
return windowIsShown;
|
return windowIsShown;
|
||||||
},
|
},
|
||||||
|
|
||||||
get opening() {
|
get isStarting() {
|
||||||
return windowIsOpening;
|
return windowIsStarting;
|
||||||
},
|
},
|
||||||
|
|
||||||
open: async () => {
|
start: async () => {
|
||||||
if (!browserWindow) {
|
if (!browserWindow) {
|
||||||
windowIsOpening = true;
|
windowIsStarting = true;
|
||||||
|
|
||||||
browserWindow = createElectronWindow({
|
browserWindow = createElectronWindow({
|
||||||
...configuration,
|
...configuration,
|
||||||
@ -88,7 +88,7 @@ const createLensWindowInjectable = getInjectable({
|
|||||||
|
|
||||||
showWindow();
|
showWindow();
|
||||||
|
|
||||||
windowIsOpening = false;
|
windowIsStarting = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
show: showWindow,
|
show: showWindow,
|
||||||
|
|||||||
@ -13,12 +13,12 @@ export interface SendToViewArgs {
|
|||||||
|
|
||||||
export interface LensWindow {
|
export interface LensWindow {
|
||||||
id: string;
|
id: string;
|
||||||
open: () => Promise<void>;
|
start: () => Promise<void>;
|
||||||
close: () => void;
|
close: () => void;
|
||||||
show: () => void;
|
show: () => void;
|
||||||
send: (args: SendToViewArgs) => void;
|
send: (args: SendToViewArgs) => void;
|
||||||
visible: boolean;
|
isVisible: boolean;
|
||||||
opening: boolean;
|
isStarting: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const lensWindowInjectionToken = getInjectionToken<LensWindow>({
|
export const lensWindowInjectionToken = getInjectionToken<LensWindow>({
|
||||||
|
|||||||
@ -16,7 +16,7 @@ const showApplicationWindowInjectable = getInjectable({
|
|||||||
const splashWindow = di.inject(splashWindowInjectable);
|
const splashWindow = di.inject(splashWindowInjectable);
|
||||||
|
|
||||||
return async () => {
|
return async () => {
|
||||||
if (applicationWindow.opening) {
|
if (applicationWindow.isStarting) {
|
||||||
applicationWindow.show();
|
applicationWindow.show();
|
||||||
splashWindow.close();
|
splashWindow.close();
|
||||||
|
|
||||||
@ -24,17 +24,17 @@ const showApplicationWindowInjectable = getInjectable({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const windowIsAlreadyBeingShown = someIsTruthy([
|
const windowIsAlreadyBeingShown = someIsTruthy([
|
||||||
applicationWindow.visible,
|
applicationWindow.isVisible,
|
||||||
splashWindow.opening,
|
splashWindow.isStarting,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (windowIsAlreadyBeingShown) {
|
if (windowIsAlreadyBeingShown) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await splashWindow.open();
|
await splashWindow.start();
|
||||||
|
|
||||||
await applicationWindow.open();
|
await applicationWindow.start();
|
||||||
|
|
||||||
splashWindow.close();
|
splashWindow.close();
|
||||||
};
|
};
|
||||||
|
|||||||
@ -49,7 +49,7 @@ const startMainApplicationInjectable = getInjectable({
|
|||||||
await beforeApplicationIsLoading();
|
await beforeApplicationIsLoading();
|
||||||
|
|
||||||
if (!shouldStartHidden) {
|
if (!shouldStartHidden) {
|
||||||
await splashWindow.open();
|
await splashWindow.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
await onLoadOfApplication();
|
await onLoadOfApplication();
|
||||||
@ -60,7 +60,7 @@ const startMainApplicationInjectable = getInjectable({
|
|||||||
if (deepLinkUrl) {
|
if (deepLinkUrl) {
|
||||||
await openDeepLink(deepLinkUrl);
|
await openDeepLink(deepLinkUrl);
|
||||||
} else {
|
} else {
|
||||||
await applicationWindow.open();
|
await applicationWindow.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
splashWindow.close();
|
splashWindow.close();
|
||||||
|
|||||||
@ -21,10 +21,9 @@ const messageToChannelInjectable = getInjectable({
|
|||||||
return (channel: MessageChannel<any>, message?: unknown) => {
|
return (channel: MessageChannel<any>, message?: unknown) => {
|
||||||
const stringifiedMessage = tentativeStringifyJson(message);
|
const stringifiedMessage = tentativeStringifyJson(message);
|
||||||
|
|
||||||
|
|
||||||
const visibleWindows = pipeline(
|
const visibleWindows = pipeline(
|
||||||
getAllLensWindows(),
|
getAllLensWindows(),
|
||||||
filter((lensWindow) => !!lensWindow.visible),
|
filter((lensWindow) => !!lensWindow.isVisible),
|
||||||
);
|
);
|
||||||
|
|
||||||
visibleWindows.forEach((lensWindow) =>
|
visibleWindows.forEach((lensWindow) =>
|
||||||
|
|||||||
@ -408,7 +408,7 @@ export const getApplicationBuilder = () => {
|
|||||||
|
|
||||||
const applicationWindow = mainDi.inject(applicationWindowInjectable);
|
const applicationWindow = mainDi.inject(applicationWindowInjectable);
|
||||||
|
|
||||||
await applicationWindow.open();
|
await applicationWindow.start();
|
||||||
|
|
||||||
const startFrame = rendererDi.inject(startFrameInjectable);
|
const startFrame = rendererDi.inject(startFrameInjectable);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user