@symbiote-native/apple-authentication 0.0.0 → 0.1.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.
- package/README.md +230 -29
- package/build-ngc/angular/apple-authentication-button/index.js.map +1 -1
- package/build-ngc/core/apple-authentication.js.map +1 -1
- package/package.json +15 -15
- package/src/angular/apple-authentication-button/index.ts +2 -1
- package/src/core/apple-authentication.ts +4 -1
- package/src/core/types.ts +1 -5
package/README.md
CHANGED
|
@@ -4,24 +4,92 @@
|
|
|
4
4
|
**every** [SymbioteNative](../../README.md) adapter: React, Vue, Svelte, Solid and Angular. Sign in
|
|
5
5
|
with Apple, iOS only: the credential flow and the system button.
|
|
6
6
|
|
|
7
|
+
Built the same way as [`@symbiote-native/clipboard`](../clipboard)'s `ClipboardPasteButton`, an
|
|
8
|
+
`expo-modules-core` native view reached through `requireNativeViewManager` (see the
|
|
9
|
+
`symbiote-expo-native-module` project skill: why `expo-modules-core` is depended on directly and never
|
|
10
|
+
the `expo` meta-package, why the upstream JS is hand-ported into `core/`, and how autolinking finds the
|
|
11
|
+
native module). The credential flow is plain async functions in `core/`, the button is the one render function every
|
|
12
|
+
adapter turns into its own element.
|
|
13
|
+
|
|
7
14
|
## Install
|
|
8
15
|
|
|
16
|
+
**New app:**
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx @symbiote-native/cli new my-app --apple-authentication
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Existing SymbioteNative app:**
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx @symbiote-native/cli add --apple-authentication
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Either way: installs `@symbiote-native/apple-authentication` and wires the native autolinking automatically,
|
|
29
|
+
see [`@symbiote-native/cli`](../cli).
|
|
30
|
+
|
|
31
|
+
<details>
|
|
32
|
+
<summary>Manual install (no CLI - installing and wiring native autolinking by hand)</summary>
|
|
33
|
+
|
|
9
34
|
```bash
|
|
10
|
-
|
|
11
|
-
|
|
35
|
+
npm install @symbiote-native/apple-authentication
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Depends on `expo-apple-authentication` and `expo-modules-core` directly (regular dependencies, pinned to exact
|
|
39
|
+
versions, since this package's `core/` is hand-ported against one specific native API shape).
|
|
40
|
+
Never install `expo-apple-authentication` yourself, and never add the `expo` package to this project: it bundles
|
|
41
|
+
its own Metro/Babel pipeline that conflicts with this project's own.
|
|
42
|
+
|
|
43
|
+
### Required one-time step: native autolinking wiring
|
|
44
|
+
|
|
45
|
+
`expo-apple-authentication`'s native code is discovered by `expo-modules-autolinking`, not by RN's own
|
|
46
|
+
`react-native.config.cjs` mechanism. Wire it into the native host app **once**, it covers this package
|
|
47
|
+
and every other `expo-modules-core` package with zero further changes. The steps and the
|
|
48
|
+
mechanics behind them are in the `symbiote-expo-native-module` skill and in
|
|
49
|
+
[`@symbiote-native/network`](../network)'s README; the reference app is `examples/expo-react`.
|
|
50
|
+
|
|
51
|
+
### Entitlement and Info.plist
|
|
52
|
+
|
|
53
|
+
The package declares what `expo-apple-authentication`'s config plugin adds, and the `expo-modules-link`
|
|
54
|
+
postinstall writes it into the app:
|
|
55
|
+
|
|
56
|
+
| File | Entry |
|
|
57
|
+
| ------------------ | -------------------------------------------------------------- |
|
|
58
|
+
| `Info.plist` | `CFBundleAllowMixedLocalizations = true`, for the localized button |
|
|
59
|
+
| `*.entitlements` | `com.apple.developer.applesignin = ['Default']` |
|
|
60
|
+
|
|
61
|
+
When the app has no `*.entitlements` file the postinstall creates `<App>/<App>.entitlements` next to
|
|
62
|
+
`Info.plist` and wires it into the Xcode project. Pick a signing Team in Xcode once; Sign in with
|
|
63
|
+
Apple does not work without one.
|
|
64
|
+
|
|
65
|
+
</details>
|
|
66
|
+
|
|
67
|
+
## Shape
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
src/core/ apple-authentication.ts - isAvailableAsync, signInAsync, refreshAsync,
|
|
71
|
+
signOutAsync, getCredentialStateAsync, formatFullName, addRevokeListener over
|
|
72
|
+
requireOptionalNativeModule with a stub. apple-authentication-button.ts - the
|
|
73
|
+
button descriptor. types.ts - enums and credential types.
|
|
74
|
+
src/react/ @symbiote-native/apple-authentication/react - AppleAuthenticationButton
|
|
75
|
+
src/vue/ @symbiote-native/apple-authentication/vue - AppleAuthenticationButton
|
|
76
|
+
src/svelte/ @symbiote-native/apple-authentication/svelte - AppleAuthenticationButton
|
|
77
|
+
src/solid/ @symbiote-native/apple-authentication/solid - AppleAuthenticationButton
|
|
78
|
+
src/angular/ @symbiote-native/apple-authentication/angular - AppleAuthenticationButton
|
|
12
79
|
```
|
|
13
80
|
|
|
14
|
-
|
|
15
|
-
|
|
81
|
+
The functions and the enums are the same on every adapter, they live in the shared core. Off iOS the
|
|
82
|
+
native module is missing, so the functions throw `UnavailabilityError` instead of crashing at import.
|
|
83
|
+
|
|
84
|
+
## Use it
|
|
16
85
|
|
|
17
|
-
|
|
86
|
+
### React
|
|
18
87
|
|
|
19
88
|
```tsx
|
|
20
89
|
import {
|
|
21
90
|
AppleAuthenticationButton,
|
|
22
91
|
AppleAuthenticationButtonStyle,
|
|
23
92
|
AppleAuthenticationButtonType,
|
|
24
|
-
AppleAuthenticationScope,
|
|
25
93
|
signInAsync,
|
|
26
94
|
} from '@symbiote-native/apple-authentication/react';
|
|
27
95
|
|
|
@@ -30,35 +98,168 @@ import {
|
|
|
30
98
|
buttonStyle={AppleAuthenticationButtonStyle.BLACK}
|
|
31
99
|
cornerRadius={8}
|
|
32
100
|
style={{ width: 200, height: 44 }}
|
|
33
|
-
onPress={
|
|
34
|
-
const credential = await signInAsync({
|
|
35
|
-
requestedScopes: [AppleAuthenticationScope.FULL_NAME, AppleAuthenticationScope.EMAIL],
|
|
36
|
-
});
|
|
37
|
-
}}
|
|
101
|
+
onPress={() => signInAsync()}
|
|
38
102
|
/>;
|
|
39
103
|
```
|
|
40
104
|
|
|
41
|
-
|
|
42
|
-
`getCredentialStateAsync`, `formatFullName`, `addRevokeListener`) and the enums are the same on
|
|
43
|
-
every adapter, they live in the shared core. The button takes `onPress`, `buttonType`,
|
|
44
|
-
`buttonStyle`, `cornerRadius`, `style` and the View surface. It needs a width and a height, and it
|
|
45
|
-
renders nothing off iOS (with a dev-only warning).
|
|
105
|
+
### Vue
|
|
46
106
|
|
|
47
|
-
|
|
107
|
+
```vue
|
|
108
|
+
<script setup lang="ts">
|
|
109
|
+
import {
|
|
110
|
+
AppleAuthenticationButton,
|
|
111
|
+
AppleAuthenticationButtonStyle,
|
|
112
|
+
AppleAuthenticationButtonType,
|
|
113
|
+
signInAsync,
|
|
114
|
+
} from '@symbiote-native/apple-authentication/vue';
|
|
115
|
+
</script>
|
|
48
116
|
|
|
49
|
-
|
|
50
|
-
|
|
117
|
+
<template>
|
|
118
|
+
<AppleAuthenticationButton
|
|
119
|
+
:button-type="AppleAuthenticationButtonType.SIGN_IN"
|
|
120
|
+
:button-style="AppleAuthenticationButtonStyle.BLACK"
|
|
121
|
+
:corner-radius="8"
|
|
122
|
+
:style="{ width: 200, height: 44 }"
|
|
123
|
+
:on-press="() => signInAsync()"
|
|
124
|
+
/>
|
|
125
|
+
</template>
|
|
126
|
+
```
|
|
51
127
|
|
|
52
|
-
|
|
53
|
-
| ------------------ | ------------------------------------------------------------ |
|
|
54
|
-
| `Info.plist` | `CFBundleAllowMixedLocalizations = true`, for the localized button |
|
|
55
|
-
| `*.entitlements` | `com.apple.developer.applesignin = ['Default']` |
|
|
128
|
+
### Angular
|
|
56
129
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
130
|
+
```ts
|
|
131
|
+
import {
|
|
132
|
+
AppleAuthenticationButton,
|
|
133
|
+
AppleAuthenticationButtonStyle,
|
|
134
|
+
AppleAuthenticationButtonType,
|
|
135
|
+
signInAsync,
|
|
136
|
+
} from '@symbiote-native/apple-authentication/angular';
|
|
137
|
+
|
|
138
|
+
@Component({
|
|
139
|
+
imports: [AppleAuthenticationButton],
|
|
140
|
+
template: `
|
|
141
|
+
<AppleAuthenticationButton
|
|
142
|
+
[buttonType]="type"
|
|
143
|
+
[buttonStyle]="style"
|
|
144
|
+
[cornerRadius]="8"
|
|
145
|
+
[onPress]="signIn"
|
|
146
|
+
/>
|
|
147
|
+
`,
|
|
148
|
+
})
|
|
149
|
+
export class SignIn {
|
|
150
|
+
readonly type = AppleAuthenticationButtonType.SIGN_IN;
|
|
151
|
+
readonly style = AppleAuthenticationButtonStyle.BLACK;
|
|
152
|
+
readonly signIn = () => signInAsync();
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Svelte
|
|
157
|
+
|
|
158
|
+
```svelte
|
|
159
|
+
<script lang="ts">
|
|
160
|
+
import {
|
|
161
|
+
AppleAuthenticationButton,
|
|
162
|
+
AppleAuthenticationButtonStyle,
|
|
163
|
+
AppleAuthenticationButtonType,
|
|
164
|
+
signInAsync,
|
|
165
|
+
} from '@symbiote-native/apple-authentication/svelte';
|
|
166
|
+
</script>
|
|
167
|
+
|
|
168
|
+
<AppleAuthenticationButton
|
|
169
|
+
buttonType={AppleAuthenticationButtonType.SIGN_IN}
|
|
170
|
+
buttonStyle={AppleAuthenticationButtonStyle.BLACK}
|
|
171
|
+
cornerRadius={8}
|
|
172
|
+
style={{ width: 200, height: 44 }}
|
|
173
|
+
onPress={() => signInAsync()}
|
|
174
|
+
/>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Solid
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
import {
|
|
181
|
+
AppleAuthenticationButton,
|
|
182
|
+
AppleAuthenticationButtonStyle,
|
|
183
|
+
AppleAuthenticationButtonType,
|
|
184
|
+
signInAsync,
|
|
185
|
+
} from '@symbiote-native/apple-authentication/solid';
|
|
186
|
+
|
|
187
|
+
<AppleAuthenticationButton
|
|
188
|
+
buttonType={AppleAuthenticationButtonType.SIGN_IN}
|
|
189
|
+
buttonStyle={AppleAuthenticationButtonStyle.BLACK}
|
|
190
|
+
cornerRadius={8}
|
|
191
|
+
style={{ width: 200, height: 44 }}
|
|
192
|
+
onPress={() => signInAsync()}
|
|
193
|
+
/>;
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## API
|
|
197
|
+
|
|
198
|
+
```ts
|
|
199
|
+
isAvailableAsync(): Promise<boolean> // false off iOS
|
|
200
|
+
signInAsync(options?): Promise<AppleAuthenticationCredential> // rejects ERR_REQUEST_CANCELED on cancel
|
|
201
|
+
refreshAsync(options): Promise<AppleAuthenticationCredential>
|
|
202
|
+
signOutAsync(options): Promise<AppleAuthenticationCredential>
|
|
203
|
+
getCredentialStateAsync(user): Promise<AppleAuthenticationCredentialState> // not on the Simulator
|
|
204
|
+
formatFullName(fullName, formatStyle?): string
|
|
205
|
+
addRevokeListener(listener): EventSubscription
|
|
206
|
+
|
|
207
|
+
<AppleAuthenticationButton onPress buttonType buttonStyle cornerRadius? style? /> // needs width and height
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Plus the `AppleAuthenticationScope`, `AppleAuthenticationButtonType`, `AppleAuthenticationButtonStyle`,
|
|
211
|
+
`AppleAuthenticationOperation` and `AppleAuthenticationCredentialState` enums and the `I`-prefixed
|
|
212
|
+
credential types, hand-ported from upstream's `AppleAuthentication.types.ts`.
|
|
213
|
+
|
|
214
|
+
## Notes
|
|
215
|
+
|
|
216
|
+
- **iOS only.** Off iOS `isAvailableAsync()` resolves `false`, every other function throws
|
|
217
|
+
`UnavailabilityError`, and the button renders nothing with a warning in development. Gate the
|
|
218
|
+
button on `isAvailableAsync()`.
|
|
219
|
+
- **Cancelling is an error with a code.** `signInAsync` and `refreshAsync` reject with
|
|
220
|
+
`ERR_REQUEST_CANCELED` when the user dismisses the sheet. Any other code is a real failure.
|
|
221
|
+
- **A credential without tokens is a failure.** If the result lacks `authorizationCode`,
|
|
222
|
+
`identityToken` or `user`, the call rejects with `ERR_REQUEST_FAILED`, so a resolved credential is
|
|
223
|
+
always usable.
|
|
224
|
+
- **Name and email arrive once.** Apple returns `fullName` and `email` only the first time a user
|
|
225
|
+
signs in to your app, and only for the scopes you requested. Store them when you get them, for
|
|
226
|
+
example with [`@symbiote-native/secure-store`](/docs/packages/secure-store/) or on your server.
|
|
227
|
+
- **The button label is drawn by iOS.** You pick `buttonType` and `buttonStyle`, the text follows the
|
|
228
|
+
app's localization, and the package sets `CFBundleAllowMixedLocalizations` for it.
|
|
229
|
+
- **Not ported.** Nothing: the web build and the config plugin itself are replaced by the manifest above. Upstream ships no tests, so the suites here are written against its behavior.
|
|
230
|
+
|
|
231
|
+
## Common questions
|
|
232
|
+
|
|
233
|
+
- **The button does not show up.** Give it a width and a height and render it only when
|
|
234
|
+
`isAvailableAsync()` resolves `true`. Check the entitlement and the signing Team.
|
|
235
|
+
- **Spins forever on the Simulator.** An Apple simulator bug, test on a real device.
|
|
236
|
+
`getCredentialStateAsync` always throws on the simulator.
|
|
237
|
+
- **`ERR_REQUEST_FAILED` with error 1000 on a device.** Enable the capability for the App ID,
|
|
238
|
+
regenerate the provisioning profile, select a Team, keep `com.apple.developer.applesignin` in the
|
|
239
|
+
entitlements.
|
|
240
|
+
- **Cancel or failure.** A cancel rejects with `ERR_REQUEST_CANCELED`, anything else is a failure.
|
|
241
|
+
- **`fullName` and `email` are `null` the second time.** Apple returns them only on the first sign
|
|
242
|
+
in, store them.
|
|
243
|
+
- **Button text.** Drawn by iOS from the app's localizations, not settable from JavaScript.
|
|
244
|
+
- **Firebase `aud` mismatch.** `host.exp.Exponent` only appears in Expo Go. Builds use your own
|
|
245
|
+
bundle identifier.
|
|
246
|
+
- **Android and web.** Not supported, the functions throw `UnavailabilityError`.
|
|
247
|
+
|
|
248
|
+
Sources: [Expo docs: AppleAuthentication](https://docs.expo.dev/versions/latest/sdk/apple-authentication/),
|
|
249
|
+
[expo/expo#11476](https://github.com/expo/expo/issues/11476),
|
|
250
|
+
[expo/expo#5781](https://github.com/expo/expo/issues/5781),
|
|
251
|
+
[expo/expo#8341](https://github.com/expo/expo/issues/8341),
|
|
252
|
+
[expo/expo#5690](https://github.com/expo/expo/issues/5690),
|
|
253
|
+
[expo/expo#7129](https://github.com/expo/expo/issues/7129),
|
|
254
|
+
[expo/expo#16162](https://github.com/expo/expo/issues/16162).
|
|
60
255
|
|
|
61
|
-
##
|
|
256
|
+
## Test it
|
|
62
257
|
|
|
63
|
-
|
|
64
|
-
|
|
258
|
+
No device is needed for the logic. The core tests (`src/core/*.test.ts`) replace `expo-modules-core`
|
|
259
|
+
(the native module and `requireNativeViewManager`) and assert the descriptor a render function returns. The
|
|
260
|
+
adapter tests (`src/{react,vue,solid,angular}/**/*.test.*`, `vitest`) render the real component over the
|
|
261
|
+
recording Fabric with an injected view config and assert the committed payload, and Svelte's
|
|
262
|
+
`*.smoke.test.ts` compile the `.svelte` files and mount them. Painting itself is verified on a device in
|
|
263
|
+
the six `examples/expo-*` canary apps (`examples/expo-react`, `examples/expo-vue-sfc`,
|
|
264
|
+
`examples/expo-vue-tsx`, `examples/expo-svelte`, `examples/expo-solid`, `examples/expo-angular`), see the
|
|
265
|
+
parent [README](../../README.md).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/angular/apple-authentication-button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE5E,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;;AAGzF,0FAA0F;AAU1F,MAAM,OAAO,yBAA0B,SAAQ,cAAc;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/angular/apple-authentication-button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,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AChC,OAA2C;IAE3C,OAAO,iBAAiB,CAAC,cAAc,EAAE;QACvC,GAAG,OAAO;QACV,kBAAkB,EAAE,4BAA4B,CAAC,MAAM;KACxD,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,IAAY;IAEZ,IAAI,CAAC,uBAAuB,CAAC,uBAAuB,EAAE,CAAC;QACrD,MAAM,IAAI,mBAAmB,
|
|
1
|
+
{"version":3,"file":"apple-authentication.js","sourceRoot":"","sources":["../../src/core/apple-authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAYvD,MAAM,kBAAkB,GAAG,2BAA2B,CAAC;AAEvD,gFAAgF;AAChF,KAAK,UAAU,iBAAiB,CAC9B,YAAoB,EACpB,OAAoC;IAEpC,IAAI,CAAC,uBAAuB,CAAC,YAAY,EAAE,CAAC;QAC1C,MAAM,IAAI,mBAAmB,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,uBAAuB,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;AACvD,CAAC;AAED,yEAAyE;AACzE,KAAK,UAAU,yBAAyB,CACtC,YAAoB,EACpB,OAAoC;IAEpC,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAClE,IACE,CAAC,UAAU,CAAC,iBAAiB;QAC7B,CAAC,UAAU,CAAC,aAAa;QACzB,CAAC,UAAU,CAAC,IAAI,EAChB,CAAC;QACD,MAAM,IAAI,UAAU,CAClB,oBAAoB,EACpB,gCAAgC,YAAY,4CAA4C,CACzF,CAAC;I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B,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,uBAAuB,CAAC,cAAc,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AACvE,CAAC;AAED,gGAAgG;AAChG,MAAM,UAAU,iBAAiB,CAAC,QAAoB;IACpD,OAAO,uBAAuB,CAAC,WAAW,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;AAC1E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbiote-native/apple-authentication",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "expo-apple-authentication wrapped for SymbioteNative — one framework-agnostic core, built once and reachable from the React, Vue, Svelte, Solid, and Angular adapters. Sign in with Apple: the credential flow and the native button, iOS only.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"expo-apple-authentication": "57.0.2",
|
|
70
70
|
"expo-modules-core": "57.0.20",
|
|
71
|
-
"@symbiote-native/components": "3.
|
|
71
|
+
"@symbiote-native/components": "3.2.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"@angular/core": ">=20",
|
|
@@ -78,12 +78,12 @@
|
|
|
78
78
|
"solid-js": ">=1.9.0",
|
|
79
79
|
"svelte": ">=5.56.0",
|
|
80
80
|
"vue": ">=3.5.0",
|
|
81
|
-
"@symbiote-native/angular": "^3.
|
|
82
|
-
"@symbiote-native/engine": "^1.
|
|
83
|
-
"@symbiote-native/react": "^3.
|
|
84
|
-
"@symbiote-native/solid": "^3.
|
|
85
|
-
"@symbiote-native/
|
|
86
|
-
"@symbiote-native/
|
|
81
|
+
"@symbiote-native/angular": "^3.3.0",
|
|
82
|
+
"@symbiote-native/engine": "^1.6.0",
|
|
83
|
+
"@symbiote-native/react": "^3.3.0",
|
|
84
|
+
"@symbiote-native/solid": "^3.2.0",
|
|
85
|
+
"@symbiote-native/svelte": "^3.2.0",
|
|
86
|
+
"@symbiote-native/vue": "^3.3.0"
|
|
87
87
|
},
|
|
88
88
|
"peerDependenciesMeta": {
|
|
89
89
|
"@symbiote-native/angular": {
|
|
@@ -131,13 +131,13 @@
|
|
|
131
131
|
"solid-js": "^1.9.14",
|
|
132
132
|
"svelte": "^5.56.0",
|
|
133
133
|
"typescript": "~6.0.0",
|
|
134
|
-
"@symbiote-native/angular": "3.
|
|
135
|
-
"@symbiote-native/
|
|
136
|
-
"@symbiote-native/
|
|
137
|
-
"@symbiote-native/
|
|
138
|
-
"@symbiote-native/svelte": "3.
|
|
139
|
-
"@symbiote-native/
|
|
140
|
-
"@symbiote-native/
|
|
134
|
+
"@symbiote-native/angular": "3.3.0",
|
|
135
|
+
"@symbiote-native/engine": "1.6.0",
|
|
136
|
+
"@symbiote-native/react": "3.3.0",
|
|
137
|
+
"@symbiote-native/solid": "3.2.0",
|
|
138
|
+
"@symbiote-native/svelte": "3.2.0",
|
|
139
|
+
"@symbiote-native/test-utils": "0.4.7",
|
|
140
|
+
"@symbiote-native/vue": "3.3.0"
|
|
141
141
|
},
|
|
142
142
|
"scripts": {
|
|
143
143
|
"typecheck": "tsc --build",
|
|
@@ -15,7 +15,8 @@ import type { IAppleAuthenticationButtonProps } from '../../core/apple-authentic
|
|
|
15
15
|
}`,
|
|
16
16
|
})
|
|
17
17
|
export class AppleAuthenticationButton extends NativeViewBase {
|
|
18
|
-
@Input({ required: true })
|
|
18
|
+
@Input({ required: true })
|
|
19
|
+
onPress!: IAppleAuthenticationButtonProps['onPress'];
|
|
19
20
|
@Input({ required: true })
|
|
20
21
|
buttonType!: IAppleAuthenticationButtonProps['buttonType'];
|
|
21
22
|
@Input({ required: true })
|
|
@@ -105,7 +105,10 @@ export async function getCredentialStateAsync(
|
|
|
105
105
|
user: string,
|
|
106
106
|
): Promise<AppleAuthenticationCredentialState> {
|
|
107
107
|
if (!expoAppleAuthentication.getCredentialStateAsync) {
|
|
108
|
-
throw new UnavailabilityError(
|
|
108
|
+
throw new UnavailabilityError(
|
|
109
|
+
NATIVE_MODULE_NAME,
|
|
110
|
+
'getCredentialStateAsync',
|
|
111
|
+
);
|
|
109
112
|
}
|
|
110
113
|
return expoAppleAuthentication.getCredentialStateAsync(user);
|
|
111
114
|
}
|
package/src/core/types.ts
CHANGED
|
@@ -57,11 +57,7 @@ export enum AppleAuthenticationButtonStyle {
|
|
|
57
57
|
|
|
58
58
|
/** The style a name is formatted in, see `formatFullName` */
|
|
59
59
|
export type IAppleAuthenticationFullNameFormatStyle =
|
|
60
|
-
| '
|
|
61
|
-
| 'short'
|
|
62
|
-
| 'medium'
|
|
63
|
-
| 'long'
|
|
64
|
-
| 'abbreviated';
|
|
60
|
+
'default' | 'short' | 'medium' | 'long' | 'abbreviated';
|
|
65
61
|
|
|
66
62
|
/** The tokenized portions of the user's name, only what the user allowed is not `null` */
|
|
67
63
|
export type IAppleAuthenticationFullName = {
|