-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from rees46/feat/stories-addTextBlocks
feat: stories - add text blocks
- Loading branch information
Showing
36 changed files
with
1,714 additions
and
870 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -280,7 +280,7 @@ REES46.subscribeForBackInStock("PRODUCT_ID", properties, "[email protected]", nul | |
Add code to your layout: | ||
|
||
```xml | ||
<com.personalizatio.stories.StoriesView | ||
<com.personalizatio.stories.views.StoriesView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
app:code="STORY BLOCK CODE" /> | ||
|
135 changes: 84 additions & 51 deletions
135
personalizatio-sdk/src/main/java/com/personalizatio/Product.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,95 @@ | ||
package com.personalizatio; | ||
|
||
import org.json.JSONException; | ||
import androidx.annotation.NonNull; | ||
|
||
import org.json.JSONObject; | ||
|
||
final public class Product { | ||
public final String id; | ||
public final String name; | ||
public final String brand; | ||
public final String image; | ||
public final String oldprice; | ||
public final String price; | ||
public final String discount; | ||
public final String url; | ||
public final String deeplink; | ||
public final String promocode; | ||
public final String price_with_promocode; | ||
public final String discount_percent; | ||
|
||
public Product(JSONObject product) throws JSONException { | ||
id = product.getString("id"); | ||
name = product.getString("name"); | ||
image = product.getString("image_url"); | ||
if( product.has("oldprice") && product.getDouble("oldprice") > 0 ) { | ||
oldprice = product.getString("oldprice_formatted"); | ||
} else { | ||
oldprice = null; | ||
} | ||
if( product.has("brand") ) { | ||
brand = product.getString("brand"); | ||
} else { | ||
brand = null; | ||
} | ||
if( product.has("promocode") ) { | ||
promocode = product.getString("promocode"); | ||
} else { | ||
promocode = null; | ||
} | ||
if( product.has("price_with_promocode") ) { | ||
price_with_promocode = product.getString("price_with_promocode_formatted"); | ||
} else { | ||
price_with_promocode = null; | ||
private final String id; | ||
private final String name; | ||
private final String brand; | ||
private final String image; | ||
private final String oldPrice; | ||
private final String price; | ||
private final String discount; | ||
private final String url; | ||
private final String deeplink; | ||
private final String promocode; | ||
private final String priceWithPromocode; | ||
private final String discountPercent; | ||
|
||
public Product(@NonNull JSONObject json) { | ||
id = json.optString("id", ""); | ||
name = json.optString("name", ""); | ||
image = json.optString("image_url", ""); | ||
var oldPriceValue = json.optDouble("oldprice", 0); | ||
if (oldPriceValue > 0) { | ||
oldPrice = json.optString("oldprice_formatted", ""); | ||
} | ||
if( product.has("discount_percent") ) { | ||
discount_percent = product.getString("discount_percent"); | ||
} else { | ||
discount_percent = null; | ||
else { | ||
oldPrice = ""; | ||
} | ||
price = product.getString("price_formatted"); | ||
url = product.getString("url"); | ||
if( product.has("deeplink_android") ) { | ||
deeplink = product.getString("deeplink_android"); | ||
} else { | ||
deeplink = null; | ||
brand = json.optString("brand", ""); | ||
promocode = json.optString("promocode", ""); | ||
priceWithPromocode = json.optString("price_with_promocode_formatted", ""); | ||
discountPercent = json.optString("discount_percent", ""); | ||
price = json.optString("price_formatted", ""); | ||
url = json.optString("url", ""); | ||
deeplink = json.optString("deeplink_android", ""); | ||
var priceValue = json.optDouble("price", 0); | ||
if (oldPriceValue > 0 && oldPriceValue > priceValue) { | ||
discount = json.optString("discount", ""); | ||
} | ||
if( product.has("discount") && product.getDouble("oldprice") > 0 && product.getDouble("oldprice") > product.getDouble("price") ) { | ||
discount = product.getString("discount"); | ||
} else { | ||
discount = null; | ||
else { | ||
discount = ""; | ||
} | ||
} | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getBrand() { | ||
return brand; | ||
} | ||
|
||
public String getImage() { | ||
return image; | ||
} | ||
|
||
public String getOldPrice() { | ||
return oldPrice; | ||
} | ||
|
||
public String getPrice() { | ||
return price; | ||
} | ||
|
||
public String getDiscount() { | ||
return discount; | ||
} | ||
|
||
public String getUrl() { | ||
return url; | ||
} | ||
|
||
public String getDeeplink() { | ||
return deeplink; | ||
} | ||
|
||
public String getPromocode() { | ||
return promocode; | ||
} | ||
|
||
public String getPriceWithPromocode() { | ||
return priceWithPromocode; | ||
} | ||
|
||
public String getDiscountPercent() { | ||
return discountPercent; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 0 additions & 121 deletions
121
personalizatio-sdk/src/main/java/com/personalizatio/stories/Story.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.