follow sideload progress (#2718)

* follow sideload progress

* small bugfix

* shareReplay with no refcount false

* don't wrap sideload progress in RPCResult

* dont present toast

---------

Co-authored-by: Aiden McClelland <me@drbonez.dev>
This commit is contained in:
Matt Hill
2024-09-03 09:23:47 -06:00
committed by GitHub
parent 66b018a355
commit 9981ee7601
13 changed files with 200 additions and 125 deletions

View File

@@ -81,9 +81,8 @@ export class MockApiService extends ApiService {
.subscribe()
}
async uploadPackage(guid: string, body: Blob): Promise<string> {
async uploadPackage(guid: string, body: Blob): Promise<void> {
await pauseFor(2000)
return 'success'
}
async getStaticProxy(
@@ -106,7 +105,7 @@ export class MockApiService extends ApiService {
openWebsocket$<T>(
guid: string,
config: RR.WebsocketConfig<T>,
config: RR.WebsocketConfig<T> = {},
): Observable<T> {
if (guid === 'db-guid') {
return this.mockWsSource$.pipe<any>(
@@ -125,6 +124,11 @@ export class MockApiService extends ApiService {
return from(this.initProgress()).pipe(
startWith(PROGRESS),
) as Observable<T>
} else if (guid === 'sideload-progress-guid') {
config.openObserver?.next(new Event(''))
return from(this.initProgress()).pipe(
startWith(PROGRESS),
) as Observable<T>
} else {
throw new Error('invalid guid type')
}
@@ -1079,8 +1083,8 @@ export class MockApiService extends ApiService {
async sideloadPackage(): Promise<RR.SideloadPackageRes> {
await pauseFor(2000)
return {
upload: '4120e092-05ab-4de2-9fbd-c3f1f4b1df9e', // no significance, randomly generated
progress: '5120e092-05ab-4de2-9fbd-c3f1f4b1df9e', // no significance, randomly generated
upload: 'sideload-upload-guid', // no significance, randomly generated
progress: 'sideload-progress-guid', // no significance, randomly generated
}
}