-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add about section in menu to include app info and licenses (#26)
* Add about section in menu to include app info and licenses Fixes #25 * Refactor i18n files to remove unused keys * Remove unused keys from i18n files
- Loading branch information
Showing
10 changed files
with
637 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/app/home/components/about-modal/about-modal.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-buttons slot="start"> | ||
<ion-button (click)="dismissModal()"> | ||
<ion-icon *ngIf="isMD" slot="icon-only" name="close-outline"></ion-icon> | ||
<ion-label *ngIf="!isMD">{{ "ABOUT_MODAL.CLOSE" | translate }}</ion-label> | ||
</ion-button> | ||
</ion-buttons> | ||
<ion-title>{{ "ABOUT_MODAL.TITLE" | translate }}</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content> | ||
<ion-card> | ||
<ion-card-header> | ||
<ion-card-title>{{ "ABOUT_MODAL.VERSION_INFO_HEADER" | translate }}</ion-card-title> | ||
</ion-card-header> | ||
<ion-card-content> | ||
<p>{{ "ABOUT_MODAL.VERSION_INFO.VERSION" | translate }}: {{ versionInfo.versionName }}</p> | ||
<p>{{ "ABOUT_MODAL.VERSION_INFO.BUILD_DATE" | translate }}: {{ versionInfo.buildDate }}</p> | ||
<p>{{ "ABOUT_MODAL.VERSION_INFO.GIT_HASH" | translate }}: {{ versionInfo.commitHash }}</p> | ||
</ion-card-content> | ||
</ion-card> | ||
|
||
<ng-container *ngIf="licenses.length > 0"> | ||
<ion-card> | ||
<ion-card-header> | ||
<ion-card-title>{{ "ABOUT_MODAL.LICENSES_HEADER" | translate }}</ion-card-title> | ||
</ion-card-header> | ||
<ion-card-content> | ||
<ion-accordion-group> | ||
<ion-accordion *ngFor="let license of licenses"> | ||
<ion-item slot="header" color="light"> | ||
<ion-label> {{ license.title }}</ion-label> | ||
</ion-item> | ||
<div class="ion-padding" slot="content"> | ||
<p class="line-break">{{ license.body }}</p> | ||
</div> | ||
</ion-accordion> | ||
</ion-accordion-group> | ||
</ion-card-content> | ||
</ion-card> | ||
</ng-container> | ||
</ion-content> |
3 changes: 3 additions & 0 deletions
3
src/app/home/components/about-modal/about-modal.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.line-break { | ||
white-space: pre-line; | ||
} |
37 changes: 37 additions & 0 deletions
37
src/app/home/components/about-modal/about-modal.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { HttpClient } from '@angular/common/http'; | ||
import { Component } from '@angular/core'; | ||
import { Config, ModalController } from '@ionic/angular'; | ||
import { lastValueFrom } from 'rxjs'; | ||
import { AppVersionInfo } from 'src/app/models/app-version.enum'; | ||
import { AppConfigService } from 'src/app/services/app-config.service'; | ||
|
||
@Component({ | ||
selector: 'app-about-modal', | ||
templateUrl: './about-modal.component.html', | ||
styleUrls: ['./about-modal.component.scss'], | ||
}) | ||
export class AboutModalComponent { | ||
|
||
isMD: boolean | ||
versionInfo: AppVersionInfo | ||
licenses: {title: string, body: string}[] = [] | ||
|
||
constructor( | ||
private modalController: ModalController, | ||
private httpClient: HttpClient, | ||
configService: AppConfigService, | ||
config: Config) { | ||
this.isMD = config.get('mode') !== 'ios' | ||
this.versionInfo = configService.versionInfo | ||
this.loadLicenses() | ||
} | ||
|
||
async dismissModal() { | ||
await this.modalController.dismiss() | ||
} | ||
|
||
private async loadLicenses() { | ||
const ngxscannerqrcodeLicense = await lastValueFrom(this.httpClient.get('assets/licenses/ngxqrcode.txt', {responseType: 'text'})) | ||
this.licenses.push({title: 'ngx-scanner-qrcode', body: ngxscannerqrcodeLicense}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.