Skip to content

Commit

Permalink
feat: show custom update modal
Browse files Browse the repository at this point in the history
  • Loading branch information
domiSchenk committed Aug 30, 2021
1 parent 9489149 commit 5f4bbb9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "app"
version = "0.7.5"
version = "0.7.0"
description = "Commandos is a multi git repo client"
authors = [ "Dominik Schenk" ]
license = ""
Expand Down
2 changes: 1 addition & 1 deletion src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
</footer> -->
</div>
<app-commander-modal *ngIf="commanderModalService.open"></app-commander-modal>
<commandos-update-modal *ngIf="update && update.shouldUpdate" [update]="update"></commandos-update-modal>
<commandos-update-modal *ngIf="hasUpdate" [update]="update" (close)="closeUpdate()"></commandos-update-modal>
6 changes: 5 additions & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { UpdateResult } from '@tauri-apps/api/updater';
export class AppComponent {
devEnv: boolean = !environment.production;
update: UpdateResult;
hasUpdate: boolean = false;

constructor(
private translate: TranslateService,
Expand Down Expand Up @@ -58,9 +59,12 @@ export class AppComponent {
this.registerNewRepoCommand();

this.update = await this.tauriService.checkUpdate();
console.log(`TCL: ~ file: app.component.ts ~ line 61 ~ AppComponent ~ load ~ this.update`, this.update);
this.hasUpdate = this.update.shouldUpdate;
}

closeUpdate() {
this.hasUpdate = false;
}

private setDarkMode() {
if (this.storeService.DarkMode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ <h3 cds-text="title">Command update version v{{version}}</h3>
<div [innerHtml]="manifest"></div>
</cds-modal-content>
<cds-modal-actions>
<cds-button action="flat" (click)="cancel()">Cancel</cds-button>
<cds-button action="flat" (click)="cancel()">Keep current Version</cds-button>
<cds-button (click)="startUpdate()">Update Commandos</cds-button>
</cds-modal-actions>
</cds-modal>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input, OnInit, SecurityContext } from '@angular/core';
import { Component, EventEmitter, Input, OnInit, Output, SecurityContext } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { relaunch } from "@tauri-apps/api/process";
import { installUpdate, UpdateResult } from '@tauri-apps/api/updater';
Expand All @@ -15,12 +15,16 @@ export class UpdateModalComponent implements OnInit {
version: string;
manifest: string;

@Output() close = new EventEmitter();

@Input()
public set update(value: UpdateResult) {
this.version = value.manifest.version;
const manifest = marked(value.manifest.body);
this.manifest = this.domSanitizer.sanitize(SecurityContext.HTML, manifest);
this.manifest += this.manifest;
this.manifest += this.manifest;
this.manifest += this.manifest;
}


Expand All @@ -37,6 +41,6 @@ export class UpdateModalComponent implements OnInit {
}

cancel() {

this.close.emit();
}
}

0 comments on commit 5f4bbb9

Please sign in to comment.