From 87644400871a827b1af990fa17eb611e7e488d82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Bu=C3=9Fmann?= Date: Fri, 3 Jan 2020 19:39:48 +0100 Subject: [PATCH] docs(sign-in-with-apple): updated documentation (#3270) --- .../plugins/sign-in-with-apple/index.ts | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/@ionic-native/plugins/sign-in-with-apple/index.ts b/src/@ionic-native/plugins/sign-in-with-apple/index.ts index d26b8b1fb..2c1fd871d 100644 --- a/src/@ionic-native/plugins/sign-in-with-apple/index.ts +++ b/src/@ionic-native/plugins/sign-in-with-apple/index.ts @@ -1,6 +1,16 @@ import { Injectable } from '@angular/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 */ @@ -116,7 +126,7 @@ export interface AppleSignInErrorResponse extends NSError { * * @usage * ```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) { } @@ -124,7 +134,12 @@ export interface AppleSignInErrorResponse extends NSError { * ... * * - * this.signInWithApple.signin() + * this.signInWithApple.signin({ + * requestedScopes: [ + * ASAuthorizationAppleIDRequest.ASAuthorizationScopeFullName, + * ASAuthorizationAppleIDRequest.ASAuthorizationScopeEmail + * ] + * }) * .then((res: AppleSignInResponse) => { * // https://developer.apple.com/documentation/signinwithapplerestapi/verifying_a_user * 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 * @see https://developer.apple.com/documentation/authenticationservices/asauthorizationcontroller/3153047-performrequests * @return {Promise} Returns a promise when authorization succeeds - * @param arg0 + * @param {ASAuthorizationAppleIDRequest} options * @throws AppleSignInErrorResponse */ @Cordova() - signin(arg0: object = null): Promise { + signin(options: ASAuthorizationAppleIDRequest = {}): Promise { return; }