feat(music-controls): add new optional parameters for icons

feat(music-controls): add new optional parameters for icons
This commit is contained in:
Daniel Sogl 2018-03-17 01:18:11 +01:00 committed by GitHub
commit 2e0ea0f50e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
export interface MusicControlsOptions { export interface MusicControlsOptions {
@ -20,6 +20,12 @@ export interface MusicControlsOptions {
duration?: number; duration?: number;
elapsed?: number; elapsed?: number;
ticker?: string; ticker?: string;
playIcon?: string;
pauseIcon?: string;
prevIcon?: string;
nextIcon?: string;
closeIcon?: string;
notificationIcon?: string;
} }
/** /**
@ -63,7 +69,15 @@ export interface MusicControlsOptions {
* *
* // Android only, optional * // Android only, optional
* // text displayed in the status bar when the notification (and the ticker) are updated, optional * // text displayed in the status bar when the notification (and the ticker) are updated, optional
* ticker : 'Now playing "Time is Running Out"' * ticker : 'Now playing "Time is Running Out"',
* // All icons default to their built-in android equivalents
* // The supplied drawable name, e.g. 'media_play', is the name of a drawable found under android/res/drawable* folders
* playIcon: 'media_play',
* pauseIcon: 'media_pause',
* prevIcon: 'media_prev',
* nextIcon: 'media_next',
* closeIcon: 'media_close',
* notificationIcon: 'notification'
* }); * });
* *
* this.musicControls.subscribe().subscribe(action => { * this.musicControls.subscribe().subscribe(action => {
@ -140,21 +154,24 @@ export interface MusicControlsOptions {
}) })
@Injectable() @Injectable()
export class MusicControls extends IonicNativePlugin { export class MusicControls extends IonicNativePlugin {
/** /**
* Create the media controls * Create the media controls
* @param options {MusicControlsOptions} * @param options {MusicControlsOptions}
* @returns {Promise<any>} * @returns {Promise<any>}
*/ */
@Cordova() @Cordova()
create(options: MusicControlsOptions): Promise<any> { return; } create(options: MusicControlsOptions): Promise<any> {
return;
}
/** /**
* Destroy the media controller * Destroy the media controller
* @returns {Promise<any>} * @returns {Promise<any>}
*/ */
@Cordova() @Cordova()
destroy(): Promise<any> { return; } destroy(): Promise<any> {
return;
}
/** /**
* Subscribe to the events of the media controller * Subscribe to the events of the media controller
@ -163,34 +180,36 @@ export class MusicControls extends IonicNativePlugin {
@Cordova({ @Cordova({
observable: true observable: true
}) })
subscribe(): Observable<any> { return; } subscribe(): Observable<any> {
return;
}
/** /**
* Start listening for events, this enables the Observable from the subscribe method * Start listening for events, this enables the Observable from the subscribe method
*/ */
@Cordova({ sync: true }) @Cordova({ sync: true })
listen(): void { } listen(): void {}
/** /**
* Toggle play/pause: * Toggle play/pause:
* @param isPlaying {boolean} * @param isPlaying {boolean}
*/ */
@Cordova() @Cordova()
updateIsPlaying(isPlaying: boolean): void { } updateIsPlaying(isPlaying: boolean): void {}
/** /**
* Update elapsed time, optionally toggle play/pause: * Update elapsed time, optionally toggle play/pause:
* @param args {Object} * @param args {Object}
*/ */
@Cordova({ @Cordova({
platforms: ['iOS'] platforms: ['iOS']
}) })
updateElapsed(args: { elapsed: string; isPlaying: boolean; }): void { } updateElapsed(args: { elapsed: string; isPlaying: boolean }): void {}
/** /**
* Toggle dismissable: * Toggle dismissable:
* @param dismissable {boolean} * @param dismissable {boolean}
*/ */
@Cordova() @Cordova()
updateDismissable(dismissable: boolean): void { } updateDismissable(dismissable: boolean): void {}
} }