forked from Silverfish/proton-bridge
feat(GODT-3046): report all clicked external links to bridge.
This commit is contained in:
@ -817,7 +817,7 @@ Status GRPCService::InstallTLSCertificate(ServerContext *, Empty const *, Empty
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] request The request.
|
||||
//****************************************************************************************************************************************************
|
||||
Status GRPCService::KBArticleClicked(::grpc::ServerContext *, ::google::protobuf::StringValue const *request, ::google::protobuf::Empty *) {
|
||||
Status GRPCService::ExternalLinkClicked(::grpc::ServerContext *, ::google::protobuf::StringValue const *request, ::google::protobuf::Empty *) {
|
||||
app().log().debug(QString("%1 - URL = %2").arg(__FUNCTION__, QString::fromStdString(request->value())));
|
||||
return Status::OK;
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ public: // member functions.
|
||||
grpc::Status ExportTLSCertificates(::grpc::ServerContext *, ::google::protobuf::StringValue const *request, ::google::protobuf::Empty *) override;
|
||||
grpc::Status ReportBugClicked(::grpc::ServerContext *context, ::google::protobuf::Empty const *request, ::google::protobuf::Empty *) override;
|
||||
grpc::Status AutoconfigClicked(::grpc::ServerContext *context, ::google::protobuf::StringValue const *request, ::google::protobuf::Empty *) override;
|
||||
grpc::Status KBArticleClicked(::grpc::ServerContext *, ::google::protobuf::StringValue const *request, ::google::protobuf::Empty *) override;
|
||||
grpc::Status ExternalLinkClicked(::grpc::ServerContext *, ::google::protobuf::StringValue const *request, ::google::protobuf::Empty *) override;
|
||||
grpc::Status RunEventStream(::grpc::ServerContext *ctx, ::grpc::EventStreamRequest const *request, ::grpc::ServerWriter<::grpc::StreamEvent> *writer) override;
|
||||
grpc::Status StopEventStream(::grpc::ServerContext *, ::google::protobuf::Empty const *, ::google::protobuf::Empty *) override;
|
||||
bool sendEvent(bridgepp::SPStreamEvent const &event); ///< Queue an event for sending through the event stream.
|
||||
|
||||
@ -294,11 +294,11 @@ bool QMLBackend::isTLSCertificateInstalled() {
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] url The URL of the knowledge base article. If empty/invalid, the home page for the Bridge knowledge base is opened.
|
||||
//****************************************************************************************************************************************************
|
||||
void QMLBackend::openKBArticle(QString const &url) {
|
||||
void QMLBackend::openExternalLink(QString const &url) {
|
||||
HANDLE_EXCEPTION(
|
||||
QString const u = url.isEmpty() ? bridgeKBUrl : url;
|
||||
QDesktopServices::openUrl(u);
|
||||
emit notifyKBArticleClicked(u);
|
||||
emit notifyExternalLinkClicked(u);
|
||||
)
|
||||
}
|
||||
|
||||
@ -1062,9 +1062,9 @@ void QMLBackend::notifyAutoconfigClicked(QString const &client) const {
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] article The url of the KB article.
|
||||
//****************************************************************************************************************************************************
|
||||
void QMLBackend::notifyKBArticleClicked(QString const &article) const {
|
||||
void QMLBackend::notifyExternalLinkClicked(QString const &article) const {
|
||||
HANDLE_EXCEPTION(
|
||||
app().grpc().KBArticleClicked(article);
|
||||
app().grpc().externalLinkClicked(article);
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ public: // member functions.
|
||||
Q_INVOKABLE QString collectAnswers(quint8 categoryId) const; ///< Collect answer for a given set of questions.
|
||||
Q_INVOKABLE void clearAnswers(); ///< Clear all collected answers.
|
||||
Q_INVOKABLE bool isTLSCertificateInstalled(); ///< Check if the bridge certificate is installed in the OS keychain.
|
||||
Q_INVOKABLE void openKBArticle(QString const & url = QString()); ///< Open a knowledge base article.
|
||||
Q_INVOKABLE void openExternalLink(QString const & url = QString()); ///< Open a knowledge base article.
|
||||
|
||||
public: // Qt/QML properties. Note that the NOTIFY-er signal is required even for read-only properties (QML warning otherwise)
|
||||
Q_PROPERTY(bool showOnStartup READ showOnStartup NOTIFY showOnStartupChanged)
|
||||
@ -205,7 +205,7 @@ public slots: // slot for signals received from QML -> To be forwarded to Bridge
|
||||
void sendBadEventUserFeedback(QString const &userID, bool doResync); ///< Slot the providing user feedback for a bad event.
|
||||
void notifyReportBugClicked() const; ///< Slot for the ReportBugClicked gRPC event.
|
||||
void notifyAutoconfigClicked(QString const &client) const; ///< Slot for gAutoconfigClicked gRPC event.
|
||||
void notifyKBArticleClicked(QString const &article) const; ///< Slot for KBArticleClicked gRPC event.
|
||||
void notifyExternalLinkClicked(QString const &article) const; ///< Slot for KBArticleClicked gRPC event.
|
||||
|
||||
public slots: // slots for functions that need to be processed locally.
|
||||
void setNormalTrayIcon(); ///< Set the tray icon to normal.
|
||||
|
||||
@ -113,7 +113,7 @@ SettingsView {
|
||||
secondary: true
|
||||
text: qsTr("View logs")
|
||||
|
||||
onClicked: Qt.openUrlExternally(Backend.logsPath)
|
||||
onClicked: Backend.openExternalLink(Backend.logsPath)
|
||||
}
|
||||
}
|
||||
TextEdit {
|
||||
|
||||
@ -36,7 +36,7 @@ SettingsView {
|
||||
type: SettingsItem.PrimaryButton
|
||||
|
||||
onClicked: {
|
||||
Backend.openKBArticle();
|
||||
Backend.openExternalLink();
|
||||
}
|
||||
}
|
||||
SettingsItem {
|
||||
@ -70,7 +70,7 @@ SettingsView {
|
||||
text: qsTr("Logs")
|
||||
type: SettingsItem.Button
|
||||
|
||||
onClicked: Qt.openUrlExternally(Backend.logsPath)
|
||||
onClicked: Backend.openExternalLink(Backend.logsPath)
|
||||
}
|
||||
SettingsItem {
|
||||
id: reportBug
|
||||
@ -103,7 +103,7 @@ SettingsView {
|
||||
type: Label.Caption
|
||||
|
||||
onLinkActivated: function (link) {
|
||||
Qt.openUrlExternally(link)
|
||||
Backend.openExternalLink(link)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ Dialog {
|
||||
wrapMode: Text.WordWrap
|
||||
|
||||
onLinkActivated: function (link) {
|
||||
Qt.openUrlExternally(link);
|
||||
Backend.openExternalLink(link);
|
||||
}
|
||||
}
|
||||
Item {
|
||||
|
||||
@ -673,7 +673,7 @@ QtObject {
|
||||
text: qsTr("Upgrade")
|
||||
|
||||
onTriggered: {
|
||||
Qt.openUrlExternally(root.onlyPaidUsers.pricingLink);
|
||||
Backend.openExternalLink(root.onlyPaidUsers.pricingLink);
|
||||
root.onlyPaidUsers.active = false;
|
||||
}
|
||||
}
|
||||
@ -700,7 +700,7 @@ QtObject {
|
||||
text: qsTr("Open the support page")
|
||||
|
||||
onTriggered: {
|
||||
Backend.openKBArticle();
|
||||
Backend.openExternalLink();
|
||||
Backend.quit();
|
||||
}
|
||||
}
|
||||
@ -841,7 +841,7 @@ QtObject {
|
||||
text: qsTr("Update manually")
|
||||
|
||||
onTriggered: {
|
||||
Qt.openUrlExternally(Backend.landingPageLink);
|
||||
Backend.openExternalLink(Backend.landingPageLink);
|
||||
root.updateForce.active = false;
|
||||
}
|
||||
},
|
||||
@ -881,7 +881,7 @@ QtObject {
|
||||
text: qsTr("Update manually")
|
||||
|
||||
onTriggered: {
|
||||
Qt.openUrlExternally(Backend.landingPageLink);
|
||||
Backend.openExternalLink(Backend.landingPageLink);
|
||||
root.updateForceError.active = false;
|
||||
}
|
||||
},
|
||||
@ -941,7 +941,7 @@ QtObject {
|
||||
text: qsTr("Update manually")
|
||||
|
||||
onTriggered: {
|
||||
Qt.openUrlExternally(Backend.landingPageLink);
|
||||
Backend.openExternalLink(Backend.landingPageLink);
|
||||
root.updateManualError.active = false;
|
||||
Backend.quit();
|
||||
}
|
||||
@ -991,7 +991,7 @@ QtObject {
|
||||
text: qsTr("Update manually")
|
||||
|
||||
onTriggered: {
|
||||
Qt.openUrlExternally(Backend.landingPageLink);
|
||||
Backend.openExternalLink(Backend.landingPageLink);
|
||||
root.updateManualReady.active = false;
|
||||
}
|
||||
},
|
||||
@ -1052,7 +1052,7 @@ QtObject {
|
||||
text: qsTr("Update manually")
|
||||
|
||||
onTriggered: {
|
||||
Qt.openUrlExternally(Backend.landingPageLink);
|
||||
Backend.openExternalLink(Backend.landingPageLink);
|
||||
root.updateSilentError.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ RowLayout {
|
||||
type: Label.LabelType.Body
|
||||
onLinkActivated: function (link) {
|
||||
if ((link !== "#") && (link.length > 0)) {
|
||||
Qt.openUrlExternally(link);
|
||||
Backend.openExternalLink(link);
|
||||
}
|
||||
if (callback) {
|
||||
callback();
|
||||
|
||||
@ -79,7 +79,7 @@ Rectangle {
|
||||
text: qsTr("Open guide")
|
||||
|
||||
onClicked: function () {
|
||||
Backend.openKBArticle(wizard.setupGuideLink());
|
||||
Backend.openExternalLink(wizard.setupGuideLink());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ Button {
|
||||
text: qsTr("Get help")
|
||||
|
||||
onClicked: {
|
||||
Backend.openKBArticle();
|
||||
Backend.openExternalLink();
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
|
||||
@ -37,7 +37,7 @@ Item {
|
||||
function showAppleMailAutoconfigCertificateInstall() {
|
||||
showAppleMailAutoconfigCommon();
|
||||
descriptionLabel.text = qsTr("Apple Mail configuration is mostly automated, but in order to work, Bridge needs to install a certificate in your keychain.");
|
||||
linkLabel1.setCallback(function() { Backend.openKBArticle("https://proton.me/support/apple-mail-certificate"); }, qsTr("Why is this certificate needed?"), true);
|
||||
linkLabel1.setCallback(function() { Backend.openExternalLink("https://proton.me/support/apple-mail-certificate"); }, qsTr("Why is this certificate needed?"), true);
|
||||
linkLabel2.clear();
|
||||
}
|
||||
function showAppleMailAutoconfigCommon() {
|
||||
@ -51,7 +51,7 @@ Item {
|
||||
function showAppleMailAutoconfigProfileInstall() {
|
||||
showAppleMailAutoconfigCommon();
|
||||
descriptionLabel.text = qsTr("The final step before you can start using Apple Mail is to install the Bridge server profile in the system preferences.\n\nAdding a server profile is necessary to ensure that your Mac can receive and send Proton Mails.");
|
||||
linkLabel1.setCallback(function() { Backend.openKBArticle("https://proton.me/support/macos-certificate-warning"); }, qsTr("Why is there a yellow warning sign?"), true);
|
||||
linkLabel1.setCallback(function() { Backend.openExternalLink("https://proton.me/support/macos-certificate-warning"); }, qsTr("Why is there a yellow warning sign?"), true);
|
||||
linkLabel2.setCallback(wizard.showClientParams, qsTr("Configure Apple Mail manually"), false);
|
||||
}
|
||||
function showClientSelector(newAccount = true) {
|
||||
@ -86,7 +86,7 @@ Item {
|
||||
function showOnboarding() {
|
||||
titleLabel.text = (Backend.users.count === 0) ? welcomeTitle : addAccountTitle;
|
||||
descriptionLabel.text = welcomeDescription
|
||||
linkLabel1.setCallback(function() { Backend.openKBArticle("https://proton.me/support/why-you-need-bridge"); }, qsTr("Why do I need Bridge?"), true);
|
||||
linkLabel1.setCallback(function() { Backend.openExternalLink("https://proton.me/support/why-you-need-bridge"); }, qsTr("Why do I need Bridge?"), true);
|
||||
linkLabel2.clear();
|
||||
root.iconSource = welcomeImage;
|
||||
root.iconHeight = welcomeImageHeight;
|
||||
|
||||
@ -162,7 +162,7 @@ Dialog {
|
||||
wrapMode: Text.WordWrap
|
||||
|
||||
onLinkActivated: function (link) {
|
||||
Qt.openUrlExternally(link);
|
||||
Backend.openExternalLink(link);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1513,24 +1513,30 @@ UPClientContext GRPCClient::clientContext() const {
|
||||
}
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] userID The user ID.
|
||||
/// \param[in] address The email address.
|
||||
/// \return the status for the gRPC call.
|
||||
//****************************************************************************************************************************************************
|
||||
grpc::Status GRPCClient::reportBugClicked() {
|
||||
return this->logGRPCCallStatus(stub_->ReportBugClicked(this->clientContext().get(), empty, &empty), __FUNCTION__);
|
||||
}
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] client The client string.
|
||||
/// \return the status for the gRPC call.
|
||||
//****************************************************************************************************************************************************
|
||||
grpc::Status GRPCClient::autoconfigClicked(QString const &client) {
|
||||
StringValue s;
|
||||
s.set_value(client.toStdString());
|
||||
return this->logGRPCCallStatus(stub_->AutoconfigClicked(this->clientContext().get(), s, &empty), __FUNCTION__);
|
||||
}
|
||||
|
||||
grpc::Status GRPCClient::KBArticleClicked(QString const &article) {
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] link The clicked link.
|
||||
/// \return the status for the gRPC call.
|
||||
//****************************************************************************************************************************************************
|
||||
grpc::Status GRPCClient::externalLinkClicked(QString const &link) {
|
||||
StringValue s;
|
||||
s.set_value(article.toStdString());
|
||||
return this->logGRPCCallStatus(stub_->KBArticleClicked(this->clientContext().get(), s, &empty), __FUNCTION__);
|
||||
s.set_value(link.toStdString());
|
||||
return this->logGRPCCallStatus(stub_->ExternalLinkClicked(this->clientContext().get(), s, &empty), __FUNCTION__);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -194,7 +194,7 @@ signals:
|
||||
public: // telemetry related calls
|
||||
grpc::Status reportBugClicked(); ///< Performs the 'reportBugClicked' call.
|
||||
grpc::Status autoconfigClicked(QString const &userID); ///< Performs the 'AutoconfigClicked' call.
|
||||
grpc::Status KBArticleClicked(QString const &userID); ///< Performs the 'KBArticleClicked' call.
|
||||
grpc::Status externalLinkClicked(QString const &userID); ///< Performs the 'KBArticleClicked' call.
|
||||
|
||||
public: // keychain related calls
|
||||
grpc::Status availableKeychains(QStringList &outKeychains);
|
||||
|
||||
Reference in New Issue
Block a user