Skip to content
This repository was archived by the owner on Apr 2, 2021. It is now read-only.

Commit c4479dd

Browse files
Expose API for CCPA compliance and iOS 14 ATE (#804)
* Expose API for CCPA compliance and iOS 14 ATE * address PR comments * upload missed changes * run prettier * Use Promise.resolve instead of new Promise Co-authored-by: Stan Wu <[email protected]> Co-authored-by: Janic Duplessis <[email protected]>
1 parent fd54d9f commit c4479dd

File tree

9 files changed

+381
-212
lines changed

9 files changed

+381
-212
lines changed

android/build.gradle

+2-4
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,10 @@ repositories {
4545
jcenter()
4646
}
4747

48-
def FACEBOOK_SDK_VERSION = safeExtGet('facebookSdkVersion', '[7.0,8.0[')
48+
def FACEBOOK_SDK_VERSION = safeExtGet('facebookSdkVersion', '[7.1.0, 9)')
4949

5050
dependencies {
5151
//noinspection GradleDynamicVersion
5252
implementation "com.facebook.react:react-native:+" // From node_modules
53-
implementation "com.facebook.android:facebook-core:${FACEBOOK_SDK_VERSION}"
54-
implementation "com.facebook.android:facebook-login:${FACEBOOK_SDK_VERSION}"
55-
implementation "com.facebook.android:facebook-share:${FACEBOOK_SDK_VERSION}"
53+
implementation "com.facebook.android:facebook-android-sdk:${FACEBOOK_SDK_VERSION}"
5654
}

android/src/main/java/com/facebook/reactnative/androidsdk/FBSDKPackage.java

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public List<NativeModule> createNativeModules(
4242
new FBGraphRequestModule(reactContext),
4343
new FBLoginManagerModule(reactContext, mActivityEventListener),
4444
new FBMessageDialogModule(reactContext, mActivityEventListener),
45+
new FBSettingsModule(),
4546
new FBShareDialogModule(reactContext, mActivityEventListener)
4647
);
4748
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
package com.facebook.reactnative.androidsdk;
10+
11+
import androidx.annotation.Nullable;
12+
13+
import com.facebook.FacebookSdk;
14+
import com.facebook.react.bridge.BaseJavaModule;
15+
import com.facebook.react.bridge.ReactMethod;
16+
import com.facebook.react.module.annotations.ReactModule;
17+
18+
/**
19+
* This is a {@link NativeModule} that allows JS to use SDK settings in Facebook Android SDK.
20+
*/
21+
@ReactModule(name = FBSettingsModule.NAME)
22+
public class FBSettingsModule extends BaseJavaModule {
23+
24+
public static final String NAME = "FBSettings";
25+
26+
public FBSettingsModule() {}
27+
28+
@Override
29+
public String getName() {
30+
return NAME;
31+
}
32+
33+
/**
34+
* Sets data processing options
35+
* @param options list of the options
36+
*/
37+
@ReactMethod
38+
public void setDataProcessingOptions(@Nullable String[] options) {
39+
FacebookSdk.setDataProcessingOptions(options, 0, 0);
40+
}
41+
42+
/**
43+
* Sets data processing options with country and state
44+
* @param options list of the options
45+
* @param country code of the country
46+
* @param state code of the state
47+
*/
48+
@ReactMethod
49+
public static void setDataProcessingOptionsExtra(@Nullable String[] options, int country, int state) {
50+
FacebookSdk.setDataProcessingOptions(options, country, state);
51+
}
52+
}

0 commit comments

Comments
 (0)