Skip to content

Commit

Permalink
Fix a bug of using uploaderAdditionalFields (#42)
Browse files Browse the repository at this point in the history
* Fix a bug of not passing uploaderAdditionalFields: JSONObject between Activities and Fragments

* Make JSONException to Exception

Co-authored-by: sungjun <[email protected]>
  • Loading branch information
SungjunApp and sungjun authored Apr 26, 2021
1 parent f0b3c12 commit f8f62a2
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions pixleesdk/src/main/java/com/pixlee/pixleesdk/data/PXLPhoto.java
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ public Integer sourceIconImage() {
}


public PXLPhoto() {
}

@Override
public int describeContents() {
return 0;
Expand Down Expand Up @@ -326,6 +329,7 @@ public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.existIn);
dest.writeString(this.collectTerm);
dest.writeString(this.albumPhotoId);
dest.writeInt(this.albumId);
dest.writeInt(this.likeCount);
dest.writeInt(this.shareCount);
dest.writeSerializable(this.actionLink);
Expand All @@ -346,11 +350,11 @@ public void writeToParcel(Parcel dest, int flags) {
dest.writeByte(this.instUserHasLiked ? (byte) 1 : (byte) 0);
dest.writeSerializable(this.platformLink);
dest.writeTypedList(this.products);
dest.writeString(this.uploaderAdditionalFields!=null ? this.uploaderAdditionalFields.toString() : "{}");
dest.writeParcelable(this.cdnPhotos, flags);
}

public PXLPhoto() {
}


protected PXLPhoto(Parcel in) {
this.id = in.readString();
Expand All @@ -376,6 +380,7 @@ protected PXLPhoto(Parcel in) {
this.existIn = in.readInt();
this.collectTerm = in.readString();
this.albumPhotoId = in.readString();
this.albumId = in.readInt();
this.likeCount = in.readInt();
this.shareCount = in.readInt();
this.actionLink = (URL) in.readSerializable();
Expand All @@ -397,10 +402,15 @@ protected PXLPhoto(Parcel in) {
this.instUserHasLiked = in.readByte() != 0;
this.platformLink = (URL) in.readSerializable();
this.products = in.createTypedArrayList(PXLProduct.CREATOR);
try {
this.uploaderAdditionalFields = new JSONObject(in.readString());
} catch (Exception e) {
e.printStackTrace();
}
this.cdnPhotos = in.readParcelable(CDNPhotos.class.getClassLoader());
}

public static final Parcelable.Creator<PXLPhoto> CREATOR = new Parcelable.Creator<PXLPhoto>() {
public static final Creator<PXLPhoto> CREATOR = new Creator<PXLPhoto>() {
@Override
public PXLPhoto createFromParcel(Parcel source) {
return new PXLPhoto(source);
Expand Down

0 comments on commit f8f62a2

Please sign in to comment.