Merge branch 'master' of github.com:driftyco/ionic-native

This commit is contained in:
Ibby Hadeed 2017-05-09 18:25:08 -04:00
commit c7400b1ab1
3 changed files with 277 additions and 1 deletions

View File

@ -16,7 +16,7 @@ import { Observable } from 'rxjs/Observable';
* ...
*
* // Listen to events from Native
* this.broadcaster.addEventListener('eventName').then((event) => console.log(event));
* this.broadcaster.addEventListener('eventName').subscribe((event) => console.log(event));
*
* // Send event to Native
* this.broadcaster.fireNativeEvent('eventName', {}).then(() => console.log('success'));

View File

@ -0,0 +1,52 @@
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';
/**
* @name File Encryption
* @description
* Simple file encryption for Cordova.
*
* @usage
* ```typescript
* import { FileEncryption } from '@ionic-native/file-encryption';
*
*
* constructor(private fileEncryption: FileEncryption) { }
*
* ...
*
* this.fileEncryption.decrypt('assets/json/topSecret.json', 'secretKey');
*
* this.fileEncryption.encrypt('assets/json/topSecret.json', 'secretKey');
*
* ```
*/
@Plugin({
pluginName: 'FileEncryption',
plugin: 'cordova-safe',
pluginRef: 'cordova.plugins.disusered',
repo: 'https://github.com/disusered/cordova-safe',
platforms: ['Android', 'iOS']
})
@Injectable()
export class FileEncryption extends IonicNativePlugin {
/**
* Enrcypt a file
* @param file {string} A string representing a local URI
* @param key {string} A key for the crypto operations
* @return {Promise<any>} Returns a promise that resolves when something happens
*/
@Cordova()
encrypt(file: string, key: string): Promise<any> { return; }
/**
* Decrypt a file
* @param file {string} A string representing a local URI
* @param key {string} A key for the crypto operations
* @return {Promise<any>} Returns a promise that resolves when something happens
*/
@Cordova()
decrypt(file: string, key: string): Promise<any> { return; }
}

View File

