Skip to content

Commit

Permalink
Merge pull request #30 from ashcoding/fbupgrade
Browse files Browse the repository at this point in the history
[TIMOB-19577] Android: Update to support Facebook SDK 4.7.0
  • Loading branch information
hieupham007 committed Nov 5, 2015
2 parents 4a43b7b + bb23f2d commit 6fd8bd4
Show file tree
Hide file tree
Showing 258 changed files with 3,894 additions and 1,948 deletions.
1 change: 1 addition & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#### 5.0.0
- Updated Facebook API to 4.7 in iOS, that supports iOS9 [TIMOB-19383]
- Updated Facebook API to 4.7.0 in Android [TIMOB-19577]

#### 4.0.5
- fixed presentSendRequestDialog with to and title params [MOD-2126]
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The Facebook module is used for connecting your application with Facebook. This

Getting Started
---------------
Note that this module is only available for Release 4.0.0 and later, and is included with the Titanium SDK. You do not need to download or unpack it.
Note that the min SDK for this module is 5.0.0.GA and later. You do not need to download or unpack it.
Edit the modules section of your tiapp.xml file to include this module:
```xml
<modules>
Expand Down Expand Up @@ -89,6 +89,7 @@ If you choose to enable it, you have to set the following keys and values in tia
On the android platform, in tiapp.xml or AndroidManifest.xml you must declare the following inside the \<application\> node
```xml
<activity android:name="com.facebook.LoginActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:label="YourAppName"/>
<activity android:name="com.facebook.FacebookActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:label="YourAppName" android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" />
```
You must also reference the string containing your Facebook app ID, inside the \<application\> node as well:
```xml
Expand All @@ -100,6 +101,21 @@ The app id goes into the the file /platform/android/res/values/strings.xml, wher
```
where the number is of course the app ID. The app ID is not set programmatically.

Android Key Hash for Facebook developer profile
-----------------------------------------------

Facebook requires you to add the Key Hash of the Android app in order for you to use the module. Steps to get the Key Hash as follows. Alternatively, if you do not have the correct Key Hash on the Android App, the App will give an error message when you login with the Key Hash of the App which you can then copy.

If you are using Titanium SDK 5.0.2.GA, use the path as follows.
On OS X, run:
```
keytool -exportcert -alias androiddebugkey -keystore ~/Library/Application\ Support/Titanium/mobilesdk/osx/5.0.2.GA/dev_keystore | openssl sha1 -binary | openssl base64
```

You would also require, to fill up the `Google Play Package Name` which is the Application ID and the `Class Name` which is the Application ID followed by the Application Name concatenated with the word `Activity`. Example, an App called `Kitchensink` with Application ID of `com.appcelerator.kitchensink` will have the Class Name as `com.appcelerator.kitchensink.KitchensinkActivity`. Alternatively, you can check the Class Name in `/build/android/AndroidManifest.xml` which is generated when you build the project. The launcher activity is the Class Name of the Application.

For more info, please see https://developers.facebook.com/docs/android/getting-started

Proxy required per Android activity
-----------------------------------

Expand Down
Binary file modified android/.DS_Store
Binary file not shown.
10 changes: 7 additions & 3 deletions android/documentation/changelog.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# Change Log
<pre>
v5.0.0 Updated Facebook API to 4.7 in iOS, that supports iOS9 [TIMOB-19383]
Updated Facebook API to 4.7.0 in Android [TIMOB-19577]

v4.0.5 fixed presentSendRequestDialog with to and title params [MOD-2126]

v4.0.4 fixed photo posting for requestWithGraphPath [TIMOB-18916]
presentWebShareDialog arguments do not work as documented [MOD-2122]
bumped android version for parity with iOS [TIMOB-18916]

v4.0.3 changed minsdk to 4.0.0 [mod-2119]

v4.0.2 Fixed `requestNewReadPermissions` and the `LikeButton` in Android [MOD-2105], Exposed data returned on presentSendRequestDialog [TIMOB-18712]
v4.0.2 Updated Facebook SDK from 3.21.1 to 3.23.1
Exposed data returned on presentSendRequestDialog
Bumped iOS module version to be same as android
Fixed `requestNewReadPermissions` and the `LikeButton` in Android [MOD-2105]

v4.0.1 Changing sessionDefaultAudence to audience in Android [MOD-2107]

Expand Down
2 changes: 1 addition & 1 deletion android/example/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ tabGroup.addTab(Titanium.UI.createTab({
window:require('facebook_photos').window()
}));

fb.initialize(1000); // after you set up login/logout listeners and permissions
fb.initialize(); // after you set up login/logout listeners and permissions

// open tab group
if (Ti.Platform.osname == 'android') {
Expand Down
29 changes: 8 additions & 21 deletions android/example/facebook_publish_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,24 +123,12 @@ exports.window = function(value){
});

wallDialog.addEventListener('click', function() {
if(fb.getCanPresentShareDialog()) {
fb.presentShareDialog({
link: 'https://appcelerator.com/',
name: 'great product',
description: 'Titanium is a great product',
caption: 'it rocks too',
picture: 'http://www.appcelerator.com/wp-content/uploads/scale_triangle1.png'
});
} else {
fb.presentWebShareDialog({
link: 'https://appcelerator.com/',
name: 'great product',
description: 'Titanium is a great product',
caption: 'it rocks too',
picture: 'http://www.appcelerator.com/wp-content/uploads/scale_triangle1.png'
});
}

fb.presentShareDialog({
link: 'https://appcelerator.com/',
title: 'great product',
description: 'Titanium is a great product',
picture: 'http://www.appcelerator.com/wp-content/uploads/scale_triangle1.png'
});
});

fb.addEventListener('shareCompleted', function(e){
Expand Down Expand Up @@ -171,7 +159,7 @@ exports.window = function(value){

fb.addEventListener('requestDialogCompleted', function(e) {
if (e.success) {
alert('Request dialog completed');
alert('Request dialog completed. Returned data is ' + e.data);
}
else if (e.cancelled) {
alert('Request dialog cancelled');
Expand All @@ -188,12 +176,11 @@ exports.window = function(value){
top: 230,
height: "50%", // Note: on iOS setting Ti.UI.SIZE dimensions prevented the button click
width: "50%",
objectId: "https://www.facebook.com/appcelerator", // URL or Facebook ID
objectID: "https://www.facebook.com/appcelerator", // URL or Facebook ID
foregroundColor: "white", // A color in Titanium format - see Facebook docs
likeViewStyle: 'box_count', // standard, button, box_count - see FB docs
auxiliaryViewPosition: 'inline', // bottom, inline, top - see FB docs
horizontalAlignment: 'left', // center, left, right - see FB docs,
objectType: 'page', // iOS only, 'page', 'openGraphObject', or 'unknown' - see FB docs
soundEnabled: true // boolean, iOS only
});

Expand Down
4 changes: 2 additions & 2 deletions android/example/facebook_read_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ exports.window = function(value){
return;
}

if(fb.permissions.indexOf('user_groups') < 0) {
fb.requestNewReadPermissions(['user_groups'],function(e){
if(fb.permissions.indexOf('user_managed_groups') < 0) {
fb.requestNewReadPermissions(['user_managed_groups'],function(e){
if(!e.success){
Ti.API.debug('Failed authorization due to: ' + e.error);
} else {
Expand Down
Binary file added android/lib/AudienceNetwork-fb-4.7.0.jar
Binary file not shown.
Binary file removed android/lib/bolts-android-1.1.2.jar
Binary file not shown.
Binary file added android/lib/bolts-android-1.2.1.jar
Binary file not shown.
Binary file added android/lib/facebook_sdk_470.jar
Binary file not shown.
Binary file removed android/lib/facebooksdk.jar
Binary file not shown.
6 changes: 3 additions & 3 deletions android/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 4.0.5
version: 5.0.0
apiversion: 2
architectures: armeabi armeabi-v7a x86
description: facebook
author: Mark Mokryn and Ashraf A. S. (Appcelerator)
license: Apache License Version 2.0
copyright: Copyright (c) 2014 by Mark Mokryn, Copyright (c) 2009-2015 by Appcelerator
respackage: com.facebook.android
respackage: com.facebook

# these should not be edited
name: Facebook
moduleid: facebook
guid: e4f7ac61-1ee7-44c5-bc27-fa6876e2dce9
platform: android
minsdk: 4.0.0
minsdk: 5.0.0.GA
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
File renamed without changes
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
copy, modify, and distribute this software in source code or binary form for use
in connection with the web services and APIs provided by Facebook.
As with any software that integrates with the Facebook platform, your use of
this software is subject to the Facebook Developer Principles and Policies
[http://developers.facebook.com/policy/]. This copyright 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.
-->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="@color/com_facebook_button_background_color_disabled" />
</shape>
</item>
<item android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="@color/com_facebook_button_background_color_pressed" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="@color/com_facebook_button_background_color" />
</shape>
</item>
</selector>
24 changes: 0 additions & 24 deletions android/platform/android/res/drawable/com_facebook_button_blue.xml

This file was deleted.

Diff not rendered.
Diff not rendered.
Diff not rendered.

This file was deleted.

Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
25 changes: 0 additions & 25 deletions android/platform/android/res/drawable/com_facebook_button_like.xml

This file was deleted.

Diff not rendered.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
copy, modify, and distribute this software in source code or binary form for use
in connection with the web services and APIs provided by Facebook.
As with any software that integrates with the Facebook platform, your use of
this software is subject to the Facebook Developer Principles and Policies
[http://developers.facebook.com/policy/]. This copyright 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.
-->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="@color/com_facebook_button_background_color_disabled" />
</shape>
</item>
<item android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="@color/com_facebook_button_background_color_pressed" />
</shape>
</item>
<item android:state_selected="true">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="@color/com_facebook_button_like_background_color_selected" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="@color/com_facebook_button_background_color" />
</shape>
</item>
</selector>
Diff not rendered.
Diff not rendered.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
copy, modify, and distribute this software in source code or binary form for use
in connection with the web services and APIs provided by Facebook.
As with any software that integrates with the Facebook platform, your use of
this software is subject to the Facebook Developer Principles and Policies
[http://developers.facebook.com/policy/]. This copyright 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.
-->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="@color/com_facebook_button_background_color_disabled" />
</shape>
</item>
<item android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="@color/com_facebook_button_login_silver_background_color_pressed" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<corners android:radius="2dp" />
<solid android:color="@color/com_facebook_button_login_silver_background_color" />
</shape>
</item>
</selector>
Loading

0 comments on commit 6fd8bd4

Please sign in to comment.