expo-apple-authentication 5.0.0 β†’ 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +1 -1
  3. package/build/AppleAuthentication.d.ts +3 -3
  4. package/build/AppleAuthentication.js +5 -5
  5. package/build/AppleAuthentication.js.map +1 -1
  6. package/build/AppleAuthentication.types.d.ts +5 -5
  7. package/build/AppleAuthentication.types.d.ts.map +1 -1
  8. package/build/AppleAuthenticationButton.d.ts +1 -3
  9. package/build/AppleAuthenticationButton.d.ts.map +1 -1
  10. package/build/AppleAuthenticationButton.js +5 -26
  11. package/build/AppleAuthenticationButton.js.map +1 -1
  12. package/build/ExpoAppleAuthenticationButton.d.ts +2 -10
  13. package/build/ExpoAppleAuthenticationButton.d.ts.map +1 -1
  14. package/build/ExpoAppleAuthenticationButton.js +3 -19
  15. package/build/ExpoAppleAuthenticationButton.js.map +1 -1
  16. package/expo-module.config.json +7 -0
  17. package/ios/AppleAuthenticationButton.swift +59 -0
  18. package/ios/AppleAuthenticationExceptions.swift +67 -0
  19. package/ios/AppleAuthenticationModule.swift +88 -0
  20. package/ios/AppleAuthenticationRequest.swift +89 -0
  21. package/ios/AppleAuthenticationRequestOptions.swift +18 -0
  22. package/ios/AppleAuthenticationUtils.swift +74 -0
  23. package/ios/ButtonStyle.swift +12 -0
  24. package/ios/ButtonType.swift +12 -0
  25. package/ios/{EXAppleAuthentication.podspec β†’ ExpoAppleAuthentication.podspec} +10 -3
  26. package/package.json +5 -4
  27. package/src/AppleAuthentication.ts +5 -5
  28. package/src/AppleAuthenticationButton.tsx +7 -52
  29. package/src/ExpoAppleAuthenticationButton.ts +3 -47
  30. package/ios/EXAppleAuthentication/EXAppleAuthentication.h +0 -12
  31. package/ios/EXAppleAuthentication/EXAppleAuthentication.m +0 -126
  32. package/ios/EXAppleAuthentication/EXAppleAuthenticationButton.h +0 -12
  33. package/ios/EXAppleAuthentication/EXAppleAuthenticationButton.m +0 -23
  34. package/ios/EXAppleAuthentication/EXAppleAuthenticationButtonViewManagers.m +0 -93
  35. package/ios/EXAppleAuthentication/EXAppleAuthenticationMappings.h +0 -23
  36. package/ios/EXAppleAuthentication/EXAppleAuthenticationMappings.m +0 -94
  37. package/ios/EXAppleAuthentication/EXAppleAuthenticationRequest.h +0 -22
  38. package/ios/EXAppleAuthentication/EXAppleAuthenticationRequest.m +0 -116
  39. package/unimodule.json +0 -4
package/CHANGELOG.md CHANGED
@@ -10,6 +10,17 @@
10
10
 
11
11
  ### πŸ’‘ Others
12
12
 
