Commit ad07675b authored by Luca Hunkeler's avatar Luca Hunkeler Committed by Commit Bot

[Autofill Assistant] Informational message with prompt in show form action.

This adds an optional message below the form in the show action form.
At the message's right there is a tappable icon that prompts a message.
In the prompt it's possible to add a button that opens an URL.


Bug: b/144083252
Change-Id: Iaa02a0660cc1f9cc7246e620f0579346a4d2d494
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1940174
Commit-Queue: Luca Hunkeler <hluca@google.com>
Reviewed-by: default avatarClemens Arbesser <arbesser@google.com>
Cr-Commit-Position: refs/heads/master@{#721682}
parent 96d77b49
......@@ -72,7 +72,9 @@ android_library("java") {
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomBarCoordinator.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomSheetContent.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantCoordinator.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantDialogButton.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantKeyboardCoordinator.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantInfoPopup.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantModel.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingCoordinator.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantPeekHeightCoordinator.java",
......@@ -138,7 +140,6 @@ android_library("java") {
"java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantLoginSection.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataSection.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataNativeDelegate.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantInfoPopup.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantPaymentMethodSection.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataModel.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantDateChoiceOptions.java",
......@@ -159,6 +160,8 @@ android_library("java") {
generate_jni("jni_headers") {
sources = [
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantDialogButton.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantInfoPopup.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/AssistantModel.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantClient.java",
"java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionImpl.java",
......
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2019 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/autofill_assistant_bottombar_horizontal_spacing"
android:layout_marginEnd="@dimen/autofill_assistant_bottombar_horizontal_spacing"
android:visibility="gone"
android:gravity="center">
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textAppearance="@style/TextAppearance.AssistantBlackCaption" />
<org.chromium.ui.widget.ChromeImageView
android:id="@+id/info_button"
android:layout_width="32dp"
android:layout_height="32dp"
android:padding="8dp"
android:layout_gravity="center_vertical|end"
android:scaleType="centerCrop"
android:contentDescription="@string/learn_more"
android:gravity="center"
android:visibility="gone"
app:srcCompat="@drawable/btn_info" />
</LinearLayout>
......@@ -26,6 +26,7 @@ import org.chromium.chrome.browser.autofill_assistant.carousel.AssistantChip;
import org.chromium.chrome.browser.autofill_assistant.carousel.AssistantSuggestionsCarouselCoordinator;
import org.chromium.chrome.browser.autofill_assistant.details.AssistantDetailsCoordinator;
import org.chromium.chrome.browser.autofill_assistant.form.AssistantFormCoordinator;
import org.chromium.chrome.browser.autofill_assistant.form.AssistantFormModel;
import org.chromium.chrome.browser.autofill_assistant.header.AssistantHeaderCoordinator;
import org.chromium.chrome.browser.autofill_assistant.header.AssistantHeaderModel;
import org.chromium.chrome.browser.autofill_assistant.infobox.AssistantInfoBoxCoordinator;
......@@ -243,9 +244,8 @@ class AssistantBottomBarCoordinator
});
// Animate when form inputs change.
model.getFormModel().getInputsModel().addObserver(new AbstractListObserver<Void>() {
@Override
public void onDataSetChanged() {
model.getFormModel().addObserver((source, propertyKey) -> {
if (AssistantFormModel.INPUTS == propertyKey) {
animateChildren(rootView);
}
});
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.autofill_assistant;
import android.content.Context;
import android.support.annotation.Nullable;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.chrome.browser.customtabs.CustomTabActivity;
/**
* Represents a button.
*/
@JNINamespace("autofill_assistant")
public class AssistantDialogButton {
private String mLabel;
@Nullable
private String mUrl;
@CalledByNative
public AssistantDialogButton(String label, @Nullable String url) {
mLabel = label;
mUrl = url;
}
public void onClick(Context context) {
if (mUrl != null) {
CustomTabActivity.showInfoPage(context, mUrl);
}
}
public String getLabel() {
return mLabel;
}
}
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.autofill_assistant;
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.app.AlertDialog;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.ui.UiUtils;
/**
* Represents a simple info popup.
*/
@JNINamespace("autofill_assistant")
public class AssistantInfoPopup {
private final String mTitle;
private final String mText;
@Nullable
private final AssistantDialogButton mPositiveButton;
@Nullable
private final AssistantDialogButton mNegativeButton;
@Nullable
private final AssistantDialogButton mNeutralButton;
@CalledByNative
public AssistantInfoPopup(String title, String text,
@Nullable AssistantDialogButton positiveButton,
@Nullable AssistantDialogButton negativeButton,
@Nullable AssistantDialogButton neutralButton) {
mTitle = title;
mText = text;
mPositiveButton = positiveButton;
mNegativeButton = negativeButton;
mNeutralButton = neutralButton;
}
public String getTitle() {
return mTitle;
}
public String getText() {
return mText;
}
public void show(Context context) {
AlertDialog.Builder builder = new UiUtils
.CompatibleAlertDialogBuilder(context,
org.chromium.chrome.autofill_assistant.R.style
.Theme_Chromium_AlertDialog)
.setTitle(mTitle)
.setMessage(mText);
if (mPositiveButton != null) {
builder.setPositiveButton(mPositiveButton.getLabel(),
(dialog, which) -> mPositiveButton.onClick(context));
}
if (mNegativeButton != null) {
builder.setNegativeButton(mNegativeButton.getLabel(),
(dialog, which) -> mNegativeButton.onClick(context));
}
if (mNeutralButton != null) {
builder.setNeutralButton(
mNeutralButton.getLabel(), (dialog, which) -> mNeutralButton.onClick(context));
}
builder.show();
}
}
\ No newline at end of file
......@@ -6,12 +6,13 @@ package org.chromium.chrome.browser.autofill_assistant.form;
import android.content.Context;
import android.support.v7.content.res.AppCompatResources;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import org.chromium.chrome.autofill_assistant.R;
import org.chromium.chrome.browser.autofill_assistant.AbstractListObserver;
/**
* A coordinator responsible for showing a form to the user.
......@@ -20,43 +21,83 @@ import org.chromium.chrome.browser.autofill_assistant.AbstractListObserver;
*/
public class AssistantFormCoordinator {
private final AssistantFormModel mModel;
private final LinearLayout mView;
private final LinearLayout mRootView;
private final LinearLayout mFormView;
private final LinearLayout mInfoView;
public AssistantFormCoordinator(Context context, AssistantFormModel model) {
mModel = model;
mView = new LinearLayout(context);
mView.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
mView.setOrientation(LinearLayout.VERTICAL);
mView.setDividerDrawable(AppCompatResources.getDrawable(
mRootView = makeLinearLayout(context);
mFormView = makeLinearLayout(context);
mFormView.setDividerDrawable(AppCompatResources.getDrawable(
context, R.drawable.autofill_assistant_form_input_divider));
mView.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE);
mFormView.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE);
mInfoView = (LinearLayout) LayoutInflater.from(context).inflate(
R.layout.autofill_assistant_form_information, mRootView,
/* attachToRoot= */ false);
mRootView.addView(mFormView);
mRootView.addView(mInfoView);
updateVisibility();
mModel.getInputsModel().addObserver(new AbstractListObserver<Void>() {
@Override
public void onDataSetChanged() {
mModel.addObserver((source, propertyKey) -> {
if (AssistantFormModel.INPUTS == propertyKey) {
// TODO(b/144690738) This creates a new instance of the UI on every notification...
for (int i = 0; i < mView.getChildCount(); i++) {
mView.getChildAt(i).setVisibility(View.GONE);
}
clearLinearLayout(mFormView);
for (AssistantFormInput input : mModel.getInputsModel()) {
View view = input.createView(context, mView);
mView.addView(view);
for (AssistantFormInput input : model.get(AssistantFormModel.INPUTS)) {
View view = input.createView(context, mFormView);
mFormView.addView(view);
}
updateVisibility();
} else if (AssistantFormModel.INFO_LABEL == propertyKey) {
if (mModel.get(AssistantFormModel.INFO_LABEL) == null) {
mInfoView.setVisibility(View.GONE);
} else {
mInfoView.setVisibility(View.VISIBLE);
TextView label = mInfoView.findViewById(R.id.text);
label.setText(mModel.get(AssistantFormModel.INFO_LABEL));
}
} else if (AssistantFormModel.INFO_POPUP == propertyKey) {
View infoButton = mInfoView.findViewById(R.id.info_button);
if (mModel.get(AssistantFormModel.INFO_POPUP) == null) {
infoButton.setVisibility(View.GONE);
} else {
infoButton.setVisibility(View.VISIBLE);
infoButton.setOnClickListener(
unusedView -> mModel.get(AssistantFormModel.INFO_POPUP).show(context));
}
}
});
}
/** Return the view associated to this coordinator. */
public View getView() {
return mView;
return mRootView;
}
private void updateVisibility() {
int visibility = mModel.getInputsModel().size() > 0 ? View.VISIBLE : View.GONE;
mView.setVisibility(visibility);
int rootVisibility = mModel.get(AssistantFormModel.INPUTS) != null
&& mModel.get(AssistantFormModel.INPUTS).size() > 0
? View.VISIBLE
: View.GONE;
mRootView.setVisibility(rootVisibility);
}
private LinearLayout makeLinearLayout(Context context) {
LinearLayout view = new LinearLayout(context);
view.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
view.setOrientation(LinearLayout.VERTICAL);
return view;
}
private void clearLinearLayout(LinearLayout view) {
for (int i = 0; i < view.getChildCount(); i++) {
view.getChildAt(i).setVisibility(View.GONE);
}
}
}
......@@ -6,7 +6,8 @@ package org.chromium.chrome.browser.autofill_assistant.form;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.ui.modelutil.ListModel;
import org.chromium.chrome.browser.autofill_assistant.AssistantInfoPopup;
import org.chromium.ui.modelutil.PropertyModel;
import java.util.ArrayList;
import java.util.Arrays;
......@@ -14,21 +15,48 @@ import java.util.List;
/** A model for the assistant form. */
@JNINamespace("autofill_assistant")
public class AssistantFormModel {
private final ListModel<AssistantFormInput> mInputsModel = new ListModel<>();
public class AssistantFormModel extends PropertyModel {
public static final WritableObjectPropertyKey<String> INFO_LABEL =
new WritableObjectPropertyKey<>();
public ListModel<AssistantFormInput> getInputsModel() {
return mInputsModel;
public static final WritableObjectPropertyKey<AssistantInfoPopup> INFO_POPUP =
new WritableObjectPropertyKey<>();
public static final WritableObjectPropertyKey<List<AssistantFormInput>> INPUTS =
new WritableObjectPropertyKey<>();
public AssistantFormModel() {
super(INFO_LABEL, INFO_POPUP, INPUTS);
}
@CalledByNative
private void setInputs(List<AssistantFormInput> inputs) {
mInputsModel.set(inputs);
set(INPUTS, inputs);
}
@CalledByNative
private void setInfoPopup(AssistantInfoPopup infoPopup) {
set(INFO_POPUP, infoPopup);
}
@CalledByNative
private void clearInfoPopup() {
set(INFO_POPUP, null);
}
@CalledByNative
private void setInfoLabel(String label) {
set(INFO_LABEL, label);
}
@CalledByNative
private void clearInfoLabel() {
set(INFO_LABEL, null);
}
@CalledByNative
private void clearInputs() {
mInputsModel.set(Arrays.asList());
set(INPUTS, Arrays.asList());
}
@CalledByNative
......
......@@ -10,6 +10,7 @@ import android.view.View;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.chrome.browser.autofill.PersonalDataManager;
import org.chromium.chrome.browser.autofill_assistant.AssistantInfoPopup;
import org.chromium.chrome.browser.autofill_assistant.user_data.additional_sections.AssistantAdditionalSectionFactory;
import org.chromium.chrome.browser.autofill_assistant.user_data.additional_sections.AssistantStaticTextSection;
import org.chromium.chrome.browser.autofill_assistant.user_data.additional_sections.AssistantTextInputSection;
......@@ -273,12 +274,6 @@ public class AssistantCollectUserDataModel extends PropertyModel {
set(DELEGATE, delegate);
}
/** Creates a simple info popup with a title and some text. */
@CalledByNative
private static AssistantInfoPopup createInfoPopup(String title, String text) {
return new AssistantInfoPopup(title, text);
}
/** Creates an empty list of login options. */
@CalledByNative
private static List<AssistantLoginChoice> createLoginChoiceList() {
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.autofill_assistant.user_data;
/**
* Represents a simple info popup.
*/
public class AssistantInfoPopup {
private final String mTitle;
private final String mText;
public AssistantInfoPopup(String title, String text) {
mTitle = title;
mText = text;
}
public String getTitle() {
return mTitle;
}
public String getText() {
return mText;
}
}
......@@ -6,6 +6,7 @@ package org.chromium.chrome.browser.autofill_assistant.user_data;
import android.support.annotation.Nullable;
import org.chromium.chrome.browser.autofill_assistant.AssistantInfoPopup;
import org.chromium.chrome.browser.widget.prefeditor.EditableOption;
/**
......
......@@ -16,7 +16,6 @@ import android.widget.TextView;
import androidx.annotation.DrawableRes;
import org.chromium.chrome.autofill_assistant.R;
import org.chromium.ui.UiUtils;
import java.util.List;
......@@ -37,11 +36,7 @@ public class AssistantLoginSection extends AssistantCollectUserDataSection<Assis
assert oldItem != null;
assert oldItem.getInfoPopup() != null;
new UiUtils.CompatibleAlertDialogBuilder(mContext, R.style.Theme_Chromium_AlertDialog)
.setTitle(oldItem.getInfoPopup().getTitle())
.setMessage(oldItem.getInfoPopup().getText())
.setPositiveButton(R.string.close, (dialog, which) -> {})
.show();
oldItem.getInfoPopup().show(mContext);
}
@Override
......
......@@ -54,7 +54,6 @@ import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantCollect
import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantCollectUserDataModel;
import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantDateChoiceOptions;
import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantDateTime;
import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantInfoPopup;
import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantLoginChoice;
import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantTermsAndConditionsState;
import org.chromium.chrome.browser.autofill_assistant.user_data.additional_sections.AssistantAdditionalSectionFactory;
......@@ -1224,8 +1223,8 @@ public class AutofillAssistantCollectUserDataUiTest {
AutofillAssistantCollectUserDataTestHelper.MockDelegate delegate =
new AutofillAssistantCollectUserDataTestHelper.MockDelegate();
AssistantInfoPopup infoPopup =
new AssistantInfoPopup("Guest checkout", "Text explanation.");
AssistantInfoPopup infoPopup = new AssistantInfoPopup("Guest checkout", "Text explanation.",
new AssistantDialogButton("Close", null), null, null);
TestThreadUtils.runOnUiThreadBlocking(() -> {
model.set(AssistantCollectUserDataModel.DELEGATE, delegate);
model.set(AssistantCollectUserDataModel.VISIBLE, true);
......
......@@ -21,6 +21,7 @@
#include "chrome/android/features/autofill_assistant/jni_headers/AssistantColor_jni.h"
#include "chrome/android/features/autofill_assistant/jni_headers/AssistantDetailsModel_jni.h"
#include "chrome/android/features/autofill_assistant/jni_headers/AssistantDetails_jni.h"
#include "chrome/android/features/autofill_assistant/jni_headers/AssistantDialogButton_jni.h"
#include "chrome/android/features/autofill_assistant/jni_headers/AssistantDimension_jni.h"
#include "chrome/android/features/autofill_assistant/jni_headers/AssistantDrawable_jni.h"
#include "chrome/android/features/autofill_assistant/jni_headers/AssistantFormInput_jni.h"
......@@ -28,6 +29,7 @@
#include "chrome/android/features/autofill_assistant/jni_headers/AssistantHeaderModel_jni.h"
#include "chrome/android/features/autofill_assistant/jni_headers/AssistantInfoBoxModel_jni.h"
#include "chrome/android/features/autofill_assistant/jni_headers/AssistantInfoBox_jni.h"
#include "chrome/android/features/autofill_assistant/jni_headers/AssistantInfoPopup_jni.h"
#include "chrome/android/features/autofill_assistant/jni_headers/AssistantModel_jni.h"
#include "chrome/android/features/autofill_assistant/jni_headers/AssistantOverlayModel_jni.h"
#include "chrome/android/features/autofill_assistant/jni_headers/AssistantViewFactory_jni.h"
......@@ -218,6 +220,65 @@ base::android::ScopedJavaLocalRef<jobject> CreateJavaDrawable(
}
}
base::android::ScopedJavaLocalRef<jobject> CreateJavaDialogButton(
JNIEnv* env,
const InfoPopupProto_DialogButton& button_proto) {
base::android::ScopedJavaLocalRef<jstring> jurl = nullptr;
switch (button_proto.click_action_case()) {
case InfoPopupProto::DialogButton::kOpenUrlInCct:
jurl = base::android::ConvertUTF8ToJavaString(
env, button_proto.open_url_in_cct().url());
break;
case InfoPopupProto::DialogButton::kCloseDialog:
break;
case InfoPopupProto::DialogButton::CLICK_ACTION_NOT_SET:
NOTREACHED();
break;
}
return Java_AssistantDialogButton_Constructor(
env, base::android::ConvertUTF8ToJavaString(env, button_proto.label()),
jurl);
}
base::android::ScopedJavaLocalRef<jobject> CreateJavaInfoPopup(
JNIEnv* env,
const InfoPopupProto& info_popup_proto) {
base::android::ScopedJavaLocalRef<jobject> jpositive_button = nullptr;
base::android::ScopedJavaLocalRef<jobject> jnegative_button = nullptr;
base::android::ScopedJavaLocalRef<jobject> jneutral_button = nullptr;
if (info_popup_proto.has_positive_button() ||
info_popup_proto.has_negative_button() ||
info_popup_proto.has_neutral_button()) {
if (info_popup_proto.has_positive_button()) {
jpositive_button =
CreateJavaDialogButton(env, info_popup_proto.positive_button());
}
if (info_popup_proto.has_negative_button()) {
jnegative_button =
CreateJavaDialogButton(env, info_popup_proto.negative_button());
}
if (info_popup_proto.has_neutral_button()) {
jneutral_button =
CreateJavaDialogButton(env, info_popup_proto.neutral_button());
}
} else {
// If no button is set in the proto, we add a Close button
jpositive_button = Java_AssistantDialogButton_Constructor(
env,
base::android::ConvertUTF8ToJavaString(
env, l10n_util::GetStringUTF8(IDS_CLOSE)),
nullptr);
}
return Java_AssistantInfoPopup_Constructor(
env,
base::android::ConvertUTF8ToJavaString(env, info_popup_proto.title()),
base::android::ConvertUTF8ToJavaString(env, info_popup_proto.text()),
jpositive_button, jnegative_button, jneutral_button);
}
// Creates the Java equivalent to |login_choices|.
base::android::ScopedJavaLocalRef<jobject> CreateJavaLoginChoiceList(
JNIEnv* env,
......@@ -226,12 +287,7 @@ base::android::ScopedJavaLocalRef<jobject> CreateJavaLoginChoiceList(
for (const auto& login_choice : login_choices) {
base::android::ScopedJavaLocalRef<jobject> jinfo_popup = nullptr;
if (login_choice.info_popup.has_value()) {
jinfo_popup = Java_AssistantCollectUserDataModel_createInfoPopup(
env,
base::android::ConvertUTF8ToJavaString(
env, login_choice.info_popup->title()),
base::android::ConvertUTF8ToJavaString(
env, login_choice.info_popup->text()));
jinfo_popup = CreateJavaInfoPopup(env, *login_choice.info_popup);
}
base::android::ScopedJavaLocalRef<jstring> jsublabel_accessibility_hint =
nullptr;
......@@ -1331,8 +1387,22 @@ void UiControllerAndroid::OnFormChanged(const FormProto* form) {
// Intentionally no default case to make compilation fail if a new value
// was added to the enum but not to this list.
}
}
Java_AssistantFormModel_setInputs(env, GetFormModel(), jinput_list);
if (form->has_info_label()) {
Java_AssistantFormModel_setInfoLabel(
env, GetFormModel(),
base::android::ConvertUTF8ToJavaString(env, form->info_label()));
} else {
Java_AssistantFormModel_clearInfoLabel(env, GetFormModel());
}
Java_AssistantFormModel_setInputs(env, GetFormModel(), jinput_list);
if (form->has_info_popup()) {
Java_AssistantFormModel_setInfoPopup(
env, GetFormModel(), CreateJavaInfoPopup(env, form->info_popup()));
} else {
Java_AssistantFormModel_clearInfoPopup(env, GetFormModel());
}
}
......
......@@ -1223,6 +1223,26 @@ message InfoPopupProto {
optional string title = 1;
// The text of the popup window.
optional string text = 2;
message DialogButton {
message CloseDialog {}
message OpenUrlInCCT { optional string url = 1; }
// The action to be executed on click.
oneof click_action {
// Closes the popup.
CloseDialog close_dialog = 4;
// Opens the specified url into a new CCT.
OpenUrlInCCT open_url_in_cct = 5;
}
optional string label = 1;
}
// Optional: adds a positive button.
optional DialogButton positive_button = 3;
// Optional: adds a negative button.
optional DialogButton negative_button = 4;
// Optional: adds a neutral button.
optional DialogButton neutral_button = 5;
}
message LoginDetailsProto {
......@@ -1670,6 +1690,12 @@ message FormProto {
// The different inputs to display.
repeated FormInputProto inputs = 1;
// Optionally adds an informational text below the form.
optional string info_label = 2;
// If set, an info icon will be shown next to the info label that prompts a
// popup when tapped. Ignored if info_label is not set.
optional InfoPopupProto info_popup = 3;
}
message FormInputProto {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment