QtAndroidTools/QtAndroidToolsDemo/tools/AndroidUserMessagingPlatform.qml

96 lines
3.3 KiB
QML
Raw Normal View History

2020-10-20 23:10:41 +02:00
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Dialogs 1.3
import QtAndroidTools 1.0
Page {
id: page
padding: 20
Connections {
target: QtAndroidUserMessagingPlatform
2020-12-07 15:13:20 +01:00
function onConsentFormRequestResult(eventId)
2020-10-20 23:10:41 +02:00
{
switch(eventId)
{
case QtAndroidUserMessagingPlatform.CONSENT_FORM_INFO_UPDATE_FAILURE:
consentFormShowResult.text = "CONSENT_FORM_INFO_UPDATE_FAILURE";
break;
case QtAndroidUserMessagingPlatform.CONSENT_FORM_NOT_AVAILABLE:
consentFormShowResult.text = "CONSENT_FORM_NOT_AVAILABLE";
break;
2020-12-07 15:13:20 +01:00
case QtAndroidUserMessagingPlatform.CONSENT_FORM_LOAD_SUCCESS:
consentFormShowResult.text = "CONSENT_FORM_LOAD_SUCCESS";
2020-10-20 23:10:41 +02:00
break;
case QtAndroidUserMessagingPlatform.CONSENT_FORM_LOAD_FAILURE:
consentFormShowResult.text = "CONSENT_FORM_LOAD_FAILURE";
break;
}
}
2020-12-07 15:13:20 +01:00
function onConsentFormClosed()
{
}
2020-10-20 23:10:41 +02:00
}
Column {
anchors.fill: parent
spacing: 5
Label {
2020-12-07 15:13:20 +01:00
id: consentFormRequestResult
width: parent.width
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 15
text: "-----"
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: "requestConsentForm"
onClicked: QtAndroidUserMessagingPlatform.requestConsentForm()
}
Label {
id: consentStatus
2020-10-20 23:10:41 +02:00
width: parent.width
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 15
text: "-----"
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
2020-12-07 15:13:20 +01:00
text: "consentStatus"
onClicked: {
var status = QtAndroidUserMessagingPlatform.consentStatus();
switch(eventId)
{
case QtAndroidUserMessagingPlatform.CONSENT_FORM_STATUS_UNKNOWN:
consentStatus.text = "CONSENT_FORM_STATUS_UNKNOWN";
break;
case QtAndroidUserMessagingPlatform.CONSENT_FORM_STATUS_REQUIRED:
consentStatus.text = "CONSENT_FORM_STATUS_REQUIRED";
break;
case QtAndroidUserMessagingPlatform.CONSENT_FORM_STATUS_NOT_REQUIRED:
consentStatus.text = "CONSENT_FORM_STATUS_NOT_REQUIRED";
break;
case QtAndroidUserMessagingPlatform.CONSENT_FORM_STATUS_OBTAINED:
consentStatus.text = "CONSENT_FORM_STATUS_OBTAINED";
break;
}
}
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: "showConsentForm"
onClicked: QtAndroidUserMessagingPlatform.showConsentForm()
2020-10-20 23:10:41 +02:00
}
Button {
anchors.horizontalCenter: parent.horizontalCenter
text: "resetConsentInformation"
onClicked: QtAndroidUserMessagingPlatform.resetConsentInformation()
}
}
}