Skip to content

Commit cdd2528

Browse files
authored
feat(facebook): sdk 14.1.0 updates (#296)
closes #290
1 parent a041572 commit cdd2528

15 files changed

+3002
-2224
lines changed

packages/facebook/index.ios.ts

+7-28
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,6 @@ export class FacebookError extends Error {
2525
}
2626

2727
let appDelegateInitialized = false;
28-
let appDelegate: FacebookAppDelegateImpl;
29-
@NativeClass
30-
@ObjCClass(UIApplicationDelegate)
31-
class FacebookAppDelegateImpl extends UIResponder implements UIApplicationDelegate {
32-
static get sharedInstance() {
33-
if (!appDelegate) {
34-
appDelegate = FacebookAppDelegateImpl.alloc().init() as FacebookAppDelegateImpl;
35-
}
36-
return appDelegate;
37-
}
38-
39-
applicationOpenURLOptions(app: UIApplication, url: NSURL, options: NSDictionary<string, any>): boolean {
40-
return FBSDKApplicationDelegate.sharedInstance.applicationOpenURLOptions(app, url, options);
41-
}
42-
43-
applicationOpenURLSourceApplicationAnnotation(application: UIApplication, url: NSURL, sourceApplication: string, annotation: any): boolean {
44-
return FBSDKApplicationDelegate.sharedInstance.applicationOpenURLSourceApplicationAnnotation(application, url, sourceApplication, annotation);
45-
}
46-
applicationDidFinishLaunchingWithOptions(application: UIApplication, launchOptions: NSDictionary<string, any>): boolean {
47-
return FBSDKApplicationDelegate.sharedInstance.applicationDidFinishLaunchingWithOptions(application, launchOptions);
48-
}
49-
}
5028

5129
export class AccessToken {
5230
#native: FBSDKAccessToken;
@@ -132,8 +110,8 @@ export class AccessToken {
132110
permissions: this.permissions,
133111
refreshDate: this.refreshDate,
134112
tokenString: this.tokenString,
135-
userID: this.userID
136-
}
113+
userID: this.userID,
114+
};
137115
}
138116

139117
get native() {
@@ -198,8 +176,8 @@ export class LoginResult {
198176
declinedPermissions: this.declinedPermissions,
199177
grantedPermissions: this.grantedPermissions,
200178
isCancelled: this.isCancelled,
201-
token: this.token
202-
}
179+
token: this.token,
180+
};
203181
}
204182

205183
get native() {
@@ -220,10 +198,11 @@ export class LoginManager implements ILoginManager {
220198

221199
if (!appDelegateInitialized) {
222200
if (!Application.ios.delegate) {
223-
Application.ios.delegate = FacebookAppDelegateImpl;
201+
Application.ios.delegate = NSCFBAppDelegate;
224202
}
225203
GULAppDelegateSwizzler.proxyOriginalDelegate();
226-
GULAppDelegateSwizzler.registerAppDelegateInterceptor(FacebookAppDelegateImpl.sharedInstance);
204+
GULAppDelegateSwizzler.registerAppDelegateInterceptor(<any>NSCFBAppDelegate);
205+
227206
appDelegateInitialized = true;
228207
}
229208
}

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:13.1.0'
7-
implementation 'com.facebook.android:facebook-login:13.1.0'
6+
implementation 'com.facebook.android:facebook-core:14.1.0'
7+
implementation 'com.facebook.android:facebook-login:14.1.0'
88
}
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
pod 'FBSDKCoreKit', '~> 13.1.0'
2-
pod 'FBSDKLoginKit', '~> 13.1.0'
1+
pod 'FBSDKCoreKit', '~> 14.1.0'
2+
pod 'FBSDKLoginKit', '~> 14.1.0'
33
pod 'GoogleUtilities', '~> 7.7'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import UIKit
2+
import FBSDKCoreKit
3+
4+
@objc public class NSCFBAppDelegate: UIResponder, UIApplicationDelegate {
5+
@objc public func application(
6+
_ application: UIApplication,
7+
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
8+
) -> Bool {
9+
ApplicationDelegate.shared.application(
10+
application,
11+
didFinishLaunchingWithOptions: launchOptions
12+
)
13+
14+
return true
15+
}
16+
17+
@objc public func application(
18+
_ app: UIApplication,
19+
open url: URL,
20+
options: [UIApplication.OpenURLOptionsKey : Any] = [:]
21+
) -> Bool {
22+
ApplicationDelegate.shared.application(
23+
app,
24+
open: url,
25+
sourceApplication: options[UIApplication.OpenURLOptionsKey.sourceApplication] as? String,
26+
annotation: options[UIApplication.OpenURLOptionsKey.annotation]
27+
)
28+
}
29+
}

packages/facebook/references.d.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/// <reference path="../../references.d.ts" />
22
/// <reference path="./typings/android.d.ts" />
3+
/// <reference path="./typings/objc!objc!FBAEMKit.d.ts" />
34
/// <reference path="./typings/objc!FBSDKCoreKit_Basics.d.ts" />
45
/// <reference path="./typings/objc!FBSDKCoreKit.d.ts" />
5-
/// <reference path="./typings/objc!FBSDKLoginKit.d.ts" />
6+
/// <reference path="./typings/objc!FBSDKLoginKit.d.ts" />
7+
/// <reference path="./typings/objc!GoogleUtilties.d.ts" />

0 commit comments

Comments
 (0)