docs(sign-in-with-apple): updated documentation (#3270)

This commit is contained in:
Patrick Bußmann 2020-01-03 19:39:48 +01:00 committed by Daniel Sogl
parent 07b958ac4e
commit 8764440087

View File

@ -1,6 +1,16 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core'; import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
/**
* @see https://developer.apple.com/documentation/authenticationservices/asauthorizationappleidrequest
*/
export class ASAuthorizationAppleIDRequest {
static readonly ASAuthorizationScopeFullName = 0;
static readonly ASAuthorizationScopeEmail = 1;
requestedScopes?: number[];
}
/** /**
* @see https://developer.apple.com/documentation/foundation/nspersonnamecomponents/1412193-phoneticrepresentation * @see https://developer.apple.com/documentation/foundation/nspersonnamecomponents/1412193-phoneticrepresentation
*/ */
@ -116,7 +126,7 @@ export interface AppleSignInErrorResponse extends NSError {
* *
* @usage * @usage
* ```typescript * ```typescript
* import { SignInWithApple, AppleSignInResponse, AppleSignInErrorResponse } from '@ionic-native/sign-in-with-apple/ngx'; * import { SignInWithApple, AppleSignInResponse, AppleSignInErrorResponse, ASAuthorizationAppleIDRequest } from '@ionic-native/sign-in-with-apple/ngx';
* *
* *
* constructor(private signInWithApple: SignInWithApple) { } * constructor(private signInWithApple: SignInWithApple) { }
@ -124,7 +134,12 @@ export interface AppleSignInErrorResponse extends NSError {
* ... * ...
* *
* *
* this.signInWithApple.signin() * this.signInWithApple.signin({
* requestedScopes: [
* ASAuthorizationAppleIDRequest.ASAuthorizationScopeFullName,
* ASAuthorizationAppleIDRequest.ASAuthorizationScopeEmail
* ]
* })
* .then((res: AppleSignInResponse) => { * .then((res: AppleSignInResponse) => {
* // https://developer.apple.com/documentation/signinwithapplerestapi/verifying_a_user * // https://developer.apple.com/documentation/signinwithapplerestapi/verifying_a_user
* alert('Send token to apple for verification: ' + res.identityToken); * alert('Send token to apple for verification: ' + res.identityToken);
@ -151,11 +166,11 @@ export class SignInWithApple extends IonicNativePlugin {
* Starts the authorization flows named during controller initialization * Starts the authorization flows named during controller initialization
* @see https://developer.apple.com/documentation/authenticationservices/asauthorizationcontroller/3153047-performrequests * @see https://developer.apple.com/documentation/authenticationservices/asauthorizationcontroller/3153047-performrequests
* @return {Promise<AppleSignInResponse>} Returns a promise when authorization succeeds * @return {Promise<AppleSignInResponse>} Returns a promise when authorization succeeds
* @param arg0 * @param {ASAuthorizationAppleIDRequest} options
* @throws AppleSignInErrorResponse * @throws AppleSignInErrorResponse
*/ */
@Cordova() @Cordova()
signin(arg0: object = null): Promise<AppleSignInResponse> { signin(options: ASAuthorizationAppleIDRequest = {}): Promise<AppleSignInResponse> {
return; return;
} }