13
+ ## 6.0.0 β€” 2023-02-03
14
+
15
+ ### πŸŽ‰ New features
16
+
17
+ - Migrated to Expo Modules API and Swift. ([#20600](https://github.com/expo/expo/pull/20600) by [@tsapeta](https://github.com/tsapeta))
18
+ - Added support for Fabric. ([#20600](https://github.com/expo/expo/pull/20600) by [@tsapeta](https://github.com/tsapeta))
19
+
20
+ ## 5.0.1 β€” 2022-10-28
21
+
22
+ _This version does not introduce any user-facing changes._
23
+
13
24
  ## 5.0.0 β€” 2022-10-25
14
25
 
15
26
  ### πŸ›  Breaking changes
package/README.md CHANGED
@@ -4,7 +4,7 @@ This library provides Apple authentication for iOS standalone apps in the manage
4
4
 
5
5
  # API documentation
6
6
 
7
- - [Documentation for the main branch](https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/apple-authentication.md)
7
+ - [Documentation for the main branch](https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/apple-authentication.mdx)
8
8
  - [Documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/apple-authentication/)
9
9
 
10
10
  # Installation in managed Expo projects
@@ -21,7 +21,7 @@ export declare function isAvailableAsync(): Promise<boolean>;
21
21
  *
22
22
  * @param options An optional [`AppleAuthenticationSignInOptions`](#appleauthenticationsigninoptions) object
23
23
  * @return A promise that fulfills with an [`AppleAuthenticationCredential`](#appleauthenticationcredential)
24
- * object after a successful authentication, and rejects with `ERR_CANCELED` if the user cancels the
24
+ * object after a successful authentication, and rejects with `ERR_REQUEST_CANCELED` if the user cancels the
25
25
  * sign-in operation.
26
26
  */
27
27
  export declare function signInAsync(options?: AppleAuthenticationSignInOptions): Promise<AppleAuthenticationCredential>;
@@ -31,7 +31,7 @@ export declare function signInAsync(options?: AppleAuthenticationSignInOptions):
31
31
  *
32
32
  * @param options An [`AppleAuthenticationRefreshOptions`](#appleauthenticationrefreshoptions) object
33
33
  * @returns A promise that fulfills with an [`AppleAuthenticationCredential`](#appleauthenticationcredential)
34
- * object after a successful authentication, and rejects with `ERR_CANCELED` if the user cancels the
34
+ * object after a successful authentication, and rejects with `ERR_REQUEST_CANCELED` if the user cancels the
35
35
  * refresh operation.
36
36
  */
37
37
  export declare function refreshAsync(options: AppleAuthenticationRefreshOptions): Promise<AppleAuthenticationCredential>;
@@ -45,7 +45,7 @@ export declare function refreshAsync(options: AppleAuthenticationRefreshOptions)
45
45
  *
46
46
  * @param options An [`AppleAuthenticationSignOutOptions`](#appleauthenticationsignoutoptions) object
47
47
  * @returns A promise that fulfills with an [`AppleAuthenticationCredential`](#appleauthenticationcredential)
48
- * object after a successful authentication, and rejects with `ERR_CANCELED` if the user cancels the
48
+ * object after a successful authentication, and rejects with `ERR_REQUEST_CANCELED` if the user cancels the
49
49
  * sign-out operation.
50
50
  */
51
51
  export declare function signOutAsync(options: AppleAuthenticationSignOutOptions): Promise<AppleAuthenticationCredential>;
@@ -29,7 +29,7 @@ export async function isAvailableAsync() {
29
29
  *
30
30
  * @param options An optional [`AppleAuthenticationSignInOptions`](#appleauthenticationsigninoptions) object
31
31
  * @return A promise that fulfills with an [`AppleAuthenticationCredential`](#appleauthenticationcredential)
32
- * object after a successful authentication, and rejects with `ERR_CANCELED` if the user cancels the
32
+ * object after a successful authentication, and rejects with `ERR_REQUEST_CANCELED` if the user cancels the
33
33
  * sign-in operation.
34
34
  */
35
35
  export async function signInAsync(options) {
@@ -42,7 +42,7 @@ export async function signInAsync(options) {
42
42
  };
43
43
  const credential = await ExpoAppleAuthentication.requestAsync(requestOptions);
44
44
  if (!credential.authorizationCode || !credential.identityToken || !credential.user) {
45
- throw new CodedError('ERR_APPLE_AUTHENTICATION_REQUEST_FAILED', 'The credential returned by `signInAsync` is missing one or more required fields.');
45
+ throw new CodedError('ERR_REQUEST_FAILED', 'The credential returned by `signInAsync` is missing one or more required fields.');
46
46
  }
47
47
  return credential;
48
48
  }
@@ -53,7 +53,7 @@ export async function signInAsync(options) {
53
53
  *
54
54
  * @param options An [`AppleAuthenticationRefreshOptions`](#appleauthenticationrefreshoptions) object
55
55
  * @returns A promise that fulfills with an [`AppleAuthenticationCredential`](#appleauthenticationcredential)
56
- * object after a successful authentication, and rejects with `ERR_CANCELED` if the user cancels the
56
+ * object after a successful authentication, and rejects with `ERR_REQUEST_CANCELED` if the user cancels the
57
57
  * refresh operation.
58
58
  */
59
59
  export async function refreshAsync(options) {
@@ -66,7 +66,7 @@ export async function refreshAsync(options) {
66
66
  };
67
67
  const credential = await ExpoAppleAuthentication.requestAsync(requestOptions);
68
68
  if (!credential.authorizationCode || !credential.identityToken || !credential.user) {
69
- throw new CodedError('ERR_APPLE_AUTHENTICATION_REQUEST_FAILED', 'The credential returned by `refreshAsync` is missing one or more required fields.');
69
+ throw new CodedError('ERR_REQUEST_FAILED', 'The credential returned by `refreshAsync` is missing one or more required fields.');
70
70
  }
71
71
  return credential;
72
72
  }
@@ -81,7 +81,7 @@ export async function refreshAsync(options) {
81
81
  *
82
82
  * @param options An [`AppleAuthenticationSignOutOptions`](#appleauthenticationsignoutoptions) object
83
83
  * @returns A promise that fulfills with an [`AppleAuthenticationCredential`](#appleauthenticationcredential)
84
- * object after a successful authentication, and rejects with `ERR_CANCELED` if the user cancels the
84
+ * object after a successful authentication, and rejects with `ERR_REQUEST_CANCELED` if the user cancels the
85
85
  * sign-out operation.
86
86
  */
87
87
  export async function signOutAsync(options) {
@@ -1 +1 @@
1
- {"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AO,mCAAmC,CAAC,WAAW,CAAC,+BAA+B,EAAE,QAAQ,CAAC,CAAC;AACpG,CAAC","sourcesContent":["import { CodedError, EventEmitter, Subscription, UnavailabilityError } from 'expo-modules-core';\n\nimport {\n AppleAuthenticationCredential,\n AppleAuthenticationCredentialState,\n AppleAuthenticationOperation,\n AppleAuthenticationRefreshOptions,\n AppleAuthenticationSignInOptions,\n AppleAuthenticationSignOutOptions,\n} from './AppleAuthentication.types';\nimport ExpoAppleAuthentication from './ExpoAppleAuthentication';\n\n// @needsAudit\n/**\n * Determine if the current device's operating system supports Apple authentication.\n * @return A promise that fulfills with `true` if the system supports Apple authentication, and `false` otherwise.\n */\nexport async function isAvailableAsync(): Promise<boolean> {\n if (!ExpoAppleAuthentication || !ExpoAppleAuthentication.isAvailableAsync) {\n return false;\n }\n return ExpoAppleAuthentication.isAvailableAsync();\n}\n\n// @needsAudit\n/**\n * Sends a request to the operating system to initiate the Apple authentication flow, which will\n * present a modal to the user over your app and allow them to sign in.\n *\n * You can request access to the user's full name and email address in this method, which allows you\n * to personalize your UI for signed in users. However, users can deny access to either or both\n * of these options at runtime.\n *\n * Additionally, you will only receive Apple Authentication Credentials the first time users sign\n * into your app, so you must store it for later use. It's best to store this information either\n * server-side, or using [SecureStore](./securestore), so that the data persists across app installs.\n * You can use [`AppleAuthenticationCredential.user`](#appleauthenticationcredential) to identify\n * the user, since this remains the same for apps released by the same developer.\n *\n * @param options An optional [`AppleAuthenticationSignInOptions`](#appleauthenticationsigninoptions) object\n * @return A promise that fulfills with an [`AppleAuthenticationCredential`](#appleauthenticationcredential)\n * object after a successful authentication, and rejects with `ERR_CANCELED` if the user cancels the\n * sign-in operation.\n */\nexport async function signInAsync(\n options?: AppleAuthenticationSignInOptions\n): Promise<AppleAuthenticationCredential> {\n if (!ExpoAppleAuthentication || !ExpoAppleAuthentication.requestAsync) {\n throw new UnavailabilityError('expo-apple-authentication', 'signInAsync');\n }\n const requestOptions = {\n ...options,\n requestedOperation: AppleAuthenticationOperation.LOGIN,\n };\n const credential = await ExpoAppleAuthentication.requestAsync(requestOptions);\n if (!credential.authorizationCode || !credential.identityToken || !credential.user) {\n throw new CodedError(\n 'ERR_APPLE_AUTHENTICATION_REQUEST_FAILED',\n 'The credential returned by `signInAsync` is missing one or more required fields.'\n );\n }\n return credential;\n}\n\n// @needsAudit\n/**\n * An operation that refreshes the logged-in user’s credentials.\n * Calling this method will show the sign in modal before actually refreshing the user credentials.\n *\n * @param options An [`AppleAuthenticationRefreshOptions`](#appleauthenticationrefreshoptions) object\n * @returns A promise that fulfills with an [`AppleAuthenticationCredential`](#appleauthenticationcredential)\n * object after a successful authentication, and rejects with `ERR_CANCELED` if the user cancels the\n * refresh operation.\n */\nexport async function refreshAsync(\n options: AppleAuthenticationRefreshOptions\n): Promise<AppleAuthenticationCredential> {\n if (!ExpoAppleAuthentication || !ExpoAppleAuthentication.requestAsync) {\n throw new UnavailabilityError('expo-apple-authentication', 'refreshAsync');\n }\n const requestOptions = {\n ...options,\n requestedOperation: AppleAuthenticationOperation.REFRESH,\n };\n const credential = await ExpoAppleAuthentication.requestAsync(requestOptions);\n if (!credential.authorizationCode || !credential.identityToken || !credential.user) {\n throw new CodedError(\n 'ERR_APPLE_AUTHENTICATION_REQUEST_FAILED',\n 'The credential returned by `refreshAsync` is missing one or more required fields.'\n );\n }\n return credential;\n}\n\n// @needsAudit\n/**\n * An operation that ends the authenticated session.\n * Calling this method will show the sign in modal before actually signing the user out.\n *\n * It is not recommended to use this method to sign out the user as it works counterintuitively.\n * Instead of using this method it is recommended to simply clear all the user's data collected\n * from using [`signInAsync`](./#signinasync) or [`refreshAsync`](./#refreshasync) methods.\n *\n * @param options An [`AppleAuthenticationSignOutOptions`](#appleauthenticationsignoutoptions) object\n * @returns A promise that fulfills with an [`AppleAuthenticationCredential`](#appleauthenticationcredential)\n * object after a successful authentication, and rejects with `ERR_CANCELED` if the user cancels the\n * sign-out operation.\n */\nexport async function signOutAsync(\n options: AppleAuthenticationSignOutOptions\n): Promise<AppleAuthenticationCredential> {\n if (!ExpoAppleAuthentication || !ExpoAppleAuthentication.requestAsync) {\n throw new UnavailabilityError('expo-apple-authentication', 'signOutAsync');\n }\n const requestOptions = {\n ...options,\n requestedOperation: AppleAuthenticationOperation.LOGOUT,\n };\n return ExpoAppleAuthentication.requestAsync(requestOptions);\n}\n\n// @needsAudit\n/**\n * Queries the current state of a user credential, to determine if it is still valid or if it has been revoked.\n * > **Note:** This method must be tested on a real device. On the iOS simulator it always throws an error.\n *\n * @param user The unique identifier for the user whose credential state you'd like to check.\n * This should come from the user field of an [`AppleAuthenticationCredential`](#appleauthenticationcredentialstate) object.\n * @return A promise that fulfills with an [`AppleAuthenticationCredentialState`](#appleauthenticationcredentialstate)\n * value depending on the state of the credential.\n */\nexport async function getCredentialStateAsync(\n user: string\n): Promise<AppleAuthenticationCredentialState> {\n if (!ExpoAppleAuthentication || !ExpoAppleAuthentication.getCredentialStateAsync) {\n throw new UnavailabilityError('expo-apple-authentication', 'getCredentialStateAsync');\n }\n return ExpoAppleAuthentication.getCredentialStateAsync(user);\n}\n\nconst ExpoAppleAuthenticationEventEmitter = new EventEmitter(ExpoAppleAuthentication);\n\n// @docsMissing\nexport function addRevokeListener(listener: () => void): Subscription {\n return ExpoAppleAuthenticationEventEmitter.addListener('Expo.appleIdCredentialRevoked', listener);\n}\n\nexport { Subscription };\n"]}
1
+ {"version":3,"file":"AppleAuthentication.js","sourceRoot":"","sources":["../src/AppleAuthentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAgB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEhG,OAAO,EAGL,4BAA4B,GAI7B,MAAM,6BAA6B,CAAC;AACrC,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAEhE,cAAc;AACd;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,IAAI,CAAC,uBAAuB,IAAI,CAAC,uBAAuB,CAAC,g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B,EACpB,mFAAmF,CACpF,CAAC;KACH;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,cAAc;AACd;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAA0C;IAE1C,IAAI,CAAC,uBAAuB,IAAI,CAAC,uBAAuB,CAAC,YAAY,EAAE;QACrE,MAAM,IAAI,mBAAmB,CAAC,2BAA2B,EAAE,cAAc,CAAC,CAAC;KAC5E;IACD,MAAM,cAAc,GAAG;QACrB,GAAG,OAAO;QACV,kBAAkB,EAAE,4BAA4B,CAAC,MAAM;KACxD,CAAC;IACF,OAAO,uBAAuB,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;AAC9D,CAAC;AAED,cAAc;AACd;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,IAAY;IAEZ,IAAI,CAAC,uBAAuB,IAAI,CAAC,uBAAuB,CAAC,uBAAuB,EAAE;QAChF,MAAM,IAAI,mBAAmB,CAAC,2BAA2B,EAAE,yBAAyB,CAAC,CAAC;KACvF;IACD,OAAO,uBAAuB,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,mCAAmC,GAAG,IAAI,YAAY,CAAC,uBAAuB,CAAC,CAAC;AAEtF,eAAe;AACf,MAAM,UAAU,iBAAiB,CAAC,QAAoB;IACpD,OAAO,mCAAmC,CAAC,WAAW,CAAC,+BAA+B,EAAE,QAAQ,CAAC,CAAC;AACpG,CAAC","sourcesContent":["import { CodedError, EventEmitter, Subscription, UnavailabilityError } from 'expo-modules-core';\n\nimport {\n AppleAuthenticationCredential,\n AppleAuthenticationCredentialState,\n AppleAuthenticationOperation,\n AppleAuthenticationRefreshOptions,\n AppleAuthenticationSignInOptions,\n AppleAuthenticationSignOutOptions,\n} from './AppleAuthentication.types';\nimport ExpoAppleAuthentication from './ExpoAppleAuthentication';\n\n// @needsAudit\n/**\n * Determine if the current device's operating system supports Apple authentication.\n * @return A promise that fulfills with `true` if the system supports Apple authentication, and `false` otherwise.\n */\nexport async function isAvailableAsync(): Promise<boolean> {\n if (!ExpoAppleAuthentication || !ExpoAppleAuthentication.isAvailableAsync) {\n return false;\n }\n return ExpoAppleAuthentication.isAvailableAsync();\n}\n\n// @needsAudit\n/**\n * Sends a request to the operating system to initiate the Apple authentication flow, which will\n * present a modal to the user over your app and allow them to sign in.\n *\n * You can request access to the user's full name and email address in this method, which allows you\n * to personalize your UI for signed in users. However, users can deny access to either or both\n * of these options at runtime.\n *\n * Additionally, you will only receive Apple Authentication Credentials the first time users sign\n * into your app, so you must store it for later use. It's best to store this information either\n * server-side, or using [SecureStore](./securestore), so that the data persists across app installs.\n * You can use [`AppleAuthenticationCredential.user`](#appleauthenticationcredential) to identify\n * the user, since this remains the same for apps released by the same developer.\n *\n * @param options An optional [`AppleAuthenticationSignInOptions`](#appleauthenticationsigninoptions) object\n * @return A promise that fulfills with an [`AppleAuthenticationCredential`](#appleauthenticationcredential)\n * object after a successful authentication, and rejects with `ERR_REQUEST_CANCELED` if the user cancels the\n * sign-in operation.\n */\nexport async function signInAsync(\n options?: AppleAuthenticationSignInOptions\n): Promise<AppleAuthenticationCredential> {\n if (!ExpoAppleAuthentication || !ExpoAppleAuthentication.requestAsync) {\n throw new UnavailabilityError('expo-apple-authentication', 'signInAsync');\n }\n const requestOptions = {\n ...options,\n requestedOperation: AppleAuthenticationOperation.LOGIN,\n };\n const credential = await ExpoAppleAuthentication.requestAsync(requestOptions);\n if (!credential.authorizationCode || !credential.identityToken || !credential.user) {\n throw new CodedError(\n 'ERR_REQUEST_FAILED',\n 'The credential returned by `signInAsync` is missing one or more required fields.'\n );\n }\n return credential;\n}\n\n// @needsAudit\n/**\n * An operation that refreshes the logged-in user’s credentials.\n * Calling this method will show the sign in modal before actually refreshing the user credentials.\n *\n * @param options An [`AppleAuthenticationRefreshOptions`](#appleauthenticationrefreshoptions) object\n * @returns A promise that fulfills with an [`AppleAuthenticationCredential`](#appleauthenticationcredential)\n * object after a successful authentication, and rejects with `ERR_REQUEST_CANCELED` if the user cancels the\n * refresh operation.\n */\nexport async function refreshAsync(\n options: AppleAuthenticationRefreshOptions\n): Promise<AppleAuthenticationCredential> {\n if (!ExpoAppleAuthentication || !ExpoAppleAuthentication.requestAsync) {\n throw new UnavailabilityError('expo-apple-authentication', 'refreshAsync');\n }\n const requestOptions = {\n ...options,\n requestedOperation: AppleAuthenticationOperation.REFRESH,\n };\n const credential = await ExpoAppleAuthentication.requestAsync(requestOptions);\n if (!credential.authorizationCode || !credential.identityToken || !credential.user) {\n throw new CodedError(\n 'ERR_REQUEST_FAILED',\n 'The credential returned by `refreshAsync` is missing one or more required fields.'\n );\n }\n return credential;\n}\n\n// @needsAudit\n/**\n * An operation that ends the authenticated session.\n * Calling this method will show the sign in modal before actually signing the user out.\n *\n * It is not recommended to use this method to sign out the user as it works counterintuitively.\n * Instead of using this method it is recommended to simply clear all the user's data collected\n * from using [`signInAsync`](./#signinasync) or [`refreshAsync`](./#refreshasync) methods.\n *\n * @param options An [`AppleAuthenticationSignOutOptions`](#appleauthenticationsignoutoptions) object\n * @returns A promise that fulfills with an [`AppleAuthenticationCredential`](#appleauthenticationcredential)\n * object after a successful authentication, and rejects with `ERR_REQUEST_CANCELED` if the user cancels the\n * sign-out operation.\n */\nexport async function signOutAsync(\n options: AppleAuthenticationSignOutOptions\n): Promise<AppleAuthenticationCredential> {\n if (!ExpoAppleAuthentication || !ExpoAppleAuthentication.requestAsync) {\n throw new UnavailabilityError('expo-apple-authentication', 'signOutAsync');\n }\n const requestOptions = {\n ...options,\n requestedOperation: AppleAuthenticationOperation.LOGOUT,\n };\n return ExpoAppleAuthentication.requestAsync(requestOptions);\n}\n\n// @needsAudit\n/**\n * Queries the current state of a user credential, to determine if it is still valid or if it has been revoked.\n * > **Note:** This method must be tested on a real device. On the iOS simulator it always throws an error.\n *\n * @param user The unique identifier for the user whose credential state you'd like to check.\n * This should come from the user field of an [`AppleAuthenticationCredential`](#appleauthenticationcredentialstate) object.\n * @return A promise that fulfills with an [`AppleAuthenticationCredentialState`](#appleauthenticationcredentialstate)\n * value depending on the state of the credential.\n */\nexport async function getCredentialStateAsync(\n user: string\n): Promise<AppleAuthenticationCredentialState> {\n if (!ExpoAppleAuthentication || !ExpoAppleAuthentication.getCredentialStateAsync) {\n throw new UnavailabilityError('expo-apple-authentication', 'getCredentialStateAsync');\n }\n return ExpoAppleAuthentication.getCredentialStateAsync(user);\n}\n\nconst ExpoAppleAuthenticationEventEmitter = new EventEmitter(ExpoAppleAuthentication);\n\n// @docsMissing\nexport function addRevokeListener(listener: () => void): Subscription {\n return ExpoAppleAuthenticationEventEmitter.addListener('Expo.appleIdCredentialRevoked', listener);\n}\n\nexport { Subscription };\n"]}
@@ -32,7 +32,7 @@ export declare type AppleAuthenticationButtonProps = ViewProps & {
32
32
  * Documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationopenidrequest)
33
33
  * for more details.
34
34
  */
35
- export declare type AppleAuthenticationSignInOptions = {
35
+ export type AppleAuthenticationSignInOptions = {
36
36
  /**
37
37
  * Array of user information scopes to which your app is requesting access. Note that the user can
38
38
  * choose to deny your app access to any scope at the time of logging in. You will still need to
@@ -62,7 +62,7 @@ export declare type AppleAuthenticationSignInOptions = {
62
62
  * Documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationopenidrequest)
63
63
  * for more details.
64
64
  */
65
- export declare type AppleAuthenticationRefreshOptions = {
65
+ export type AppleAuthenticationRefreshOptions = {
66
66
  user: string;
67
67
  /**
68
68
  * Array of user information scopes to which your app is requesting access. Note that the user can
@@ -88,7 +88,7 @@ export declare type AppleAuthenticationRefreshOptions = {
88
88
  * Documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationopenidrequest)
89
89
  * for more details.
90
90
  */
91
- export declare type AppleAuthenticationSignOutOptions = {
91
+ export type AppleAuthenticationSignOutOptions = {
92
92
  user: string;
93
93
  /**
94
94
  * An arbitrary string that is returned unmodified in the corresponding credential after a
@@ -107,7 +107,7 @@ export declare type AppleAuthenticationSignOutOptions = {
107
107
  * Documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationappleidcredential)
108
108
  * for more details.
109
109
  */
110
- export declare type AppleAuthenticationCredential = {
110
+ export type AppleAuthenticationCredential = {
111
111
  /**
112
112
  * An identifier associated with the authenticated user. You can use this to check if the user is
113
113
  * still authenticated later. This is stable and can be shared across apps released under the same
@@ -153,7 +153,7 @@ export declare type AppleAuthenticationCredential = {
153
153
  * An object representing the tokenized portions of the user's full name. Any of all of the fields
154
154
  * may be `null`. Only applicable fields that the user has allowed your app to access will be nonnull.
155
155
  */
156
- export declare type AppleAuthenticationFullName = {
156
+ export type AppleAuthenticationFullName = {
157
157
  namePrefix: string | null;
158
158
  givenName: string | null;
159
159
  middleName: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"AppleAuthentication.types.d.ts","sourceRoot":"","sources":["../src/AppleAuthentication.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG/D,MAAM,CAAC,OAAO,MAAM,8BAA8B,GAAG,SAAS,GAAG;IAC/D;;;OAGG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB;;OAEG;IACH,UAAU,EAAE,6BAA6B,CAAC;IAC1C;;OAEG;IACH,WAAW,EAAE,8BAA8B,CAAC;IAC5C;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,GAAG,cAAc,CAAC,CAAC,CAAC;CACxE,CAAC;AAGF;;;;;;;GAOG;AACH,oBAAY,gCAAgC,GAAG;IAC7C;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,wBAAwB,EAAE,CAAC;IAE7C;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG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oBAAY,4BAA4B;IACtC;;OAEG;IACH,QAAQ,IAAI;IACZ,KAAK,IAAI;IACT,OAAO,IAAI;IACX,MAAM,IAAI;CACX;AAGD;;;;;;GAMG;AACH,oBAAY,kCAAkC;IAC5C,OAAO,IAAI;IACX,UAAU,IAAI;IACd,SAAS,IAAI;IACb,WAAW,IAAI;CAChB;AAGD;;;;;;GAMG;AACH,oBAAY,sCAAsC;IAChD;;OAEG;IACH,WAAW,IAAI;IACf;;OAEG;IACH,OAAO,IAAI;IACX;;OAEG;IACH,WAAW,IAAI;CAChB;AAGD;;GAEG;AACH,oBAAY,6BAA6B;IACvC;;OAEG;IACH,OAAO,IAAI;IACX;;OAEG;IACH,QAAQ,IAAI;IACZ;;;OAGG;IACH,OAAO,IAAI;CACZ;AAGD;;GAEG;AACH,oBAAY,8BAA8B;IACxC;;OAEG;IACH,KAAK,IAAI;IACT;;OAEG;IACH,aAAa,IAAI;IACjB;;OAEG;IACH,KAAK,IAAI;CACV"}
1
+ {"version":3,"file":"AppleAuthentication.types.d.ts","sourceRoot":"","sources":["../src/AppleAuthentication.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG/D,MAAM,CAAC,OAAO,MAAM,8BAA8B,GAAG,SAAS,GAAG;IAC/D;;;OAGG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB;;OAEG;IACH,UAAU,EAAE,6BAA6B,CAAC;IAC1C;;OAEG;IACH,WAAW,EAAE,8BAA8B,CAAC;IAC5C;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,GAAG,cAAc,CAAC,CAAC,CAAC;CACxE,CAAC;AAGF;;;;;;;GAOG;AACH,MAAM,MAAM,gCAAgC,GAAG;IAC7C;;;;;;OAMG;IACH,eAAe,CAAC,EA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AAI,CAAC;CACzB,CAAC;AAGF;;;;;;;;;GASG;AACH,oBAAY,wBAAwB;IAClC,SAAS,IAAI;IACb,KAAK,IAAI;CACV;AAGD,oBAAY,4BAA4B;IACtC;;OAEG;IACH,QAAQ,IAAI;IACZ,KAAK,IAAI;IACT,OAAO,IAAI;IACX,MAAM,IAAI;CACX;AAGD;;;;;;GAMG;AACH,oBAAY,kCAAkC;IAC5C,OAAO,IAAI;IACX,UAAU,IAAI;IACd,SAAS,IAAI;IACb,WAAW,IAAI;CAChB;AAGD;;;;;;GAMG;AACH,oBAAY,sCAAsC;IAChD;;OAEG;IACH,WAAW,IAAI;IACf;;OAEG;IACH,OAAO,IAAI;IACX;;OAEG;IACH,WAAW,IAAI;CAChB;AAGD;;GAEG;AACH,oBAAY,6BAA6B;IACvC;;OAEG;IACH,OAAO,IAAI;IACX;;OAEG;IACH,QAAQ,IAAI;IACZ;;;OAGG;IACH,OAAO,IAAI;CACZ;AAGD;;GAEG;AACH,oBAAY,8BAA8B;IACxC;;OAEG;IACH,KAAK,IAAI;IACT;;OAEG;IACH,aAAa,IAAI;IACjB;;OAEG;IACH,KAAK,IAAI;CACV"}
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import { AppleAuthenticationButtonProps } from './AppleAuthentication.types';
3
2
  /**
4
3
  * This component displays the proprietary "Sign In with Apple" / "Continue with Apple" button on
@@ -23,6 +22,5 @@ import { AppleAuthenticationButtonProps } from './AppleAuthentication.types';
23
22
  * Documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationappleidbutton)
24
23
  * for more details.
25
24
  */
26
- declare const AppleAuthenticationButton: React.FC<AppleAuthenticationButtonProps>;
27
- export default AppleAuthenticationButton;
25
+ export default function AppleAuthenticationButton({ onPress, ...restProps }: AppleAuthenticationButtonProps): JSX.Element | null;
28
26
  //# sourceMappingURL=AppleAuthenticationButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppleAuthenticationButton.d.ts","sourceRoot":"","sources":["../src/AppleAuthenticationButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EACL,8BAA8B,EAG/B,MAAM,6BAA6B,CAAC;AAcrC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,QAAA,MAAM,yBAAyB,EAAE,KAAK,CAAC,EAAE,CAAC,8BAA8B,CAgBvE,CAAC;AA0BF,eAAe,yBAAyB,CAAC"}
1
+ {"version":3,"file":"AppleAuthenticationButton.d.ts","sourceRoot":"","sources":["../src/AppleAuthenticationButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAI7E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,EAChD,OAAO,EACP,GAAG,SAAS,EACb,EAAE,8BAA8B,sBAQhC"}
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
- import { AppleAuthenticationButtonStyle, AppleAuthenticationButtonType, } from './AppleAuthentication.types';
3
- import { ExpoAppleAuthenticationButtonSignInWhite, ExpoAppleAuthenticationButtonSignInWhiteOutline, ExpoAppleAuthenticationButtonSignInBlack, ExpoAppleAuthenticationButtonContinueWhite, ExpoAppleAuthenticationButtonContinueWhiteOutline, ExpoAppleAuthenticationButtonContinueBlack, ExpoAppleAuthenticationButtonSignUpWhite, ExpoAppleAuthenticationButtonSignUpWhiteOutline, ExpoAppleAuthenticationButtonSignUpBlack, } from './ExpoAppleAuthenticationButton';
2
+ import ExpoAppleAuthenticationButton from './ExpoAppleAuthenticationButton';
4
3
  // @needsAudit
5
4
  /**
6
5
  * This component displays the proprietary "Sign In with Apple" / "Continue with Apple" button on
@@ -25,33 +24,13 @@ import { ExpoAppleAuthenticationButtonSignInWhite, ExpoAppleAuthenticationButton
25
24
  * Documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationappleidbutton)
26
25
  * for more details.
27
26
  */
28
- const AppleAuthenticationButton = ({ onPress, buttonStyle, buttonType, ...restProps }) => {
29
- if (!ExpoAppleAuthenticationButtonSignInWhite) {
27
+ export default function AppleAuthenticationButton({ onPress, ...restProps }) {
28
+ if (!ExpoAppleAuthenticationButton) {
30
29
  if (__DEV__) {
31
30
  console.warn("'AppleAuthenticationButton' is not available.");
32
31
  }
33
32
  return null;
34
33
  }
35
- const AppleAuthenticationButtonComponent = selectButtonComponent(buttonType, buttonStyle);
36
- return React.createElement(AppleAuthenticationButtonComponent, { onButtonPress: onPress, ...restProps });
37
- };
38
- const ButtonComponents = {
39
- [AppleAuthenticationButtonType.SIGN_IN]: {
40
- [AppleAuthenticationButtonStyle.WHITE]: ExpoAppleAuthenticationButtonSignInWhite,
41
- [AppleAuthenticationButtonStyle.WHITE_OUTLINE]: ExpoAppleAuthenticationButtonSignInWhiteOutline,
42
- [AppleAuthenticationButtonStyle.BLACK]: ExpoAppleAuthenticationButtonSignInBlack,
43
- },
44
- [AppleAuthenticationButtonType.CONTINUE]: {
45
- [AppleAuthenticationButtonStyle.WHITE]: ExpoAppleAuthenticationButtonContinueWhite,
46
- [AppleAuthenticationButtonStyle.WHITE_OUTLINE]: ExpoAppleAuthenticationButtonContinueWhiteOutline,
47
- [AppleAuthenticationButtonStyle.BLACK]: ExpoAppleAuthenticationButtonContinueBlack,
48
- },
49
- [AppleAuthenticationButtonType.SIGN_UP]: {
50
- [AppleAuthenticationButtonStyle.WHITE]: ExpoAppleAuthenticationButtonSignUpWhite,
51
- [AppleAuthenticationButtonStyle.WHITE_OUTLINE]: ExpoAppleAuthenticationButtonSignUpWhiteOutline,
52
- [AppleAuthenticationButtonStyle.BLACK]: ExpoAppleAuthenticationButtonSignUpBlack,
53
- },
54
- };
55
- const selectButtonComponent = (type, style) => ButtonComponents[type][style];
56
- export default AppleAuthenticationButton;
34
+ return React.createElement(ExpoAppleAuthenticationButton, { onButtonPress: onPress, ...restProps });
35
+ }
57
36
  //# sourceMappingURL=AppleAuthenticationButton.js.map
@@ -1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8BAA8B,CAAC,KAAK,CAAC,EAAE,0CAA0C;KACnF;IACD,CAAC,6BAA6B,CAAC,OAAO,CAAC,EAAE;QACvC,CAAC,8BAA8B,CAAC,KAAK,CAAC,EAAE,wCAAwC;QAChF,CAAC,8BAA8B,CAAC,aAAa,CAAC,EAAE,+CAA+C;QAC/F,CAAC,8BAA8B,CAAC,KAAK,CAAC,EAAE,wCAAwC;KACjF;CACF,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAC5B,IAAmC,EACnC,KAAqC,EAClB,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC;AAEtD,eAAe,yBAAyB,CAAC","sourcesContent":["import React from 'react';\n\nimport {\n AppleAuthenticationButtonProps,\n AppleAuthenticationButtonStyle,\n AppleAuthenticationButtonType,\n} from './AppleAuthentication.types';\nimport {\n ExpoAppleAuthenticationButtonSignInWhite,\n ExpoAppleAuthenticationButtonSignInWhiteOutline,\n ExpoAppleAuthenticationButtonSignInBlack,\n ExpoAppleAuthenticationButtonContinueWhite,\n ExpoAppleAuthenticationButtonContinueWhiteOutline,\n ExpoAppleAuthenticationButtonContinueBlack,\n ExpoAppleAuthenticationButtonSignUpWhite,\n ExpoAppleAuthenticationButtonSignUpWhiteOutline,\n ExpoAppleAuthenticationButtonSignUpBlack,\n} from './ExpoAppleAuthenticationButton';\n\n// @needsAudit\n/**\n * This component displays the proprietary \"Sign In with Apple\" / \"Continue with Apple\" button on\n * your screen. The App Store Guidelines require you to use this component to start the\n * authentication process instead of a custom button. Limited customization of the button is\n * available via the provided properties.\n *\n * You should only attempt to render this if [`AppleAuthentication.isAvailableAsync()`](#isavailableasync)\n * resolves to `true`. This component will render nothing if it is not available, and you will get\n * a warning in development mode (`__DEV__ === true`).\n *\n * The properties of this component extend from `View`; however, you should not attempt to set\n * `backgroundColor` or `borderRadius` with the `style` property. This will not work and is against\n * the App Store Guidelines. Instead, you should use the `buttonStyle` property to choose one of the\n * predefined color styles and the `cornerRadius` property to change the border radius of the\n * button.\n *\n * Make sure to attach height and width via the style props as without these styles, the button will\n * not appear on the screen.\n *\n * @see [Apple\n * Documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationappleidbutton)\n * for more details.\n */\nconst AppleAuthenticationButton: React.FC<AppleAuthenticationButtonProps> = ({\n onPress,\n buttonStyle,\n buttonType,\n ...restProps\n}) => {\n if (!ExpoAppleAuthenticationButtonSignInWhite) {\n if (__DEV__) {\n console.warn(\"'AppleAuthenticationButton' is not available.\");\n }\n return null;\n }\n\n const AppleAuthenticationButtonComponent = selectButtonComponent(buttonType, buttonStyle);\n\n return <AppleAuthenticationButtonComponent onButtonPress={onPress} {...restProps} />;\n};\n\nconst ButtonComponents: { [type: number]: { [style: number]: React.ElementType } } = {\n [AppleAuthenticationButtonType.SIGN_IN]: {\n [AppleAuthenticationButtonStyle.WHITE]: ExpoAppleAuthenticationButtonSignInWhite,\n [AppleAuthenticationButtonStyle.WHITE_OUTLINE]: ExpoAppleAuthenticationButtonSignInWhiteOutline,\n [AppleAuthenticationButtonStyle.BLACK]: ExpoAppleAuthenticationButtonSignInBlack,\n },\n [AppleAuthenticationButtonType.CONTINUE]: {\n [AppleAuthenticationButtonStyle.WHITE]: ExpoAppleAuthenticationButtonContinueWhite,\n [AppleAuthenticationButtonStyle.WHITE_OUTLINE]:\n ExpoAppleAuthenticationButtonContinueWhiteOutline,\n [AppleAuthenticationButtonStyle.BLACK]: ExpoAppleAuthenticationButtonContinueBlack,\n },\n [AppleAuthenticationButtonType.SIGN_UP]: {\n [AppleAuthenticationButtonStyle.WHITE]: ExpoAppleAuthenticationButtonSignUpWhite,\n [AppleAuthenticationButtonStyle.WHITE_OUTLINE]: ExpoAppleAuthenticationButtonSignUpWhiteOutline,\n [AppleAuthenticationButtonStyle.BLACK]: ExpoAppleAuthenticationButtonSignUpBlack,\n },\n};\n\nconst selectButtonComponent = (\n type: AppleAuthenticationButtonType,\n style: AppleAuthenticationButtonStyle\n): React.ElementType => ButtonComponents[type][style];\n\nexport default AppleAuthenticationButton;\n"]}
1
+ {"version":3,"file":"AppleAuthenticationButton.js","sourceRoot":"","sources":["../src/AppleAuthenticationButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,6BAA6B,MAAM,iCAAiC,CAAC;AAE5E,cAAc;AACd;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,EAChD,OAAO,EACP,GAAG,SAAS,EACmB;IAC/B,IAAI,CAAC,6BAA6B,EAAE;QAClC,IAAI,OAAO,EAAE;YACX,OAAO,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;SAC/D;QACD,OAAO,IAAI,CAAC;KACb;IACD,OAAO,oBAAC,6BAA6B,IAAC,aAAa,EAAE,OAAO,KAAM,SAAS,GAAI,CAAC;AAClF,CAAC","sourcesContent":["import React from 'react';\n\nimport { AppleAuthenticationButtonProps } from './AppleAuthentication.types';\nimport ExpoAppleAuthenticationButton from './ExpoAppleAuthenticationButton';\n\n// @needsAudit\n/**\n * This component displays the proprietary \"Sign In with Apple\" / \"Continue with Apple\" button on\n * your screen. The App Store Guidelines require you to use this component to start the\n * authentication process instead of a custom button. Limited customization of the button is\n * available via the provided properties.\n *\n * You should only attempt to render this if [`AppleAuthentication.isAvailableAsync()`](#isavailableasync)\n * resolves to `true`. This component will render nothing if it is not available, and you will get\n * a warning in development mode (`__DEV__ === true`).\n *\n * The properties of this component extend from `View`; however, you should not attempt to set\n * `backgroundColor` or `borderRadius` with the `style` property. This will not work and is against\n * the App Store Guidelines. Instead, you should use the `buttonStyle` property to choose one of the\n * predefined color styles and the `cornerRadius` property to change the border radius of the\n * button.\n *\n * Make sure to attach height and width via the style props as without these styles, the button will\n * not appear on the screen.\n *\n * @see [Apple\n * Documentation](https://developer.apple.com/documentation/authenticationservices/asauthorizationappleidbutton)\n * for more details.\n */\nexport default function AppleAuthenticationButton({\n onPress,\n ...restProps\n}: AppleAuthenticationButtonProps) {\n if (!ExpoAppleAuthenticationButton) {\n if (__DEV__) {\n console.warn(\"'AppleAuthenticationButton' is not available.\");\n }\n return null;\n }\n return <ExpoAppleAuthenticationButton onButtonPress={onPress} {...restProps} />;\n}\n"]}
@@ -1,11 +1,3 @@
1
- declare let ExpoAppleAuthenticationButtonSignInWhite: any;
2
- declare let ExpoAppleAuthenticationButtonSignInWhiteOutline: any;
3
- declare let ExpoAppleAuthenticationButtonSignInBlack: any;
4
- declare let ExpoAppleAuthenticationButtonContinueWhite: any;
5
- declare let ExpoAppleAuthenticationButtonContinueWhiteOutline: any;
6
- declare let ExpoAppleAuthenticationButtonContinueBlack: any;
7
- declare let ExpoAppleAuthenticationButtonSignUpWhite: any;
8
- declare let ExpoAppleAuthenticationButtonSignUpWhiteOutline: any;
9
- declare let ExpoAppleAuthenticationButtonSignUpBlack: any;
10
- export { ExpoAppleAuthenticationButtonSignInWhite, ExpoAppleAuthenticationButtonSignInWhiteOutline, ExpoAppleAuthenticationButtonSignInBlack, ExpoAppleAuthenticationButtonContinueWhite, ExpoAppleAuthenticationButtonContinueWhiteOutline, ExpoAppleAuthenticationButtonContinueBlack, ExpoAppleAuthenticationButtonSignUpWhite, ExpoAppleAuthenticationButtonSignUpWhiteOutline, ExpoAppleAuthenticationButtonSignUpBlack, };
1
+ declare let ExpoAppleAuthenticationButton: any;
2
+ export default ExpoAppleAuthenticationButton;
11
3
  //# sourceMappingURL=ExpoAppleAuthenticationButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoAppleAuthenticationButton.d.ts","sourceRoot":"","sources":["../src/ExpoAppleAuthenticationButton.ts"],"names":[],"mappings":"AAGA,QAAA,IAAI,wCAAwC,EAAE,GAAG,CAAC;AAClD,QAAA,IAAI,+CAA+C,EAAE,GAAG,CAAC;AACzD,QAAA,IAAI,wCAAwC,EAAE,GAAG,CAAC;AAClD,QAAA,IAAI,0CAA0C,EAAE,GAAG,CAAC;AACpD,QAAA,IAAI,iDAAiD,EAAE,GAAG,CAAC;AAC3D,QAAA,IAAI,0CAA0C,EAAE,GAAG,CAAC;AACpD,QAAA,IAAI,wCAAwC,EAAE,GAAG,CAAC;AAClD,QAAA,IAAI,+CAA+C,EAAE,GAAG,CAAC;AACzD,QAAA,IAAI,wCAAwC,EAAE,GAAG,CAAC;AAgClD,OAAO,EACL,wCAAwC,EACxC,+CAA+C,EAC/C,wCAAwC,EACxC,0CAA0C,EAC1C,iDAAiD,EACjD,0CAA0C,EAC1C,wCAAwC,EACxC,+CAA+C,EAC/C,wCAAwC,GACzC,CAAC"}
1
+ {"version":3,"file":"ExpoAppleAuthenticationButton.d.ts","sourceRoot":"","sources":["../src/ExpoAppleAuthenticationButton.ts"],"names":[],"mappings":"AAGA,QAAA,IAAI,6BAA6B,EAAE,GAAG,CAAC;AAMvC,eAAe,6BAA6B,CAAC"}
@@ -1,24 +1,8 @@
1
1
  import { requireNativeViewManager } from 'expo-modules-core';
2
2
  import { Platform } from 'react-native';
3
- let ExpoAppleAuthenticationButtonSignInWhite;
4
- let ExpoAppleAuthenticationButtonSignInWhiteOutline;
5
- let ExpoAppleAuthenticationButtonSignInBlack;
6
- let ExpoAppleAuthenticationButtonContinueWhite;
7
- let ExpoAppleAuthenticationButtonContinueWhiteOutline;
8
- let ExpoAppleAuthenticationButtonContinueBlack;
9
- let ExpoAppleAuthenticationButtonSignUpWhite;
10
- let ExpoAppleAuthenticationButtonSignUpWhiteOutline;
11
- let ExpoAppleAuthenticationButtonSignUpBlack;
3
+ let ExpoAppleAuthenticationButton;
12
4
  if (Platform.OS === 'ios') {
13
- ExpoAppleAuthenticationButtonSignInWhite = requireNativeViewManager('ExpoAppleAuthenticationButtonSignInWhite');
14
- ExpoAppleAuthenticationButtonSignInWhiteOutline = requireNativeViewManager('ExpoAppleAuthenticationButtonSignInWhiteOutline');
15
- ExpoAppleAuthenticationButtonSignInBlack = requireNativeViewManager('ExpoAppleAuthenticationButtonSignInBlack');
16
- ExpoAppleAuthenticationButtonContinueWhite = requireNativeViewManager('ExpoAppleAuthenticationButtonContinueWhite');
17
- ExpoAppleAuthenticationButtonContinueWhiteOutline = requireNativeViewManager('ExpoAppleAuthenticationButtonContinueWhiteOutline');
18
- ExpoAppleAuthenticationButtonContinueBlack = requireNativeViewManager('ExpoAppleAuthenticationButtonContinueBlack');
19
- ExpoAppleAuthenticationButtonSignUpWhite = requireNativeViewManager('ExpoAppleAuthenticationButtonSignUpWhite');
20
- ExpoAppleAuthenticationButtonSignUpWhiteOutline = requireNativeViewManager('ExpoAppleAuthenticationButtonSignUpWhiteOutline');
21
- ExpoAppleAuthenticationButtonSignUpBlack = requireNativeViewManager('ExpoAppleAuthenticationButtonSignUpBlack');
5
+ ExpoAppleAuthenticationButton = requireNativeViewManager('ExpoAppleAuthentication');
22
6
  }
23
- export { ExpoAppleAuthenticationButtonSignInWhite, ExpoAppleAuthenticationButtonSignInWhiteOutline, ExpoAppleAuthenticationButtonSignInBlack, ExpoAppleAuthenticationButtonContinueWhite, ExpoAppleAuthenticationButtonContinueWhiteOutline, ExpoAppleAuthenticationButtonContinueBlack, ExpoAppleAuthenticationButtonSignUpWhite, ExpoAppleAuthenticationButtonSignUpWhiteOutline, ExpoAppleAuthenticationButtonSignUpBlack, };
7
+ export default ExpoAppleAuthenticationButton;
24
8
  //# sourceMappingURL=ExpoAppleAuthenticationButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoAppleAuthenticationButton.js","sourceRoot":"","sources":["../src/ExpoAppleAuthenticationButton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,IAAI,wCAA6C,CAAC;AAClD,IAAI,+CAAoD,CAAC;AACzD,IAAI,wCAA6C,CAAC;AAClD,IAAI,0CAA+C,CAAC;AACpD,IAAI,iDAAsD,CAAC;AAC3D,IAAI,0CAA+C,CAAC;AACpD,IAAI,wCAA6C,CAAC;AAClD,IAAI,+CAAoD,CAAC;AACzD,IAAI,wCAA6C,CAAC;AAElD,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;IACzB,wCAAwC,GAAG,wBAAwB,CACjE,0CAA0C,CAC3C,CAAC;IACF,+CAA+C,GAAG,wBAAwB,CACxE,iDAAiD,CAClD,CAAC;IACF,wCAAwC,GAAG,wBAAwB,CACjE,0CAA0C,CAC3C,CAAC;IACF,0CAA0C,GAAG,wBAAwB,CACnE,4CAA4C,CAC7C,CAAC;IACF,iDAAiD,GAAG,wBAAwB,CAC1E,mDAAmD,CACpD,CAAC;IACF,0CAA0C,GAAG,wBAAwB,CACnE,4CAA4C,CAC7C,CAAC;IACF,wCAAwC,GAAG,wBAAwB,CACjE,0CAA0C,CAC3C,CAAC;IACF,+CAA+C,GAAG,wBAAwB,CACxE,iDAAiD,CAClD,CAAC;IACF,wCAAwC,GAAG,wBAAwB,CACjE,0CAA0C,CAC3C,CAAC;CACH;AAED,OAAO,EACL,wCAAwC,EACxC,+CAA+C,EAC/C,wCAAwC,EACxC,0CAA0C,EAC1C,iDAAiD,EACjD,0CAA0C,EAC1C,wCAAwC,EACxC,+CAA+C,EAC/C,wCAAwC,GACzC,CAAC","sourcesContent":["import { requireNativeViewManager } from 'expo-modules-core';\nimport { Platform } from 'react-native';\n\nlet ExpoAppleAuthenticationButtonSignInWhite: any;\nlet ExpoAppleAuthenticationButtonSignInWhiteOutline: any;\nlet ExpoAppleAuthenticationButtonSignInBlack: any;\nlet ExpoAppleAuthenticationButtonContinueWhite: any;\nlet ExpoAppleAuthenticationButtonContinueWhiteOutline: any;\nlet ExpoAppleAuthenticationButtonContinueBlack: any;\nlet ExpoAppleAuthenticationButtonSignUpWhite: any;\nlet ExpoAppleAuthenticationButtonSignUpWhiteOutline: any;\nlet ExpoAppleAuthenticationButtonSignUpBlack: any;\n\nif (Platform.OS === 'ios') {\n ExpoAppleAuthenticationButtonSignInWhite = requireNativeViewManager(\n 'ExpoAppleAuthenticationButtonSignInWhite'\n );\n ExpoAppleAuthenticationButtonSignInWhiteOutline = requireNativeViewManager(\n 'ExpoAppleAuthenticationButtonSignInWhiteOutline'\n );\n ExpoAppleAuthenticationButtonSignInBlack = requireNativeViewManager(\n 'ExpoAppleAuthenticationButtonSignInBlack'\n );\n ExpoAppleAuthenticationButtonContinueWhite = requireNativeViewManager(\n 'ExpoAppleAuthenticationButtonContinueWhite'\n );\n ExpoAppleAuthenticationButtonContinueWhiteOutline = requireNativeViewManager(\n 'ExpoAppleAuthenticationButtonContinueWhiteOutline'\n );\n ExpoAppleAuthenticationButtonContinueBlack = requireNativeViewManager(\n 'ExpoAppleAuthenticationButtonContinueBlack'\n );\n ExpoAppleAuthenticationButtonSignUpWhite = requireNativeViewManager(\n 'ExpoAppleAuthenticationButtonSignUpWhite'\n );\n ExpoAppleAuthenticationButtonSignUpWhiteOutline = requireNativeViewManager(\n 'ExpoAppleAuthenticationButtonSignUpWhiteOutline'\n );\n ExpoAppleAuthenticationButtonSignUpBlack = requireNativeViewManager(\n 'ExpoAppleAuthenticationButtonSignUpBlack'\n );\n}\n\nexport {\n ExpoAppleAuthenticationButtonSignInWhite,\n ExpoAppleAuthenticationButtonSignInWhiteOutline,\n ExpoAppleAuthenticationButtonSignInBlack,\n ExpoAppleAuthenticationButtonContinueWhite,\n ExpoAppleAuthenticationButtonContinueWhiteOutline,\n ExpoAppleAuthenticationButtonContinueBlack,\n ExpoAppleAuthenticationButtonSignUpWhite,\n ExpoAppleAuthenticationButtonSignUpWhiteOutline,\n ExpoAppleAuthenticationButtonSignUpBlack,\n};\n"]}
1
+ {"version":3,"file":"ExpoAppleAuthenticationButton.js","sourceRoot":"","sources":["../src/ExpoAppleAuthenticationButton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,IAAI,6BAAkC,CAAC;AAEvC,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;IACzB,6BAA6B,GAAG,wBAAwB,CAAC,yBAAyB,CAAC,CAAC;CACrF;AAED,eAAe,6BAA6B,CAAC","sourcesContent":["import { requireNativeViewManager } from 'expo-modules-core';\nimport { Platform } from 'react-native';\n\nlet ExpoAppleAuthenticationButton: any;\n\nif (Platform.OS === 'ios') {\n ExpoAppleAuthenticationButton = requireNativeViewManager('ExpoAppleAuthentication');\n}\n\nexport default ExpoAppleAuthenticationButton;\n"]}
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "expo-apple-authentication",
3
+ "platforms": ["ios"],
4
+ "ios": {
5
+ "modules": ["AppleAuthenticationModule"]
6
+ }
7
+ }
@@ -0,0 +1,59 @@
1
+ import AuthenticationServices
2
+ import ExpoModulesCore
3
+
4
+ public final class AppleAuthenticationButton: ExpoView {
5
+ let onButtonPress = EventDispatcher()
6
+
7
+ var type: ButtonType = .signIn
8
+ var style: ButtonStyle = .white
9
+ var childView: ASAuthorizationAppleIDButton?
10
+
11
+ var needsUpdate = true
12
+
13
+ var cornerRadius: Double = 0.0 {
14
+ didSet {
15
+ childView?.cornerRadius = cornerRadius
16
+ }
17
+ }
18
+
19
+ func updateChildIfNeeded() {
20
+ guard needsUpdate else {
21
+ return
22
+ }
23
+ unmountChild()
24
+ mountNewChild()
25
+ needsUpdate = false
26
+ }
27
+
28
+ private func mountNewChild() {
29
+ let newChildView = ASAuthorizationAppleIDButton(
30
+ authorizationButtonType: type.toAppleAuthButtonType(),
31
+ authorizationButtonStyle: style.toAppleAuthButtonStyle()
32
+ )
33
+
34
+ newChildView.cornerRadius = cornerRadius
35
+ newChildView.translatesAutoresizingMaskIntoConstraints = false
36
+ newChildView.addTarget(self, action: #selector(onTouchUp), for: .touchUpInside)
37
+
38
+ addSubview(newChildView)
39
+ childView = newChildView
40
+
41
+ NSLayoutConstraint.activate([
42
+ newChildView.topAnchor.constraint(equalTo: self.topAnchor),
43
+ newChildView.bottomAnchor.constraint(equalTo: self.bottomAnchor),
44
+ newChildView.leadingAnchor.constraint(equalTo: self.leadingAnchor),
45
+ newChildView.trailingAnchor.constraint(equalTo: self.trailingAnchor)
46
+ ])
47
+ }
48
+
49
+ private func unmountChild() {
50
+ childView?.removeTarget(self, action: #selector(onTouchUp), for: .touchUpInside)
51
+ childView?.removeFromSuperview()
52
+ childView = nil
53
+ }
54
+
55
+ @objc
56
+ private func onTouchUp() {
57
+ onButtonPress()
58
+ }
59
+ }
@@ -0,0 +1,67 @@
1
+ import AuthenticationServices
2
+ import ExpoModulesCore
3
+
4
+ final class InvalidScopeException: GenericException<Int> {
5
+ override var reason: String {
6
+ "Invalid Apple authentication scope: \(param)"
7
+ }
8
+ }
9
+
10
+ final class InvalidOperationException: GenericException<Int> {
11
+ override var reason: String {
12
+ "Invalid type of Apple authentication operation: \(param)"
13
+ }
14
+ }
15
+
16
+ final class RequestCanceledException: Exception {
17
+ override var reason: String {
18
+ "The user canceled the authorization attempt"
19
+ }
20
+ }
21
+
22
+ final class InvalidResponseException: Exception {
23
+ override var reason: String {
24
+ "The authorization request received an invalid response"
25
+ }
26
+ }
27
+
28
+ final class RequestNotHandledException: Exception {
29
+ override var reason: String {
30
+ "The authorization request wasn’t handled"
31
+ }
32
+ }
33
+
34
+ final class RequestFailedException: Exception {
35
+ override var reason: String {
36
+ "The authorization attempt failed"
37
+ }
38
+ }
39
+
40
+ final class RequestNotInteractiveException: Exception {
41
+ override var reason: String {
42
+ "The authorization request isn’t interactive"
43
+ }
44
+ }
45
+
46
+ final class RequestUnknownException: Exception {
47
+ override var reason: String {
48
+ "The authorization attempt failed for an unknown reason"
49
+ }
50
+ }
51
+
52
+ func exceptionForAuthorizationError(_ error: ASAuthorizationError) -> Exception {
53
+ switch error.code {
54
+ case .unknown:
55
+ return RequestUnknownException()
56
+ case .canceled:
57
+ return RequestCanceledException()
58
+ case .invalidResponse:
59
+ return InvalidResponseException()
60
+ case .notHandled:
61
+ return RequestNotHandledException()
62
+ case .failed:
63
+ return RequestFailedException()
64
+ case .notInteractive:
65
+ return RequestNotInteractiveException()
66
+ }
67
+ }
@@ -0,0 +1,88 @@
1
+ import AuthenticationServices
2
+ import ExpoModulesCore
3
+
4
+ let credentialRevokedEventName = "Expo.appleIdCredentialRevoked"
5
+
6
+ public final class AppleAuthenticationModule: Module {
7
+ public func definition() -> ModuleDefinition {
8
+ Name("ExpoAppleAuthentication")
9
+
10
+ Events(credentialRevokedEventName)
11
+
12
+ AsyncFunction("isAvailableAsync") {
13
+ return true
14
+ }
15
+
16
+ AsyncFunction("requestAsync") { (options: AppleAuthenticationRequestOptions, promise: Promise) in
17
+ AppleAuthenticationRequest(options: options).performRequest { response, error in
18
+ if let error {
19
+ promise.reject(error)
20
+ } else {
21
+ promise.resolve(response)
22
+ }
23
+ }
24
+ }
25
+
26
+ AsyncFunction("getCredentialStateAsync") { (userId: String, promise: Promise) in
27
+ let appleIdProvider = ASAuthorizationAppleIDProvider()
28
+
29
+ appleIdProvider.getCredentialState(forUserID: userId) { credentialState, _ in
30
+ // We can ignore the error as the credential state cannot be nil
31
+ // and the error may occur only when the credential state is `notFound`
32
+ promise.resolve(credentialStateToInt(credentialState))
33
+ }
34
+ }
35
+
36
+ View(AppleAuthenticationButton.self) {
37
+ Events("onButtonPress")
38
+
39
+ Prop("buttonType") { (view, type: ButtonType?) in
40
+ let type = type ?? .signIn
41
+
42
+ if view.type != type {
43
+ view.type = type
44
+ view.needsUpdate = true
45
+ }
46
+ }
47
+
48
+ Prop("buttonStyle") { (view, style: ButtonStyle?) in
49
+ let style = style ?? .white
50
+
51
+ if view.style != style {
52
+ view.style = style
53
+ view.needsUpdate = true
54
+ }
55
+ }
56
+
57
+ Prop("cornerRadius") { (view, cornerRadius: Double) in
58
+ view.cornerRadius = cornerRadius
59
+ }
60
+
61
+ OnViewDidUpdateProps { view in
62
+ view.updateChildIfNeeded()
63
+ }
64
+ }
65
+
66
+ OnStartObserving {
67
+ NotificationCenter.default.addObserver(
68
+ self,
69
+ selector: #selector(didRevokeCredential(_:)),
70
+ name: ASAuthorizationAppleIDProvider.credentialRevokedNotification,
71
+ object: nil
72
+ )
73
+ }
74
+
75
+ OnStopObserving {
76
+ NotificationCenter.default.removeObserver(
77
+ self,
78
+ name: ASAuthorizationAppleIDProvider.credentialRevokedNotification,
79
+ object: nil
80
+ )
81
+ }
82
+ }
83
+
84
+ @objc
85
+ func didRevokeCredential(_ notification: Notification) {
86
+ sendEvent(credentialRevokedEventName)
87
+ }
88
+ }