From 8d0d919ba86898b57212b60410c07802aa7608c5 Mon Sep 17 00:00:00 2001 From: William Brawner Date: Fri, 2 Oct 2020 13:55:38 +0000 Subject: [PATCH] WIP: Implement shortcuts Signed-off-by: William Brawner --- src/app/app.component.ts | 8 +++++++- .../add-edit-transaction.component.html | 7 +++++++ src/manifest.json | 9 +++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index b9edcc4..1ca4fca 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,4 +1,4 @@ -import { Component, Inject, ApplicationRef } from '@angular/core'; +import { Component, Inject, ApplicationRef, ChangeDetectorRef } from '@angular/core'; import { Location } from '@angular/common'; import { User } from './users/user'; import { TWIGS_SERVICE, TwigsService } from './shared/twigs.service'; @@ -31,6 +31,7 @@ export class AppComponent { private activatedRoute: ActivatedRoute, private appRef: ApplicationRef, private updates: SwUpdate, + private changeDetector: ChangeDetectorRef, ) { if (this.cookieService.check('Authorization')) { this.twigsService.getProfile().subscribe(user => { @@ -82,4 +83,9 @@ export class AppComponent { this.location.go('/'); }); } + + enableBackButton(enable: boolean): void { + this.backEnabled = enable; + this.changeDetector.detectChanges(); + } } diff --git a/src/app/transactions/add-edit-transaction/add-edit-transaction.component.html b/src/app/transactions/add-edit-transaction/add-edit-transaction.component.html index ff6ec6f..d60608b 100644 --- a/src/app/transactions/add-edit-transaction/add-edit-transaction.component.html +++ b/src/app/transactions/add-edit-transaction/add-edit-transaction.component.html @@ -21,6 +21,13 @@ Expense Income + + + + {{ budget.title }} + + + diff --git a/src/manifest.json b/src/manifest.json index b0d0c63..08883ce 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -95,5 +95,14 @@ "type": "image/png", "purpose": "maskable" } + ], + "shortcuts": [ + { + "name": "Add Transaction", + "short_name": "Add Transaction", + "description": "Add a new transaction", + "url": "/play", + "icons": [{ "src": "/icons/play-later.png", "sizes": "192x192" }] + } ] }