diff --git a/README.md b/README.md
index abd9cf51..24046169 100644
--- a/README.md
+++ b/README.md
@@ -117,6 +117,13 @@ The app id goes into the the file `/platform/android/res/values/strings.xml` (cl
```
where the number is of course the app ID. The app ID is not set programmatically.
+Finally, if using sharing capabilities, you should add the content provider settings as well:
+```xml
+
+```
+
Android Key Hash for Facebook Developer Profile
---
diff --git a/android/manifest b/android/manifest
index c1063e12..e4996461 100644
--- a/android/manifest
+++ b/android/manifest
@@ -2,7 +2,7 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
-version: 7.3.0
+version: 7.3.1
apiversion: 4
architectures: arm64-v8a armeabi-v7a x86
description: facebook
diff --git a/android/src/facebook/TiFacebookModule.java b/android/src/facebook/TiFacebookModule.java
index c5b1836f..44ae1544 100644
--- a/android/src/facebook/TiFacebookModule.java
+++ b/android/src/facebook/TiFacebookModule.java
@@ -27,6 +27,7 @@
import org.appcelerator.kroll.common.Log;
import org.appcelerator.titanium.TiApplication;
import org.appcelerator.titanium.TiBlob;
+import org.appcelerator.titanium.TiFileProxy;
import org.appcelerator.titanium.TiLifecycle.OnActivityResultEvent;
import org.appcelerator.titanium.util.TiConvert;
import org.json.JSONArray;
@@ -626,10 +627,26 @@ public void onSuccess(Sharer.Result results)
Mode mode = Mode.AUTOMATIC;
Object[] proxyPhotos = (Object[]) args.get("photos");
-
- KrollDict[] photos = Arrays.copyOf(proxyPhotos, proxyPhotos.length, KrollDict[].class);
+ KrollDict[] photos = new KrollDict[proxyPhotos.length];
SharePhotoContent shareContent = null;
+ for (int i = 0; i < proxyPhotos.length; i++) {
+ HashMap obj = (HashMap) proxyPhotos[i];
+ KrollDict dict = new KrollDict();
+
+ dict.put("photo", obj.get("photo"));
+
+ if (obj.containsKey("caption")) {
+ dict.put("caption", (String) obj.get("caption"));
+ }
+
+ if (obj.containsKey("userGenerated")) {
+ dict.put("userGenerated", (boolean) obj.get("userGenerated"));
+ }
+
+ photos[i] = dict;
+ }
+
switch (TiConvert.toInt(args.get("mode"), TiFacebookModule.SHARE_DIALOG_MODE_AUTOMATIC)) {
case TiFacebookModule.SHARE_DIALOG_MODE_NATIVE:
mode = Mode.NATIVE;
@@ -656,12 +673,15 @@ public void onSuccess(Sharer.Result results)
boolean userGenerated = proxyPhoto.optBoolean("userGenerated", false);
// A photo can either be a Blob or String
- if (photo instanceof TiBlob) {
+ if ((photo instanceof TiBlob) || (photo instanceof TiFileProxy)) {
+ if (photo instanceof TiFileProxy) {
+ photo = TiBlob.blobFromFile(((TiFileProxy) photo).getBaseFile());
+ }
photoBuilder = photoBuilder.setBitmap(((TiBlob) photo).getImage());
} else if (photo instanceof String) {
photoBuilder = photoBuilder.setImageUrl(Uri.parse((String) photo));
} else {
- Log.e(TAG, "Required \"photo\" not found or of unknown type: " + photo.getClass().getSimpleName());
+ Log.e(TAG, "Required \"photo\" not found or of unknown type: " + photo.getClass().getName());
}
// An optional caption
@@ -681,8 +701,10 @@ public void onSuccess(Sharer.Result results)
Log.e(TAG, "The \"photos\" property is required when showing a photo share dialog.");
}
- if (shareDialog != null && shareDialog.canShow(shareContent, mode)) {
- shareDialog.show(shareContent, mode);
+ if (shareDialog != null && shareDialog.canShow(SharePhotoContent.class)) {
+ shareDialog.show(shareContent);
+ } else {
+ Log.e(TAG, "Cannot show image share dialog due to unsupported device or configuration!");
}
}
diff --git a/apidoc/Facebook.yml b/apidoc/Facebook.yml
index 5315ed7f..4af288c2 100644
--- a/apidoc/Facebook.yml
+++ b/apidoc/Facebook.yml
@@ -166,6 +166,10 @@ description: |
android:label="YourAppName"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" />
+
+
@@ -593,6 +597,13 @@ methods:
Note: The `images` parameter is **required** by the Facebook SDK.
+ Android Note: In order to share images on Android, the Facebook app needs to be installed and the
+ "content provider" settings in your Android manifest needs to be configured:
+
+
+
Listen for the to be notified if the attempt was
successful or not.
parameters: