feat(sms-retriever): add plugin (#3052)
* created index.ts file for sms retriver plugin wrapper for ionic native created index.ts file for sms retriver plugin wrapper for ionic native Plugin name : cordova-plugin-sms-retriever-manager * resolved tslint errors resolved tslint errors * Update index.ts * Update index.ts
This commit is contained in:
parent
ed80933b6c
commit
6cbb226ed2
56
src/@ionic-native/plugins/sms-retriever/index.ts
Normal file
56
src/@ionic-native/plugins/sms-retriever/index.ts
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Sms Retriever
|
||||||
|
* @description
|
||||||
|
* This plugin retrives the SMS which arrive without requiring READ permissions.
|
||||||
|
*
|
||||||
|
* @usage
|
||||||
|
* ```typescript
|
||||||
|
* import { SmsRetriever } from '@ionic-native/sms-retriever';
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* constructor(private smsRetriever: SmsRetriever) { }
|
||||||
|
*
|
||||||
|
* ...
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* this.smsRetriever.getAppHash()
|
||||||
|
* .then((res: any) => console.log(res))
|
||||||
|
* .catch((error: any) => console.error(error));
|
||||||
|
* this.smsRetriever.startWatching()
|
||||||
|
* .then((res: any) => console.log(res))
|
||||||
|
* .catch((error: any) => console.error(error));
|
||||||
|
*
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
@Plugin({
|
||||||
|
pluginName: 'SmsRetriever',
|
||||||
|
plugin: 'cordova-plugin-sms-retriever-manager',
|
||||||
|
pluginRef: 'cordova.plugins.smsRetriever',
|
||||||
|
repo: 'https://github.com/hanatharesh2712/ionic-native-sms-retriever-plugin-master',
|
||||||
|
install: 'ionic cordova plugin add cordova-plugin-sms-retriever-manager --variable PLAY_SERVICES_VERSION="15.0.1"',
|
||||||
|
installVariables: ['PLAY_SERVICES_VERSION'],
|
||||||
|
platforms: ['Android']
|
||||||
|
})
|
||||||
|
@Injectable()
|
||||||
|
export class SmsRetriever extends IonicNativePlugin {
|
||||||
|
/**
|
||||||
|
* This function start wathching message arrive event and retrive message text.
|
||||||
|
* @return {Promise<string>} Returns a promise that resolves when retrives SMS text or TIMEOUT after 5 min.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
startWatching(): Promise<string> {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is to get hash string of APP.
|
||||||
|
* @return {Promise<string>} Returns a promise that resolves when successfully generate hash of APP.
|
||||||
|
*/
|
||||||
|
@Cordova()
|
||||||
|
getAppHash(): Promise<string> {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user