feat(ios-aswebauthenticationsession): add plugin (#3421)

* feat(ios-aswebauthenticationsession): add plugin

* Update index.ts

* returning string instead of any

Co-authored-by: Daniel Sogl <daniel@sogls.de>
This commit is contained in:
philkry 2020-06-11 18:14:21 +02:00 committed by GitHub
parent 79c3284434
commit 742ff65596
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,49 @@
import { Injectable } from '@angular/core';
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
/**
* @name ios-aswebauthenticationsession-api
* @description
* Plugin for iOS 12 ASWebAuthenticationSession API
*
* @usage
* ```typescript
* import { IosASWebauthenticationSession } from '@ionic-native/ios-aswebauthenticationsession-api/ngx';
*
*
* constructor(private IosASWebauthenticationSession: ios-aswebauthenticationsession-api) { }
*
* ...
*
*
* this.IosASWebauthenticationSession.start(callbackUrl, authorizeURL)
* .then((redirectUrl: string) => console.log(redirectUrl))
* .catch((error: any) => console.error(error));
*
* ```
*/
@Plugin({
pluginName: 'IosASWebauthenticationSession',
plugin: 'cordova-plugin-ios-aswebauthenticationsession-api',
pluginRef: 'plugins.ASWebAuthSession',
repo:
'https://github.com/jwelker110/cordova-plugin-ios-aswebauthenticationsession-api',
platforms: ['iOS'],
})
@Injectable()
export class IosASWebauthenticationSession extends IonicNativePlugin {
/**
* This function start an authentication flow in ASWebauthenticationSession
* @param callbackUrl {string} Callback URL of your App
* @param authorizeURL {number} Authorization URL
* @return {Promise<string>} Returns a promise that resolves a string containing the redirect URL after finishing ASWebauthenticationSession
*/
@Cordova()
start(
callbackUrl: string,
authorizeURL: string
): Promise<string> {
return;
}
}