remove unused codes and update

This commit is contained in:
2026-05-10 09:44:30 +03:30
parent a138034c06
commit 048e292bdd
107 changed files with 317 additions and 17930 deletions
@@ -28,6 +28,11 @@ export interface INativeBridgeResult<T = unknown> {
error?: string;
}
export interface INativeBridgeDeviceInfo {
deviceName: string;
androidId: string;
}
@Injectable({ providedIn: 'root' })
export class NativeBridgeService {
private readonly toastService = inject(ToastService);
@@ -108,6 +113,19 @@ export class NativeBridgeService {
return this.invokePrint(request);
}
async getDeviceInfo(): Promise<INativeBridgeResult<INativeBridgeDeviceInfo>> {
if (!this.isEnabled()) {
return { success: false, error: 'متاسفانه ارتباط با دستگاه برقرار نیست.' };
}
try {
// @ts-ignore
const deviceInfo = await window.NativeBridge.deviceInfo();
return { success: true, data: JSON.parse(deviceInfo) };
} catch (error) {
return { success: false, error: (error as Error).message };
}
}
private invokePrint(payload: INativePrintRequest): INativeBridgeResult {
if (!this.isEnabled() || !this.canPrint()) {
this.toastService.warn({ text: 'متاسفانه ارتباط با چاپگر برقرار نیست.' });