58 lines
1.3 KiB
TypeScript
58 lines
1.3 KiB
TypeScript
import { Observable } from 'rxjs';
|
|
|
|
import { NativeService, WindowState } from '@ucap-webmessenger/native';
|
|
import { HttpClient } from '@angular/common/http';
|
|
import { map } from 'rxjs/operators';
|
|
|
|
export class BrowserNativeService implements NativeService {
|
|
showNotify(
|
|
roomSeq: number,
|
|
title: string,
|
|
contents: string,
|
|
image: string,
|
|
useSound: boolean
|
|
): void {}
|
|
|
|
checkForUpdates(): Observable<boolean> {
|
|
return new Observable<boolean>(subscriber => {
|
|
try {
|
|
subscriber.next(false);
|
|
} catch (error) {
|
|
subscriber.error(error);
|
|
} finally {
|
|
subscriber.complete();
|
|
}
|
|
});
|
|
}
|
|
|
|
showImageViewer(): void {}
|
|
|
|
readFile(path: string): Observable<ArrayBuffer> {
|
|
return this.httpClient.get(path, { responseType: 'arraybuffer' });
|
|
}
|
|
|
|
saveFile(path: string, buf: ArrayBuffer): Observable<boolean> {
|
|
return this.httpClient.post<boolean>(path, buf, {});
|
|
}
|
|
|
|
windowStateChanged(): Observable<WindowState> {
|
|
return new Observable<WindowState>(subscriber => {
|
|
try {
|
|
subscriber.next(WindowState.Normal);
|
|
} catch (error) {
|
|
subscriber.error(error);
|
|
} finally {
|
|
subscriber.complete();
|
|
}
|
|
});
|
|
}
|
|
|
|
windowClose(): void {}
|
|
|
|
windowMinimize(): void {}
|
|
|
|
windowMaximize(): void {}
|
|
|
|
constructor(private httpClient: HttpClient) {}
|
|
}
|