From 7cafebd0e88c828daa562364f8a390ab695ee6a8 Mon Sep 17 00:00:00 2001 From: Daniel Sogl Date: Fri, 16 Mar 2018 15:17:29 +0100 Subject: [PATCH] feat(device-feedback): add feedback interface --- .../plugins/device-feedback/index.ts | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/@ionic-native/plugins/device-feedback/index.ts b/src/@ionic-native/plugins/device-feedback/index.ts index 5246e4e6d..132c523f8 100644 --- a/src/@ionic-native/plugins/device-feedback/index.ts +++ b/src/@ionic-native/plugins/device-feedback/index.ts @@ -1,5 +1,14 @@ import { Injectable } from '@angular/core'; -import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; +import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; + +export interface DeviceFeedbackEnabled { + /** Haptic Feedback */ + haptic: boolean; + + /** Acoustic Feedback */ + acoustic: boolean; +} + /** * @name Device Feedback * @description @@ -19,8 +28,7 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; * * this.deviceFeedback.haptic(0); * - * this.deviceFeedback.isFeedbackEnabled() - * .then((feedback) => { + * this.deviceFeedback.isFeedbackEnabled().then(feedback => { * console.log(feedback); * // { * // acoustic: true, @@ -29,6 +37,8 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; * }); * * ``` + * @innterfaces + * DeviceFeedbackEnabled */ @Plugin({ pluginName: 'DeviceFeedback', @@ -39,25 +49,25 @@ import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; }) @Injectable() export class DeviceFeedback extends IonicNativePlugin { - /** * Provide sound feedback to user, nevertheless respect user's settings and current active device profile as native feedback do. */ @Cordova({ sync: true }) - acoustic(): void { } + acoustic(): void {} /** * Provide vibrate feedback to user, nevertheless respect user's tactile feedback setting as native feedback do. - * @param type {Number} Specify type of vibration feedback. 0 for long press, 1 for virtual key, or 3 for keyboard tap. + * @param type {number} Specify type of vibration feedback. 0 for long press, 1 for virtual key, or 3 for keyboard tap. */ @Cordova({ sync: true }) - haptic(type: number): void { } + haptic(type: number): void {} /** * Check if haptic and acoustic feedback is enabled by user settings. - * @returns {Promise} + * @returns {Promise} */ @Cordova() - isFeedbackEnabled(): Promise<{ haptic: boolean; acoustic: boolean; }> { return; } - + isFeedbackEnabled(): Promise { + return; + } }