Skip to content

Commit 74cc8c8

Browse files
committed
chore: add apple-sign-in demo
1 parent d404adb commit 74cc8c8

File tree

5 files changed

+21
-17
lines changed

5 files changed

+21
-17
lines changed
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
import { Observable, EventData, Page } from '@nativescript/core';
22
import { DemoSharedAppleSignIn } from '@demo/shared';
3-
import { } from '@nativescript/apple-sign-in';
3+
import { SignIn } from '@nativescript/apple-sign-in';
44

55
export function navigatingTo(args: EventData) {
66
const page = <Page>args.object;
77
page.bindingContext = new DemoModel();
88
}
99

10-
11-
export class DemoModel extends DemoSharedAppleSignIn {
12-
login(args) {
13-
console.log('login');
14-
}
15-
}
10+
export class DemoModel extends DemoSharedAppleSignIn {}

apps/demo/src/plugin-demos/apple-sign-in.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
</ActionBar>
55
</Page.actionBar>
66
<StackLayout class="p-20">
7-
<ui:SignInButton tap="{{ login }}"/>
7+
<ui:SignInButton tap="{{ login }}" height="56"/>
88
</StackLayout>
99
</Page>

packages/apple-sign-in/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ user sign themself in (after they pressed a nice button for instance).
4747
```typescript
4848
import { SignIn, User } from "@nativescript/apple-sign-in";
4949

50-
signIn(
50+
SignIn.signIn(
5151
{
5252
// by default you don't get these details, but if you provide these scopes you will (and the user will get to choose which ones are allowed)
5353
scopes: ["EMAIL", "FULLNAME"]

tools/assets/App_Resources/iOS/app.entitlements

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5-
<key>com.apple.developer.contacts.notes</key>
6-
<true/>
5+
<key>com.apple.developer.applesignin</key>
6+
<array>
7+
<string>Default</string>
8+
</array>
79
</dict>
810
</plist>

tools/demo/apple-sign-in/index.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
import { DemoSharedBase } from '../utils';
2-
import { } from '@nativescript/apple-sign-in';
2+
import { SignIn, User } from '@nativescript/apple-sign-in';
33

44
export class DemoSharedAppleSignIn extends DemoSharedBase {
5-
6-
testIt() {
7-
console.log('test apple-sign-in!');
8-
}
9-
}
5+
login() {
6+
SignIn.signIn({
7+
// by default you don't get these details, but if you provide these scopes you will (and the user will get to choose which ones are allowed)
8+
scopes: ['EMAIL', 'FULL_NAME'],
9+
})
10+
.then((result: User) => {
11+
console.log('Signed in, user: ' + result);
12+
console.log('Signed in, familyName: ' + result.fullName.familyName);
13+
})
14+
.catch((err) => console.log('Error signing in: ' + err));
15+
}
16+
}

0 commit comments

Comments
 (0)