-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move voice selection to seperate page.
- Loading branch information
Showing
6 changed files
with
80 additions
and
34 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-buttons slot="start"> | ||
<ion-back-button defaultHref="/"></ion-back-button> | ||
</ion-buttons> | ||
<ion-title> | ||
<span translate>Voice</span> | ||
</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
|
||
<ion-content> | ||
<ion-list> | ||
<ion-item> | ||
<ion-select label="{{'Voice' | translate}}" [disabled]="!options.language || voices.length < 2" [(ngModel)]="options.voice" (ionChange)="update()" cancelText="{{'Cancel' | translate}}" okText="{{'OK' | translate}}"> | ||
<ion-select-option translate value="">Default</ion-select-option> | ||
<ion-select-option *ngFor="let v of voices" value="{{v.identifier}}">{{v.name}}</ion-select-option> | ||
</ion-select> | ||
</ion-item> | ||
<ion-item> | ||
<ion-button (click)="test()">Test</ion-button> | ||
</ion-item> | ||
</ion-list> | ||
</ion-content> |
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,40 @@ | ||
import { Component, OnDestroy } from '@angular/core'; | ||
|
||
import { TranslateService } from '@ngx-translate/core'; | ||
|
||
import { AppSettings, Options } from '../app-settings'; | ||
import { SpeechService } from '../services'; | ||
|
||
|
||
@Component({ | ||
templateUrl: 'voice.page.html' | ||
}) | ||
export class VoicePage implements OnDestroy { | ||
|
||
options = new Options(); | ||
|
||
voices = []; | ||
|
||
private subscription: any; | ||
|
||
constructor(private settings: AppSettings, private speech: SpeechService, private translate: TranslateService) {} | ||
|
||
ngOnInit() { | ||
this.subscription = this.settings.getOptions().subscribe(options => { | ||
this.options = options; | ||
}); | ||
} | ||
|
||
ngOnDestroy() { | ||
this.subscription.unsubscribe(); | ||
} | ||
|
||
async update() { | ||
return this.settings.setOptions(this.options); | ||
} | ||
|
||
async test() { | ||
const greeting = this.translate.instant("notifications.greeting"); | ||
this.speech.speak(greeting); | ||
} | ||
} |