Skip to content

Commit d540c49

Browse files
authored
Fix Open URL to be action in Dashboard (#435)
1 parent 8a833b8 commit d540c49

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

AndroidSDKCore/src/main/java/com/leanplum/messagetemplates/MessageTemplates.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,36 @@ public void run() {
8787

8888
/**
8989
* Registers a message template to respond to a given action.
90+
* Will be shown in the templates group in Dashboard.
9091
*
9192
* @param template Wrapper for action name, action arguments and handler.
9293
* @param context Android context
9394
*/
9495
public static void registerTemplate(
9596
@NonNull MessageTemplate template,
9697
@NonNull Context context) {
98+
register(template, context, Leanplum.ACTION_KIND_MESSAGE | Leanplum.ACTION_KIND_ACTION);
99+
}
100+
101+
/**
102+
* Registers an action template to respond to a given action.
103+
* Will be shown in the actions group in Dashboard.
104+
*
105+
* @param template Wrapper for action name, action arguments and handler.
106+
* @param context Android context
107+
*/
108+
public static void registerAction(
109+
@NonNull MessageTemplate template,
110+
@NonNull Context context) {
111+
register(template, context, Leanplum.ACTION_KIND_ACTION);
112+
}
113+
114+
private static void register(
115+
@NonNull MessageTemplate template,
116+
@NonNull Context context,
117+
int kind) {
97118

98119
String name = template.getName();
99-
int kind = Leanplum.ACTION_KIND_MESSAGE | Leanplum.ACTION_KIND_ACTION;
100120
ActionArgs args = template.createActionArgs(context);
101121

102122
ActionCallback callback;
@@ -115,7 +135,7 @@ public synchronized static void register(Context context) {
115135
}
116136
registered = true;
117137

118-
registerTemplate(new OpenUrlAction(), context);
138+
registerAction(new OpenUrlAction(), context);
119139
registerTemplate(new AlertMessage(), context);
120140
registerTemplate(new ConfirmMessage(), context);
121141
registerTemplate(new CenterPopupMessage(), context);

0 commit comments

Comments
 (0)