From 7e4a62c59511c83240311c7254a734540790dc03 Mon Sep 17 00:00:00 2001 From: Hans Christian Ang Date: Fri, 17 Jan 2014 16:27:34 +0800 Subject: [PATCH 1/2] Added JSON response on FB.ui callback --- src/android/ConnectPlugin.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/android/ConnectPlugin.java b/src/android/ConnectPlugin.java index a8b35a5a3..3762cffdd 100644 --- a/src/android/ConnectPlugin.java +++ b/src/android/ConnectPlugin.java @@ -240,7 +240,15 @@ public UIDialogListener(ConnectPlugin fba){ public void onComplete(Bundle values) { // Handle a successful dialog Log.d(TAG,values.toString()); - this.fba.cb.success(); + try { + JSONObject response = new JSONObject(); + for(String key : values.keySet()) { + response.put(key, values.getString(key)); + } + this.fba.cb.success(response); + } catch (JSONException e) { + e.printStackTrace(); + } } public void onFacebookError(FacebookError e) { From 613c1e43f00a4d862f0412928040c6481a90cf98 Mon Sep 17 00:00:00 2001 From: Hans Christian Ang Date: Fri, 31 Jan 2014 01:16:24 +0800 Subject: [PATCH 2/2] Fixed indentation and added success callback on JSONException. --- src/android/ConnectPlugin.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/android/ConnectPlugin.java b/src/android/ConnectPlugin.java index 3762cffdd..337444d50 100644 --- a/src/android/ConnectPlugin.java +++ b/src/android/ConnectPlugin.java @@ -240,15 +240,16 @@ public UIDialogListener(ConnectPlugin fba){ public void onComplete(Bundle values) { // Handle a successful dialog Log.d(TAG,values.toString()); - try { - JSONObject response = new JSONObject(); - for(String key : values.keySet()) { - response.put(key, values.getString(key)); - } - this.fba.cb.success(response); - } catch (JSONException e) { - e.printStackTrace(); - } + JSONObject response = new JSONObject();; + try { + for(String key : values.keySet()) { + response.put(key, values.getString(key)); + } + } catch (JSONException e) { + e.printStackTrace(); + } finally { + this.fba.cb.success(response); + } } public void onFacebookError(FacebookError e) {