Skip to content

Commit 2275602

Browse files
committed
fix(HtmlTemplate): Now event parameter value can be used in the html template.
1 parent 34918ae commit 2275602

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

AndroidSDK/src/com/leanplum/ActionContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public String stringNamed(String name) {
226226
}
227227
}
228228

229-
private String fillTemplate(String value) {
229+
public String fillTemplate(String value) {
230230
if (contextualValues == null || value == null || !value.contains("##")) {
231231
return value;
232232
}

AndroidSDK/src/com/leanplum/messagetemplates/HTMLOptions.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,14 @@ private static String getTemplate(ActionContext context) {
170170
try {
171171
htmlString = (htmlTemplate.replace("##Vars##",
172172
ActionContext.mapToJsonObject(htmlArgs).toString()));
173+
try {
174+
htmlString = context.fillTemplate(htmlString);
175+
} catch (Throwable ignored) {
176+
}
173177
} catch (JSONException e) {
174178
Log.e("Leanplum", "Cannot convert map of arguments to JSON object.");
179+
} catch (Throwable t) {
180+
Log.e("Leanplum", "Cannot get html template.", t);
175181
}
176182
return htmlString.replace("\\/", "/");
177183
}

0 commit comments

Comments
 (0)