Skip to content

Commit 1221ee4

Browse files
authored
feat(facebook): v12.x.x SDK (#188)
* feat(facebook): use sdk 12.x.x * feat(facebook): v12 sdk
1 parent 72c275c commit 1221ee4

14 files changed

+939
-358
lines changed

apps/demo-angular/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"main": "./src/main.ts",
33
"dependencies": {
44
"@nativescript/core": "file:../../node_modules/@nativescript/core",
5-
"@nativescript/debug-ios": "file:../../dist/packages/debug-ios",
5+
"@nativescript/facebook": "file:../../dist/packages/facebook",
66
"@nativescript/animated-circle": "file:../../dist/packages/animated-circle",
77
"@nativescript/appavailability": "file:../../dist/packages/appavailability",
88
"@nativescript/auto-fit-text": "file:../../dist/packages/auto-fit-text",
@@ -11,11 +11,13 @@
1111
"@nativescript/camera": "file:../../dist/packages/camera",
1212
"@nativescript/datetimepicker": "file:../../dist/packages/datetimepicker",
1313
"@nativescript/debug-android": "file:../../dist/packages/debug-android",
14+
"@nativescript/debug-ios": "file:../../dist/packages/debug-ios",
1415
"@nativescript/detox": "file:../../dist/packages/detox",
1516
"@nativescript/directions": "file:../../dist/packages/directions",
1617
"@nativescript/email": "file:../../dist/packages/email",
1718
"@nativescript/fingerprint-auth": "file:../../dist/packages/fingerprint-auth",
1819
"@nativescript/geolocation": "file:../../dist/packages/geolocation",
20+
"@nativescript/google-signin": "file:../../dist/packages/google-signin",
1921
"@nativescript/imagepicker": "file:../../dist/packages/imagepicker",
2022
"@nativescript/ios-security": "file:../../dist/packages/ios-security",
2123
"@nativescript/iqkeyboardmanager": "file:../../dist/packages/iqkeyboardmanager",
@@ -24,10 +26,8 @@
2426
"@nativescript/picker": "file:../../dist/packages/picker",
2527
"@nativescript/shared-notification-delegate": "file:../../dist/packages/shared-notification-delegate",
2628
"@nativescript/social-share": "file:../../dist/packages/social-share",
27-
"@nativescript/zip": "file:../../dist/packages/zip",
28-
"@nativescript/facebook": "file:../../dist/packages/facebook",
29-
"@nativescript/google-signin": "file:../../dist/packages/google-signin",
30-
"@nativescript/twitter": "file:../../dist/packages/twitter"
29+
"@nativescript/twitter": "file:../../dist/packages/twitter",
30+
"@nativescript/zip": "file:../../dist/packages/zip"
3131
},
3232
"devDependencies": {
3333
"@nativescript/android": "~8.1.1",

apps/demo/package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
"license": "SEE LICENSE IN <your-license-filename>",
55
"repository": "<fill-your-repository-here>",
66
"dependencies": {
7+
"@nativescript/core": "file:../../node_modules/@nativescript/core",
8+
"@nativescript/facebook": "file:../../packages/facebook",
79
"@nativescript/animated-circle": "file:../../packages/animated-circle",
810
"@nativescript/appavailability": "file:../../packages/appavailability",
911
"@nativescript/auto-fit-text": "file:../../packages/auto-fit-text",
1012
"@nativescript/background-http": "file:../../packages/background-http",
1113
"@nativescript/brightness": "file:../../packages/brightness",
1214
"@nativescript/camera": "file:../../packages/camera",
13-
"@nativescript/core": "file:../../node_modules/@nativescript/core",
1415
"@nativescript/datetimepicker": "file:../../packages/datetimepicker",
1516
"@nativescript/debug-android": "file:../../packages/debug-android",
1617
"@nativescript/debug-ios": "file:../../packages/debug-ios",
@@ -19,18 +20,17 @@
1920
"@nativescript/email": "file:../../packages/email",
2021
"@nativescript/fingerprint-auth": "file:../../packages/fingerprint-auth",
2122
"@nativescript/geolocation": "file:../../packages/geolocation",
23+
"@nativescript/google-signin": "file:../../packages/google-signin",
2224
"@nativescript/imagepicker": "file:../../packages/imagepicker",
2325
"@nativescript/ios-security": "file:../../packages/ios-security",
2426
"@nativescript/iqkeyboardmanager": "file:../../packages/iqkeyboardmanager",
2527
"@nativescript/local-notifications": "file:../../packages/local-notifications",
26-
"@nativescript/localize": "file:../../dist/packages/localize",
28+
"@nativescript/localize": "file:../../packages/localize",
2729
"@nativescript/picker": "file:../../packages/picker",
2830
"@nativescript/shared-notification-delegate": "file:../../packages/shared-notification-delegate",
2931
"@nativescript/social-share": "file:../../packages/social-share",
30-
"@nativescript/zip": "file:../../packages/zip",
31-
"@nativescript/facebook": "file:../../packages/facebook",
32-
"@nativescript/google-signin": "file:../../packages/google-signin",
33-
"@nativescript/twitter": "file:../../packages/twitter"
32+
"@nativescript/twitter": "file:../../packages/twitter",
33+
"@nativescript/zip": "file:../../packages/zip"
3434
},
3535
"devDependencies": {
3636
"@nativescript/android": "~8.1.1",

apps/demo/src/main-page.xml

+3-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<StackLayout>
88
<Button text="animated-circle" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
99
<Button text="appavailability" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
10-
1110
<Button text="auto-fit-text" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
1211
<Button text="background-http" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
1312
<Button text="brightness" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
@@ -18,9 +17,10 @@
1817
<Button text="detox" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
1918
<Button text="directions" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
2019
<Button text="email" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
20+
<Button text="facebook" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
2121
<Button text="fingerprint-auth" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
2222
<Button text="geolocation" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
23-
23+
<Button text="google-signin" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
2424
<Button text="imagepicker" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
2525
<Button text="ios-security" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
2626
<Button text="iqkeyboardmanager" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
@@ -29,10 +29,8 @@
2929
<Button text="picker" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
3030
<Button text="shared-notification-delegate" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
3131
<Button text="social-share" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
32+
<Button text="twitter" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
3233
<Button text="zip" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
33-
<Button text="facebook" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
34-
<Button text="google-signin" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
35-
<Button text="twitter" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
3634
</StackLayout>
3735
</ScrollView>
3836
</StackLayout>

packages/facebook/index.android.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export class LoginManager implements ILoginManager {
183183

184184
static init(){}
185185

186-
static logInWithPermissions(permissions: string[]): Promise<LoginResult> {
186+
static logInWithPermissions(permissions: string[], context?: any): Promise<LoginResult> {
187187
return new Promise((resolve, reject) => {
188188
if (!this.#native) {
189189
this.#native = com.facebook.login.LoginManager.getInstance();
@@ -206,7 +206,7 @@ export class LoginManager implements ILoginManager {
206206
},
207207
})
208208
);
209-
this.#native.logIn(Application.android.foregroundActivity || Application.android.startActivity, java.util.Arrays.asList(permissions));
209+
this.#native.logIn(<android.app.Activity>context || Application.android.foregroundActivity || Application.android.startActivity, java.util.Arrays.asList(permissions));
210210
});
211211
}
212212

packages/facebook/index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export declare class LoginResult implements ILoginResult {
5858
export declare class LoginManager implements ILoginManager {
5959
static init();
6060

61-
static logInWithPermissions(permissions: string[]): Promise<LoginResult>;
61+
static logInWithPermissions(permissions: string[], context?: any /* UIViewController to open from on iOS, Activity to open with on Android */): Promise<LoginResult>;
6262

6363
static logout();
6464
}

packages/facebook/index.ios.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,6 @@ export class AccessToken {
9595
return this.#expiredPermissions;
9696
}
9797

98-
get graphDomain(): string {
99-
return this.native.graphDomain;
100-
}
101-
10298
get permissions(): string[] {
10399
if (!this.#permissions) {
104100
this.#permissions = setToArray(this.native.permissions);
@@ -198,9 +194,9 @@ export class LoginManager implements ILoginManager {
198194
}
199195
}
200196

201-
static logInWithPermissions(permissions: string[]): Promise<LoginResult> {
197+
static logInWithPermissions(permissions: string[], context?: any): Promise<LoginResult> {
202198
return new Promise((resolve, reject) => {
203-
this.#native.logInWithPermissionsFromViewControllerHandler(permissions, this.topViewController, (result, error) => {
199+
this.#native.logInWithPermissionsFromViewControllerHandler(permissions, <UIViewController>context || this.topViewController, (result, error) => {
204200
if (error) {
205201
reject(FacebookError.fromNative(error));
206202
} else {

packages/facebook/package.json

+33-33
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
{
2-
"name": "@nativescript/facebook",
3-
"version": "1.0.0-alpha.1",
4-
"description": "Facebook for your NativeScript applications",
5-
"main": "index",
6-
"typings": "index.d.ts",
7-
"nativescript": {
8-
"platforms": {
9-
"ios": "6.0.0",
10-
"android": "6.0.0"
11-
}
12-
},
13-
"repository": {
14-
"type": "git",
15-
"url": "https://github.com/NativeScript/plugins.git"
16-
},
17-
"keywords": [
18-
"NativeScript",
19-
"JavaScript",
20-
"TypeScript",
21-
"iOS",
22-
"Android"
23-
],
24-
"author": {
25-
"name": "NativeScript",
26-
"email": "[email protected]"
27-
},
28-
"bugs": {
29-
"url": "https://github.com/NativeScript/plugins/issues"
30-
},
31-
"license": "Apache-2.0",
32-
"homepage": "https://github.com/NativeScript/plugins",
33-
"readmeFilename": "README.md",
34-
"bootstrapper": "@nativescript/plugin-seed"
2+
"name": "@nativescript/facebook",
3+
"version": "1.0.0-alpha.2",
4+
"description": "Facebook for your NativeScript applications",
5+
"main": "index",
6+
"typings": "index.d.ts",
7+
"nativescript": {
8+
"platforms": {
9+
"ios": "6.0.0",
10+
"android": "6.0.0"
11+
}
12+
},
13+
"repository": {
14+
"type": "git",
15+
"url": "https://github.com/NativeScript/plugins.git"
16+
},
17+
"keywords": [
18+
"NativeScript",
19+
"JavaScript",
20+
"TypeScript",
21+
"iOS",
22+
"Android"
23+
],
24+
"author": {
25+
"name": "NativeScript",
26+
"email": "[email protected]"
27+
},
28+
"bugs": {
29+
"url": "https://github.com/NativeScript/plugins/issues"
30+
},
31+
"license": "Apache-2.0",
32+
"homepage": "https://github.com/NativeScript/plugins",
33+
"readmeFilename": "README.md",
34+
"bootstrapper": "@nativescript/plugin-seed"
3535
}

packages/facebook/platforms/android/include.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ repositories {
33
}
44

55
dependencies {
6-
implementation 'com.facebook.android:facebook-core:11.2.0'
7-
implementation 'com.facebook.android:facebook-login:11.2.0'
6+
implementation 'com.facebook.android:facebook-core:12.0.0'
7+
implementation 'com.facebook.android:facebook-login:12.0.0'
88
}
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
pod 'FBSDKCoreKit', '~> 11.2'
2-
pod 'FBSDKLoginKit', '~> 11.2'
1+
pod 'FBSDKCoreKit', '~> 12.0.2'
2+
pod 'FBSDKLoginKit', '~> 12.0.2'
33
pod 'GoogleUtilities', '~> 7.5'

packages/facebook/references.d.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
/// <reference path="../../references.d.ts" />
1+
/// <reference path="../../references.d.ts" />
2+
/// <reference path="./typings/android.d.ts" />
3+
/// <reference path="./typings/objc!FBSDKCoreKit_Basics.d.ts" />
4+
/// <reference path="./typings/objc!FBSDKCoreKit.d.ts" />
5+
/// <reference path="./typings/objc!FBSDKLoginKit.d.ts" />

0 commit comments

Comments
 (0)