Skip to content

Commit

Permalink
removed ipk file drop install
Browse files Browse the repository at this point in the history
  • Loading branch information
mariotaku committed Feb 28, 2024
1 parent ee8e2fc commit 70d1e8e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 51 deletions.
3 changes: 1 addition & 2 deletions src/app/apps/apps.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
</button>
</div>
</nav>
<div class="p-3 flex-fill overflow-auto" (drop)="dropFiles($event)" (dragover)="onDragOver($event)"
(dragenter)="onDragEnter($event)" (dragleave)="onDragLeave($event)" [ngbNavOutlet]="nav"></div>
<div class="p-3 flex-fill overflow-auto" [ngbNavOutlet]="nav"></div>
<div class="stat-bar border-top bottom-0 mt-auto d-flex flex-row flex-shrink-0 align-items-center">
<app-stat-storage-info class="ms-auto me-3 storage-info-bar" [device]="device" #storageInfo></app-stat-storage-info>
</div>
Expand Down
49 changes: 0 additions & 49 deletions src/app/apps/apps.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {open as showOpenDialog} from '@tauri-apps/api/dialog';
import {basename, downloadDir} from "@tauri-apps/api/path";
import {APP_ID_HBCHANNEL} from "../shared/constants";
import {HbchannelRemoveComponent} from "./hbchannel-remove/hbchannel-remove.component";
import {BaseDirectory, writeBinaryFile} from "@tauri-apps/api/fs";
import {StatStorageInfoComponent} from "../shared/components/stat-storage-info/stat-storage-info.component";

@Component({
Expand Down Expand Up @@ -56,25 +55,6 @@ export class AppsComponent implements OnInit, OnDestroy {
this.packagesSubscription = undefined;
}

onDragOver(event: DragEvent): void {
event.preventDefault();
event.stopPropagation();
}

onDragEnter(event: DragEvent): void {
const transfer = event.dataTransfer!;
if (transfer.items.length != 1 || transfer.items[0].kind != 'file') {
return;
}
event.preventDefault();
event.stopPropagation();
}

onDragLeave(event: DragEvent): void {
event.preventDefault();
event.stopPropagation();
}

loadPackages(): void {
const device = this.device;
if (!device) return;
Expand All @@ -90,35 +70,6 @@ export class AppsComponent implements OnInit, OnDestroy {
this.appManager.load(device).catch(noop);
}

async dropFiles(event: DragEvent): Promise<void> {
if (!this.device || this.tabId !== 'installed') return;
const transfer = event.dataTransfer!;
event.preventDefault();
event.stopPropagation();
const files = transfer.files;
if (files.length != 1 || !files[0].name.endsWith('.ipk')) {
// Show error
return;
}
const file: File = files[0];

writeBinaryFile((`webos-dev-tmp-${Date.now()}.ipk`), await file.arrayBuffer(), {
dir: BaseDirectory.Temp
});
const progress = ProgressDialogComponent.open(this.modalService);
const component = progress.componentInstance as ProgressDialogComponent;
try {
await this.appManager.installByPath(this.device, file.webkitRelativePath, (progress, statusText) => {
component.progress = progress;
component.message = statusText;
});
} catch (e) {
this.handleInstallationError(file.name, e as Error);
} finally {
progress.close(true);
}
}

async openInstallChooser(): Promise<void> {
if (!this.device) return;
const path = await showOpenDialog({
Expand Down

0 comments on commit 70d1e8e

Please sign in to comment.