mirror of
https://github.com/bitwarden/browser
synced 2026-01-06 02:23:44 +00:00
[PM-12989] Create process for qa to build client with particular sdk version (#11601)
* feat: update sdk service abstraction with documentation and new `userClient$` function * feat: add uninitialized user client with cache * feat: initialize user crypto * feat: initialize org keys * fix: org crypto not initializing properly * feat: avoid creating clients unnecessarily * chore: remove dev print/subscription * fix: clean up cache * chore: update sdk version * feat: implement clean-up logic (#11504) * chore: bump sdk version to fix build issues * chore: bump sdk version to fix build issues * fix: missing constructor parameters * refactor: simplify free() and delete() calls * refactor: use a named function for client creation * fix: client never freeing after refactor * fix: broken impl and race condition in tests * feat: add sdk override to desktop build * feat: add SDK version to browser about dialog * feat: add sdk override to browser build * fix: `npm ci` overriding the override * fix: artifacts not properly downloaded * fix: switch to new repository * feat: add debug version function to web * feat: add sdk-version to CLI * feat: add version to desktop * feat: add override to cli * feat: add override to web * fix: cli version acting as default command * fix: consistent workflow input name * feat: add error handling * feat: upgrade sdk-internal * fix: forgot to update package lock * fix: broken CI build move sdk version to a regular command * chore: revert version changes * refactor: move error handling code * chore: bump SDK to 0.2.0.main-1 * fix: clean up references to inputs.sdk_commit * refactor: rename `init` to `applyVersionToWindow`
This commit is contained in:
17
apps/desktop/src/platform/main/version.main.ts
Normal file
17
apps/desktop/src/platform/main/version.main.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { ipcMain } from "electron";
|
||||
|
||||
import { WindowMain } from "../../main/window.main";
|
||||
|
||||
export class VersionMain {
|
||||
constructor(private windowMain: WindowMain) {}
|
||||
|
||||
sdkVersion() {
|
||||
const timeout = new Promise((resolve) => setTimeout(() => resolve("Timeout error"), 1000));
|
||||
const version = new Promise((resolve) => {
|
||||
ipcMain.once("sdkVersion", (_, version) => resolve(version));
|
||||
this.windowMain.win.webContents.send("sdkVersion");
|
||||
});
|
||||
|
||||
return Promise.race([timeout, version]);
|
||||
}
|
||||
}
|
||||
@@ -122,6 +122,13 @@ const localhostCallbackService = {
|
||||
export default {
|
||||
versions: {
|
||||
app: (): Promise<string> => ipcRenderer.invoke("appVersion"),
|
||||
registerSdkVersionProvider: (provide: (resolve: (version: string) => void) => void) => {
|
||||
const resolve = (version: string) => ipcRenderer.send("sdkVersion", version);
|
||||
|
||||
ipcRenderer.on("sdkVersion", () => {
|
||||
provide(resolve);
|
||||
});
|
||||
},
|
||||
},
|
||||
deviceType: deviceType(),
|
||||
isDev: isDev(),
|
||||
|
||||
18
apps/desktop/src/platform/services/version.service.ts
Normal file
18
apps/desktop/src/platform/services/version.service.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Injectable } from "@angular/core";
|
||||
import { firstValueFrom } from "rxjs";
|
||||
|
||||
import { SdkService } from "@bitwarden/common/platform/abstractions/sdk/sdk.service";
|
||||
|
||||
@Injectable({
|
||||
providedIn: "root",
|
||||
})
|
||||
export class VersionService {
|
||||
constructor(private sdkService: SdkService) {}
|
||||
|
||||
init() {
|
||||
ipc.platform.versions.registerSdkVersionProvider(async (resolve) => {
|
||||
const version = await firstValueFrom(this.sdkService.version$);
|
||||
resolve(version);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user