@ -0,0 +1,224 @@
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';
/**
* @name Mobile Accessibility
* @description
* This plugin exposes information on the status of various accessibility features of mobile operating systems, including, for example, whether a screen reader is running, invert colors is enabled, and the preferred scaling for text.
* It also allows an application to send a string to be spoken by the screen reader, or a command to stop the screen reader from speaking.
*
* @usage
* ```typescript
* import { MobileAccessibility } from 'ionic-native';
*
*
* constructor(private mobileAccessibility: MobileAccessibility) { }
*
* ...
*
* if(this.mobileAccessibility.isScreenReaderRunningCallback();
*
* ```
*/
@Plugin({
pluginName: 'MobileAccessibility',
plugin: 'https://github.com/phonegap/phonegap-mobile-accessibility.git',
pluginRef: 'MobileAccessibilityNotifications',
repo: 'https://github.com/phonegap/phonegap-mobile-accessibility',
platforms: ['Amazon Fire OS', 'Android', 'iOS']
})
@Injectable()
export class MobileAccessibility extends IonicNativePlugin {
MobileAccessibilityNotifications: {
ANNOUNCEMENT: 'ANNOUNCEMENT',
BOLD_TEXT_STATUS_CHANGED: 'BOLD_TEXT_STATUS_CHANGED',
CLOSED_CAPTIONING_STATUS_CHANGED: 'CLOSED_CAPTIONING_STATUS_CHANGED',
DARKER_SYSTEM_COLORS_STATUS_CHANGED: 'DARKER_SYSTEM_COLORS_STATUS_CHANGED',
GRAYSCALE_STATUS_CHANGED: 'GRAYSCALE_STATUS_CHANGED',
GUIDED_ACCESS_STATUS_CHANGED: 'GUIDED_ACCESS_STATUS_CHANGED',
INVERT_COLORS_STATUS_CHANGED: 'INVERT_COLORS_STATUS_CHANGED',
LAYOUT_CHANGED: 'LAYOUT_CHANGED',
MONO_AUDIO_STATUS_CHANGED: 'MONO_AUDIO_STATUS_CHANGED',
PAGE_SCROLLED: 'PAGE_SCROLLED',
REDUCE_MOTION_STATUS_CHANGED: 'REDUCE_MOTION_STATUS_CHANGED',
REDUCE_TRANSPARENCY_STATUS_CHANGED: 'REDUCE_TRANSPARENCY_STATUS_CHANGED',
SCREEN_CHANGED: 'SCREEN_CHANGED',
SCREEN_READER_STATUS_CHANGED: 'SCREEN_READER_STATUS_CHANGED',
SPEAK_SCREEN_STATUS_CHANGED: 'SPEAK_SCREEN_STATUS_CHANGED',
SPEAK_SELECTION_STATUS_CHANGED: 'SPEAK_SELECTION_STATUS_CHANGED',
SWITCH_CONTROL_STATUS_CHANGED: 'SWITCH_CONTROL_STATUS_CHANGED',
TOUCH_EXPLORATION_STATUS_CHANGED: 'TOUCH_EXPLORATION_STATUS_CHANGED'
};
/**
* Makes an asynchronous call to native MobileAccessibility to determine if a screen reader is running.
* @returns result {Promise<boolean>} A result method to receive the boolean result asynchronously from the native MobileAccessibility plugin.
*/
@Cordova()
isScreenReaderRunning(): Promise<boolean> { return; }
/**
* An iOS-specific proxy for the MobileAccessibility.isScreenReaderRunning method
* @returns result {Promise<boolean>} A result method to receive the boolean result asynchronously from the native MobileAccessibility plugin.
*/
@Cordova({ platforms: ['iOS'] })
isVoiceOverRunningCallback(): Promise<boolean> { return; }
/**
* An Android/Amazon Fire OS-specific proxy for the MobileAccessibility.isScreenReaderRunning method.
* @returns result {Promise<boolean>} A result method to receive the boolean result asynchronously from the native MobileAccessibility plugin.
*/
@Cordova({ platforms: ['Amazon Fire OS', 'Android'] })
isTalkBackRunningCallback(): Promise<boolean> { return; }
/**
* On Android, this method returns true if ChromeVox is active and properly initialized with access to the text to speech API in the WebView.
* If TalkBack is running but ChromeVox is not active, this method is useful to alert the user of a potential problem.
* @returns result {Promise<boolean>} Returns the result
*/
@Cordova({ platforms: ['Amazon Fire OS', 'Android'] })
isChromeVoxActive(): Promise<boolean> { return; }
/**
*
* @returns result {Promise<boolean>} Returns the result
*/
@Cordova({ platforms: ['iOS'] })
isBoldTextEnabledCallback(): Promise<boolean> { return; }
/**
*
* @returns result {Promise<boolean>} Returns the result
*/
@Cordova()
isClosedCaptioningEnabledCallback(): Promise<boolean> { return; }
/**
*
* @returns result {Promise<boolean>} Returns the result
*/
@Cordova({ platforms: ['iOS'] })
isDarkerSystemColorsEnabledCallback(): Promise<boolean> { return; }
/**
*
* @returns result {Promise<boolean>} Returns the result
*/
@Cordova({ platforms: ['iOS'] })
isGrayscaleEnabledCallback(): Promise<boolean> { return; }
/**
*
* @returns result {Promise<boolean>} Returns the result
*/
@Cordova({ platforms: ['iOS'] })
isGuidedAccessEnabledCallback(): Promise<boolean> { return; }
/**
*
* @returns result {Promise<boolean>} Returns the result
*/
@Cordova({ platforms: ['iOS'] })
isInvertColorsEnabledCallback(): Promise<boolean> { return; }
/**
*
* @returns result {Promise<boolean>} Returns the result
*/
@Cordova({ platforms: ['iOS'] })
isMonoAudioEnabledCallback(): Promise<boolean> { return; }
/**
*
* @returns result {Promise<boolean>} Returns the result
*/
@Cordova({ platforms: ['iOS'] })
isReduceMotionEnabledCallback(): Promise<boolean> { return; }
/**
*
* @returns result {Promise<boolean>} Returns the result
*/
@Cordova({ platforms: ['iOS'] })
isReduceTransparencyEnabledCallback(): Promise<boolean> { return; }
/**
*
* @returns result {Promise<boolean>} Returns the result
*/
@Cordova({ platforms: ['iOS'] })
isSpeakScreenEnabledCallback(): Promise<boolean> { return; }
/**
*
* @returns result {Promise<boolean>} Returns the result
*/
@Cordova({ platforms: ['iOS'] })
isSpeakSelectionEnabledCallback(): Promise<boolean> { return; }
/**
*
* @returns result {Promise<boolean>} Returns the result
*/
@Cordova({ platforms: ['iOS'] })
isSwitchControlRunningCallback(): Promise<boolean> { return; }
/**
*
* @returns result {Promise<boolean>} Returns the result
*/
@Cordova({ platforms: ['Amazon Fire OS', 'Android'] })
isTouchExplorationEnabledCallback(): Promise<boolean> { return; }
/**
*
* * @returns {Promise<number>} Returns the result
*/
@Cordova()
getTextZoomCallback(): Promise<number> { return; }
/**
* @param textZoom {nuber} A percentage value by which text in the WebView should be scaled.
*/
@Cordova({ sync: true })
setTextZoom(textZoom: number): void { }
/**
*
*/
@Cordova({ sync: true })
updateTextZoom(): void { }
/**
* A Boolean value which specifies whether to use the preferred text zoom of a default percent value of 100.
* @param value {boolean} Returns the result
*/
@Cordova({ sync: true })
usePreferredTextZoom(value: boolean): void { }
/**
* Posts a notification with a string for the screen reader to announce if it is running.
* @param mobileAccessibilityNotification {any}
* @param value {string} A string to be announced by a screen reader.
* @returns result {Promise<boolean>} Returns the result
*/
@Cordova({ platforms: ['iOS'] })
postNotification(mobileAccessibilityNotification: any, value: string): Promise<boolean> { return; }
/**
* Speaks a given string through the screenreader. On Android, if ChromeVox is active, it will use the specified queueMode and properties.
* @param value {string}
* @param queueMode {mumber}
* @param properties {any}
*/
@Cordova({ sync: true })
speak(value: string, queueMode?: number, properties?: any): void { }
/**
* Stops speech.
*/
@Cordova({ sync: true })
stop(): void { }
}