Skip to content

Commit

Permalink
fixes compile issue with Android
Browse files Browse the repository at this point in the history
  • Loading branch information
vegaro committed Nov 6, 2018
1 parent 0b823b8 commit 66ff66d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions android/src/main/java/com/reactlibrary/RNPurchasesModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void setupPurchases(String apiKey, String appUserID, final Promise promis
purchases = new Purchases.Builder(reactContext, apiKey, this).appUserID(appUserID).build();
promise.resolve(null);
}

@ReactMethod
public void setIsUsingAnonymousID(boolean isUsingAnonymousID) {
checkPurchases();
Expand All @@ -95,14 +95,18 @@ private WritableMap mapForSkuDetails(final SkuDetails detail) {
map.putString("title", detail.getTitle());
map.putDouble("price", detail.getPriceAmountMicros() / 1000000d);
map.putString("price_string", detail.getPrice());

map.putString("intro_price", detail.getIntroductoryPriceAmountMicros() / 1000000d);
String introductoryPriceAmountMicros = detail.getIntroductoryPriceAmountMicros();
if (introductoryPriceAmountMicros != null && !introductoryPriceAmountMicros.isEmpty()) {
map.putString("intro_price", String.valueOf(Long.parseLong(introductoryPriceAmountMicros) / 1000000d));
} else {
map.putString("intro_price", "");
}
map.putString("intro_price_string", detail.getIntroductoryPrice());
map.putString("intro_price_period", detail.getIntroductoryPricePeriod());
map.putString("intro_price_cycles", detail.getIntroductoryPriceCycles());

map.putString("currency_code", detail.getPriceCurrencyCode());

return map;
}

Expand Down Expand Up @@ -370,5 +374,5 @@ private static JSONArray convertArrayToJson(ReadableArray readableArray) throws
}
return array;
}

}

0 comments on commit 66ff66d

Please sign in to comment.