From 72b42dea5aa0f1c58b070661abb4cc888faa0906 Mon Sep 17 00:00:00 2001 From: Isaac Grynsztein Date: Wed, 25 Mar 2020 07:39:39 -0400 Subject: [PATCH] About dialog now informs user when update is available or when they are up to date based on the github release api --- .../about-dialog/about-dialog.component.html | 6 +++++- .../about-dialog/about-dialog.component.scss | 13 +++++++++++++ .../about-dialog/about-dialog.component.ts | 16 ++++++++++++++-- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/app/dialogs/about-dialog/about-dialog.component.html b/src/app/dialogs/about-dialog/about-dialog.component.html index 565d115..5af92fb 100644 --- a/src/app/dialogs/about-dialog/about-dialog.component.html +++ b/src/app/dialogs/about-dialog/about-dialog.component.html @@ -14,7 +14,11 @@ -

Installed version: {{version}} - View latest update

+

+ Installed version: {{current_version_tag}} -  Checking for updates... + done  Update available - {{latestGithubRelease['tag_name']}} + You are up to date. +

diff --git a/src/app/dialogs/about-dialog/about-dialog.component.scss b/src/app/dialogs/about-dialog/about-dialog.component.scss index b1d084c..83af855 100644 --- a/src/app/dialogs/about-dialog/about-dialog.component.scss +++ b/src/app/dialogs/about-dialog/about-dialog.component.scss @@ -1,3 +1,16 @@ i { margin-right: 1px; +} + +.version-spinner { + top: 4px; + margin-right: 5px; + margin-left: 5px; + display: inline-block; +} + +.version-checked-icon { + top: 4px; + margin-left: 2px; + position: relative; } \ No newline at end of file diff --git a/src/app/dialogs/about-dialog/about-dialog.component.ts b/src/app/dialogs/about-dialog/about-dialog.component.ts index 475328a..10e82f5 100644 --- a/src/app/dialogs/about-dialog/about-dialog.component.ts +++ b/src/app/dialogs/about-dialog/about-dialog.component.ts @@ -1,4 +1,5 @@ import { Component, OnInit } from '@angular/core'; +import { PostsService } from 'app/posts.services'; @Component({ selector: 'app-about-dialog', @@ -10,12 +11,23 @@ export class AboutDialogComponent implements OnInit { projectLink = 'https://github.com/Tzahi12345/YoutubeDL-Material'; issuesLink = 'https://github.com/Tzahi12345/YoutubeDL-Material/issues'; latestUpdateLink = 'https://github.com/Tzahi12345/YoutubeDL-Material/releases/latest' + latestGithubRelease = null; + checking_for_updates = true; - version = 'v3.5'; + current_version_tag = 'v3.5'; - constructor() { } + constructor(private postsService: PostsService) { } ngOnInit(): void { + this.getLatestGithubRelease() + } + + getLatestGithubRelease() { + this.postsService.getLatestGithubRelease().subscribe(res => { + this.checking_for_updates = false; + this.latestGithubRelease = res; + console.log(this.latestGithubRelease) + }); } }