fix(audio-management): fix plugin name - closes #4898 (#4899)

This commit is contained in:
Benoit Lavenier 2025-03-10 18:19:56 +01:00 committed by GitHub
parent b53dc7b373
commit 7a4306acfc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,12 +9,12 @@ import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-pl
* *
* @usage * @usage
* ```typescript * ```typescript
* constructor(public audioman: AudioManagement) { } * constructor(public audioManagement: AudioManagement) { }
* *
* ... * ...
* *
* setAudioMode() { * setAudioMode() {
* this.audioman.setAudioMode(AudioManagement.AudioMode.NORMAL) * this.audioManagement.setAudioMode(AudioMode.NORMAL)
* .then(() => { * .then(() => {
* console.log('Device audio mode is now NORMAL'); * console.log('Device audio mode is now NORMAL');
* }) * })
@ -24,8 +24,8 @@ import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-pl
* } * }
* *
* getAudioMode() { * getAudioMode() {
* this.audioman.getAudioMode() * this.audioManagement.getAudioMode()
* .then((value: AudioManagement.AudioModeReturn) => { * .then((value: AudioModeReturn) => {
* console.log('Device audio mode is ' + value.label + ' (' + value.audioMode + ')'); * console.log('Device audio mode is ' + value.label + ' (' + value.audioMode + ')');
* }) * })
* .catch((reason) => { * .catch((reason) => {
@ -47,36 +47,36 @@ import { Cordova, AwesomeCordovaNativePlugin, Plugin } from '@awesome-cordova-pl
platforms: ['Android'] platforms: ['Android']
}) })
@Injectable() @Injectable()
export class Appsflyer extends AwesomeCordovaNativePlugin { export class AudioManagement extends AwesomeCordovaNativePlugin {
/** /**
* Sets the `AudioManagement.AudioMode` for the device. * Sets the `AudioManagement.AudioMode` for the device.
* *
* @param {AudioManagement.AudioMode} mode the device can be set to: Silent, Normal, Vibrate * @param {AudioMode} mode the device can be set to: Silent, Normal, Vibrate
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
@Cordova({ @Cordova({
successIndex: 1, successIndex: 1,
errorIndex: 2 errorIndex: 2
}) })
setAudioMode(mode: AudioManagement.AudioMode): Promise<void> { setAudioMode(mode: AudioMode): Promise<void> {
return; return;
} }
/** /**
* Gets the current `AudioManagement.AudioMode` of the device. Thenable returns an object with * Gets the current `AudioMode` of the device. Thenable returns an object with
* `label` and `audioMode` values. * `label` and `audioMode` values.
* *
* @returns {Promise<AudioManagement.AudioModeReturn>} * @returns {Promise<AudioModeReturn>}
*/ */
@Cordova() @Cordova()
getAudioMode(): Promise<AudioManagement.AudioModeReturn> { getAudioMode(): Promise<AudioModeReturn> {
return; return;
} }
/** /**
* Sets the specified `AudioManagement.VolumeType` for the device with the value from `volume`. * Sets the specified `VolumeType` for the device with the value from `volume`.
* *
* @param {AudioManagement.VolumeType} type the `AudioManagement.VolumeType` to set * @param {VolumeType} type the `VolumeType` to set
* @param {number} volume the volume value * @param {number} volume the volume value
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
@ -84,58 +84,56 @@ export class Appsflyer extends AwesomeCordovaNativePlugin {
successIndex: 2, successIndex: 2,
errorIndex: 3 errorIndex: 3
}) })
setVolume(type: AudioManagement.VolumeType, volume: number): Promise<void> { setVolume(type: VolumeType, volume: number): Promise<void> {
return; return;
} }
/** /**
* Gets the specified `AudioManagement.VolumeType`'s `volume`. Thenable returns an object with * Gets the specified `VolumeType`'s `volume`. Thenable returns an object with
* a numeric property for volume, `volume`. * a numeric property for volume, `volume`.
* *
* @param {AudioManagement.VolumeType} type the `AudioManagement.VolumeType` to get * @param {VolumeType} type the `VolumeType` to get
* @returns {Promise<{volume: number}>} * @returns {Promise<{volume: number}>}
*/ */
@Cordova({ @Cordova({
successIndex: 1, successIndex: 1,
errorIndex: 2 errorIndex: 2
}) })
getVolume(type: AudioManagement.VolumeType): Promise<{ volume: number }> { getVolume(type: VolumeType): Promise<{ volume: number }> {
return; return;
} }
/** /**
* Gets the specified `AudioManagement.VolumeType`'s maximum `volume`. Thenable returns an * Gets the specified `VolumeType`'s maximum `volume`. Thenable returns an
* object with a numeric property, `maxVolume`. * object with a numeric property, `maxVolume`.
* *
* @param {AudioManagement.VolumeType} type the `AudioManagement.VolumeType` to get * @param {VolumeType} type the `VolumeType` to get
* @returns {Promise<{maxVolume: number}>} * @returns {Promise<{maxVolume: number}>}
*/ */
@Cordova({ @Cordova({
successIndex: 1, successIndex: 1,
errorIndex: 2 errorIndex: 2
}) })
getMaxVolume(type: AudioManagement.VolumeType): Promise<{ maxVolume: number }> { getMaxVolume(type: VolumeType): Promise<{ maxVolume: number }> {
return; return;
} }
} }
export namespace AudioManagement { export enum AudioMode {
export enum AudioMode {
SILENT = 0, SILENT = 0,
VIBRATE, VIBRATE,
NORMAL NORMAL
} }
export enum VolumeType { export enum VolumeType {
RING = 0, RING = 0,
MUSIC, MUSIC,
NOTIFICATION, NOTIFICATION,
SYSTEM SYSTEM
} }
export interface AudioModeReturn { export interface AudioModeReturn {
audioMode: AudioManagement.AudioMode; audioMode: AudioMode;
label: string; label: string;
}
} }