Skip to content

Commit dfb8ddc

Browse files
docs(sign-in-with-apple): updated documentation
1 parent 07b958a commit dfb8ddc

File tree

1 file changed

+19
-4
lines changed
  • src/@ionic-native/plugins/sign-in-with-apple

1 file changed

+19
-4
lines changed

src/@ionic-native/plugins/sign-in-with-apple/index.ts

+19-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
import { Injectable } from '@angular/core';
22
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
33

4+
/**
5+
* @see https://developer.apple.com/documentation/authenticationservices/asauthorizationappleidrequest
6+
*/
7+
export class ASAuthorizationAppleIDRequest {
8+
static readonly ASAuthorizationScopeFullName = 0;
9+
static readonly ASAuthorizationScopeEmail = 1;
10+
11+
requestedScopes?: number[];
12+
}
13+
414
/**
515
* @see https://developer.apple.com/documentation/foundation/nspersonnamecomponents/1412193-phoneticrepresentation
616
*/
@@ -116,15 +126,20 @@ export interface AppleSignInErrorResponse extends NSError {
116126
*
117127
* @usage
118128
* ```typescript
119-
* import { SignInWithApple, AppleSignInResponse, AppleSignInErrorResponse } from '@ionic-native/sign-in-with-apple/ngx';
129+
* import { SignInWithApple, AppleSignInResponse, AppleSignInErrorResponse, ASAuthorizationAppleIDRequest } from '@ionic-native/sign-in-with-apple/ngx';
120130
*
121131
*
122132
* constructor(private signInWithApple: SignInWithApple) { }
123133
*
124134
* ...
125135
*
126136
*
127-
* this.signInWithApple.signin()
137+
* this.signInWithApple.signin({
138+
* requestedScopes: [
139+
* ASAuthorizationAppleIDRequest.ASAuthorizationScopeFullName,
140+
* ASAuthorizationAppleIDRequest.ASAuthorizationScopeEmail
141+
* ]
142+
* })
128143
* .then((res: AppleSignInResponse) => {
129144
* // https://developer.apple.com/documentation/signinwithapplerestapi/verifying_a_user
130145
* alert('Send token to apple for verification: ' + res.identityToken);
@@ -151,11 +166,11 @@ export class SignInWithApple extends IonicNativePlugin {
151166
* Starts the authorization flows named during controller initialization
152167
* @see https://developer.apple.com/documentation/authenticationservices/asauthorizationcontroller/3153047-performrequests
153168
* @return {Promise<AppleSignInResponse>} Returns a promise when authorization succeeds
154-
* @param arg0
169+
* @param {ASAuthorizationAppleIDRequest} options
155170
* @throws AppleSignInErrorResponse
156171
*/
157172
@Cordova()
158-
signin(arg0: object = null): Promise<AppleSignInResponse> {
173+
signin(options: ASAuthorizationAppleIDRequest = {}): Promise<AppleSignInResponse> {
159174
return;
160175
}
161176

0 commit comments

Comments
 (0)