Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
feat: verify if flatpak and snap are installed
Browse files Browse the repository at this point in the history
  • Loading branch information
MessiasLima committed May 4, 2021
1 parent 141ada4 commit eef1bfe
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/app/app.component.ts
Expand Up @@ -38,7 +38,7 @@ export class AppComponent implements OnInit {

private openInitialSetupIfNecessary(): void {
this.settingsService.getLastSynchronizationDate().then((date) => {
if (date) {
if (!date) {
return this.goToInitialSetup();
}
});
Expand Down
14 changes: 10 additions & 4 deletions src/app/service/setup/setup.service.ts
Expand Up @@ -13,11 +13,17 @@ export class SetupService {
return this.processService.executeCommand('pkexec apt install snapd');
}

checkIfSnapdIsIntalled(): void {
this.processService.executeCommand('pkexec apt install snapd');
checkIfSnapdIsInstalled(): Promise<void> {
return this.processService.executeCommand('snap version').then(() => {
return;
});
}

checkIfFlatpakIsIntalled(): void {
this.processService.executeCommand('pkexec apt install snapd');
checkIfFlatpakIsInstalled(): Promise<void> {
return this.processService
.executeCommand('flatpak --version')
.then(() => {
return;
});
}
}
Expand Up @@ -3,6 +3,7 @@
<div class="d-flex justify-content-between">
<span class="item-name">{{ itemName }}</span>
<div>
<nb-icon *ngIf="status === 'installed'" icon="checkmark-circle-2-outline" status="success" size="large"></nb-icon>
<button
nbButton
hero
Expand Down
@@ -1,7 +1,12 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SetupItemCardComponent } from './setup-item-card.component';
import { NbButtonModule, NbCardModule, NbSpinnerModule } from '@nebular/theme';
import {
NbButtonModule,
NbCardModule,
NbIconModule,
NbSpinnerModule,
} from '@nebular/theme';
import { TranslateModule } from '@ngx-translate/core';

@NgModule({
Expand All @@ -12,6 +17,7 @@ import { TranslateModule } from '@ngx-translate/core';
NbButtonModule,
NbSpinnerModule,
TranslateModule,
NbIconModule,
],
exports: [SetupItemCardComponent],
})
Expand Down
28 changes: 22 additions & 6 deletions src/app/ui/pages/initial-setup/initial-setup.component.ts
Expand Up @@ -18,16 +18,32 @@ export class InitialSetupComponent implements OnInit {
}

private checkSetup(): void {
this.checkIfFlatpakIsIntalled();
this.checkIfSnapdIsIntalled();
this.checkIfFlatpakIsInstalled();
this.checkIfSnapdIsInstalled();
}

private checkIfSnapdIsIntalled(): void {
this.setupService.checkIfSnapdIsIntalled();
private checkIfSnapdIsInstalled(): void {
this.snapdStatus = CardStatus.LOADING;
this.setupService
.checkIfSnapdIsInstalled()
.then(() => {
this.snapdStatus = CardStatus.INSTALLED;
})
.catch(() => {
this.snapdStatus = CardStatus.NOT_INSTALLED;
});
}

private checkIfFlatpakIsIntalled(): void {
this.setupService.checkIfFlatpakIsIntalled();
private checkIfFlatpakIsInstalled(): void {
this.flatpakStatus = CardStatus.LOADING;
this.setupService
.checkIfFlatpakIsInstalled()
.then(() => {
this.flatpakStatus = CardStatus.INSTALLED;
})
.catch(() => {
this.flatpakStatus = CardStatus.NOT_INSTALLED;
});
}

installSnapd(): void {
Expand Down

0 comments on commit eef1bfe

Please sign in to comment.