Skip to content

Commit

Permalink
Fix task deserialization issue
Browse files Browse the repository at this point in the history
  • Loading branch information
phillipthelen committed Sep 18, 2018
1 parent fe90b25 commit f18943e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ open class Task : RealmObject, Parcelable {
@PrimaryKey
@SerializedName("_id")
var id: String? = null
set(value) {
field = value
repeat?.taskId = value
}
var userId: String = ""
var priority: Float = 0.0f
var text: String = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class SubscriptionPlan extends RealmObject {
public Integer gemsBought;
public Integer extraMonths;
public Integer quantity;
@Nullable
public SubscriptionPlanConsecutive consecutive;

public int mysteryItemCount;
Expand All @@ -39,7 +40,7 @@ public boolean isActive() {
}

public int totalNumberOfGems() {
if (customerId == null) {
if (customerId == null || consecutive == null) {
return 0;
}
return 25 + consecutive.getGemCapExtra();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ class SubscriptionDetailsView : LinearLayout {

paymentProcessorTextView.text = plan.paymentMethod

if (plan.consecutive.count == 1) {
if (plan.consecutive?.count == 1) {
monthsSubscribedTextView.text = resources.getString(R.string.one_month)
} else {
monthsSubscribedTextView.text = resources.getString(R.string.months, plan.consecutive.count)
monthsSubscribedTextView.text = resources.getString(R.string.months, plan.consecutive?.count ?: 0)
}
gemCapTextView.text = (plan.consecutive.gemCapExtra + 25).toString()
currentHourglassesTextView.text = plan.consecutive.trinkets.toString()
gemCapTextView.text = (plan.consecutive?.gemCapExtra ?: 0 + 25).toString()
currentHourglassesTextView.text = plan.consecutive?.trinkets.toString()

if (plan.paymentMethod != null) {
if (plan.paymentMethod == "Google") {
Expand Down

0 comments on commit f18943e

Please sign in to comment.