Skip to content

Commit

Permalink
feat: Upgrade SDK to 9 + clean up on old FB stuff.
Browse files Browse the repository at this point in the history
Changes in upgrading FB SDK version from: facebookarchive/react-native-fbsdk#833
  • Loading branch information
Marcos Bergamo committed Mar 9, 2021
1 parent 4577507 commit 6fa5d82
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 78 deletions.
20 changes: 1 addition & 19 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,19 +1 @@
Facebook welcomes contributions to our SDKs.

All contributors must sign a CLA (contributor license agreement) here:

https://developers.facebook.com/opensource/cla

To contribute on behalf of your employer, sign the company CLA
To contribute on behalf of yourself, sign the individual CLA

All contributions:

1/ MUST be be licensed using the Apache License, Version 2.0
2/ authors MAY retain copyright by adding their copyright notice to the appropriate flies

More information on the Apache License can be found here: http://www.apache.org/foundation/license-faq.html

## Code of Conduct

Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read the [full text](https://code.fb.com/codeofconduct/) so that you can understand what actions will and will not be tolerated.
TO BE DEFINED YET
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2021 Marcos Bérgamo

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
17 changes: 0 additions & 17 deletions LICENSE.txt

This file was deleted.

50 changes: 23 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# React Native FBSDK
# React Native FBSDK Next

This project aims to keep continuity of the [React Native FBSDK](https://github.com/facebook/react-native-fbsdk) from Facebook. As Facebook dropped support from it. As a community for this is our effort in order to keep upgrading and improving support for this module.

React Native FBSDK is a wrapper around the iOS Facebook SDK and Android Facebook SDK, allowing for Facebook integration in [React Native](https://facebook.github.io/react-native/) apps. Access to native components, from login to sharing, is provided entirely through documented JavaScript modules so you don't have to call a single native function directly.

Expand All @@ -16,23 +18,24 @@ Functionality is provided through one single npm package so you can use it for b
## React Native Compatibility
To use this library you need to ensure you match up with the correct version of React Native you are using.

| `react-native-fbsdk` version | Required React Native Version |
| ----------------------------------------- | --------------------------------------------------------------------------------- |
| `>= 1.0.0` | `>= 0.60` |
| `<= 0.10` | `<= 0.59.x` |
| FB SDK | lib version | Required React Native Version |
| --------- | ------------------------------------- | ----------------------------- |
| >= 9.0.0+ | `react-native-fbsdk-next` `>= 3.0.1` | `>= 0.60` |
| <= 8.0.1 | `react-native-fbsdk` `>= 1.0.0` | `>= 0.60` |
| <= 8.0.1 | `react-native-fbsdk` `<= 0.10` | `<= 0.59.x` |

### 1. Install the library

using either Yarn:

```
yarn add react-native-fbsdk
yarn add react-native-fbsdk-next
```

or npm:

```
npm install --save react-native-fbsdk
npm install --save react-native-fbsdk-next
```

### 2. Link
Expand All @@ -51,10 +54,7 @@ $ cd ios/ && pod install

- **React Native <= 0.59**


```bash
$ react-native link react-native-fbsdk
```
> For support with React Native <= 0.59, please refer to [React Native FBSDK](https://github.com/facebook/react-native-fbsdk)
If you can't or don't want to use the CLI tool, you can also manually link the library using the instructions below (click on the arrow to show them):

Expand All @@ -76,15 +76,15 @@ Make the following changes:

#### `android/settings.gradle`
```groovy
include ':react-native-fbsdk'
project(':react-native-fbsdk').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fbsdk/android')
include ':react-native-fbsdk-next'
project(':react-native-fbsdk-next').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fbsdk-next/android')
```

#### `android/app/build.gradle`
```groovy
dependencies {
...
implementation project(':react-native-fbsdk')
implementation project(':react-native-fbsdk-next')
}
```

Expand Down Expand Up @@ -169,7 +169,7 @@ The `AppDelegate.m` file can only have one method for `openUrl`. If you're also
```js
import React, { Component } from 'react';
import { View } from 'react-native';
import { LoginButton, AccessToken } from 'react-native-fbsdk';
import { LoginButton, AccessToken } from 'react-native-fbsdk-next';

export default class Login extends Component {
render() {
Expand Down Expand Up @@ -205,7 +205,7 @@ You can also use the Login Manager with custom UI to perform Login.
```js
// ...

import { LoginManager } from "react-native-fbsdk";
import { LoginManager } from "react-native-fbsdk-next";

// ...

Expand Down Expand Up @@ -236,7 +236,7 @@ All of the dialogs included are used in a similar way, with differing content ty
```js
// ...

import { ShareDialog } from 'react-native-fbsdk';
import { ShareDialog } from 'react-native-fbsdk-next';

// ...

Expand Down Expand Up @@ -279,7 +279,7 @@ shareLinkWithShareDialog() {
See [SharePhotoContent](/js/models/FBSharePhotoContent.js) and [SharePhoto](/js/models/FBSharePhoto.js) to refer other options.

```js
const FBSDK = require('react-native-fbsdk');
const FBSDK = require('react-native-fbsdk-next');
const {
ShareApi,
} = FBSDK;
Expand All @@ -300,7 +300,7 @@ ShareDialog.show(tmp.state.sharePhotoContent);
See [ShareVideoContent](/js/models/FBShareVideoContent.js) and [ShareVideo](/js/models/FBShareVideo.js) to refer other options.

```js
const FBSDK = require('react-native-fbsdk');
const FBSDK = require('react-native-fbsdk-next');
const {
ShareApi,
} = FBSDK;
Expand All @@ -323,7 +323,7 @@ Your app must have the `publish_actions` permission approved to share through th
```js
// ...

import { ShareApi } from 'react-native-fbsdk';
import { ShareApi } from 'react-native-fbsdk-next';

// ...

Expand Down Expand Up @@ -361,7 +361,7 @@ ShareApi.canShare(this.state.shareLinkContent).then(
```js
// ...

import { AppEventsLogger } from "react-native-fbsdk";
import { AppEventsLogger } from "react-native-fbsdk-next";

// ...

Expand All @@ -376,7 +376,7 @@ AppEventsLogger.logPurchase(15, "USD", { param: "value" });
```js
// ...

import { GraphRequest, GraphRequestManager } from 'react-native-fbsdk';
import { GraphRequest, GraphRequestManager } from 'react-native-fbsdk-next';

// ...

Expand Down Expand Up @@ -419,8 +419,4 @@ See the [CONTRIBUTING](./CONTRIBUTING.md) file for how to help out.
## License
See the LICENSE file.
## Platform Policy
Developers looking to integrate with the Facebook Platform should familiarize themselves with the [Facebook Platform Policy](https://developers.facebook.com/policy/).
See the LICENSE file.
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ repositories {
jcenter()
}

def FACEBOOK_SDK_VERSION = safeExtGet('facebookSdkVersion', '[7.1.0, 9)')
def FACEBOOK_SDK_VERSION = safeExtGet('facebookSdkVersion', '9.0.+')

dependencies {
//noinspection GradleDynamicVersion
Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
'module-resolver',
{
alias: {
'react-native-fbsdk': './src',
'react-native-fbsdk-next': './src',
},
},
],
Expand Down
1 change: 1 addition & 0 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ allprojects {
google()
jcenter()
maven { url 'https://www.jitpack.io' }
mavenCentral()
}
}
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ platform :ios, "10.0"
target 'RNFBSDKExample' do
use_react_native!(path: $react_native_path)

pod 'react-native-fbsdk', :path => '../../'
pod 'react-native-fbsdk-next', :path => '../../'
end
17 changes: 10 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
{
"name": "react-native-fbsdk",
"version": "3.0.0",
"name": "react-native-fbsdk-next",
"version": "3.0.1",
"description": "Facebook SDK support for React Native apps.",
"main": "lib/commonjs/index.js",
"module": "lib/module/index.js",
"react-native": "src/index.js",
"sideEffects": false,
"author": {
"name": "Zhuowen Deng"
"name": "Marcos Bérgamo"
},
"contributors": [
{
"name": "Zhuowen Deng"
},
{
"name": "Chris Hackmann"
},
Expand All @@ -25,9 +28,9 @@
],
"repository": {
"type": "git",
"url": "git+https://github.com/facebook/react-native-fbsdk.git"
"url": "git+https://github.com/thebergamo/react-native-fbsdk-next.git"
},
"homepage": "https://github.com/facebook/react-native-fbsdk/",
"homepage": "https://github.com/thebergamo/react-native-fbsdk-next/",
"keywords": [
"react",
"react-native",
Expand All @@ -37,7 +40,7 @@
"facebook",
"core"
],
"license": "Facebook Platform License",
"license": "MIT",
"scripts": {
"start": "react-native start",
"prepare": "bob build",
Expand All @@ -59,7 +62,7 @@
"src",
"LICENSE.txt",
"README.md",
"react-native-fbsdk.podspec"
"react-native-fbsdk-next.podspec"
],
"dependencies": {},
"peerDependencies": {
Expand Down
10 changes: 5 additions & 5 deletions react-native-fbsdk.podspec → react-native-fbsdk-next.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ Pod::Spec.new do |s|
s.version = package['version']
s.summary = package['description']
s.requires_arc = true
s.author = { 'dzhuowen' => 'dzhuowen@fb.com' }
s.author = { 'thebergamo' => 'marcos@thedon.com.br' }
s.license = package['license']
s.homepage = package['homepage']
s.source = { :git => 'https://github.com/facebook/react-native-fbsdk.git', :tag => "v#{package['version']}" }
s.source = { :git => 'https://github.com/thebergamo/react-native-fbsdk-next.git', :tag => "v#{package['version']}" }
s.platforms = { :ios => "9.0", :tvos => "9.2" }
s.dependency 'React'

s.subspec 'Core' do |ss|
ss.dependency 'FBSDKCoreKit', '~> 8.1'
ss.dependency 'FBSDKCoreKit', '~> 9.0'
ss.source_files = 'ios/RCTFBSDK/core/*.{h,m}'
end

s.subspec 'Login' do |ss|
ss.dependency 'FBSDKLoginKit', '~> 8.1'
ss.dependency 'FBSDKLoginKit', '~> 9.0'
ss.source_files = 'ios/RCTFBSDK/login/*.{h,m}'
end

s.subspec 'Share' do |ss|
ss.dependency 'FBSDKShareKit', '~> 8.1'
ss.dependency 'FBSDKShareKit', '~> 9.0'
ss.source_files = 'ios/RCTFBSDK/share/*.{h,m}'
end
end

0 comments on commit 6fa5d82

Please sign in to comment.