Skip to content

Commit

Permalink
fix: social should be optional in android
Browse files Browse the repository at this point in the history
I also added stack traces for debugging, that was how I found it
  • Loading branch information
mikehardy committed Aug 14, 2019
1 parent 8359e6f commit abad39d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
20 changes: 10 additions & 10 deletions android/src/main/java/cl/json/RNShareModule.java
Expand Up @@ -133,12 +133,12 @@ public void open(ReadableMap options, @Nullable Callback failureCallback, @Nulla
GenericShare share = new GenericShare(this.reactContext);
share.open(options);
} catch (ActivityNotFoundException ex) {
System.out.println("ERROR");
System.out.println(ex.getMessage());
System.out.println("ERROR " + ex.getMessage());
ex.printStackTrace(System.out);
TargetChosenReceiver.sendCallback(false, "not_available");
} catch (Exception e) {
System.out.println("ERROR");
System.out.println(e.getMessage());
System.out.println("ERROR " + e.getMessage());
e.printStackTrace(System.out);
TargetChosenReceiver.sendCallback(false, e.getMessage());
}
}
Expand All @@ -156,12 +156,12 @@ public void shareSingle(ReadableMap options, @Nullable Callback failureCallback,
throw new ActivityNotFoundException("Invalid share activity");
}
} catch (ActivityNotFoundException ex) {
System.out.println("ERROR");
System.out.println(ex.getMessage());
System.out.println("ERROR " + ex.getMessage());
ex.printStackTrace(System.out);
TargetChosenReceiver.sendCallback(false, ex.getMessage());
} catch (Exception e) {
System.out.println("ERROR");
System.out.println(e.getMessage());
System.out.println("ERROR " + e.getMessage());
e.printStackTrace(System.out);
TargetChosenReceiver.sendCallback(false, e.getMessage());
}
} else {
Expand Down Expand Up @@ -191,8 +191,8 @@ public void isBase64File(String url, @Nullable Callback failureCallback, @Nullab
successCallback.invoke(false);
}
} catch (Exception e) {
System.out.println("ERROR");
System.out.println(e.getMessage());
System.out.println("ERROR " + e.getMessage());
e.printStackTrace(System.out);
failureCallback.invoke(e.getMessage());
}
}
Expand Down
6 changes: 4 additions & 2 deletions android/src/main/java/cl/json/social/ShareIntent.java
Expand Up @@ -56,8 +56,10 @@ public void open(ReadableMap options) throws ActivityNotFoundException {
message = options.getString("message");
}

String socialType = options.getString("social");

String socialType = "";
if (ShareIntent.hasValidKey("social", options)) {
socialType = options.getString("social");
}
if (socialType.equals("whatsapp")) {
String whatsAppNumber = options.getString("whatsAppNumber");
if (!whatsAppNumber.isEmpty()) {
Expand Down

0 comments on commit abad39d

Please sign in to comment.