From 16bcef3c784a70e1683e84ba8b0e6e8849297ff2 Mon Sep 17 00:00:00 2001 From: Sebastian Wolf Date: Wed, 22 Nov 2023 22:53:17 +0100 Subject: [PATCH] Interaction hint for new reactions behavior --- qml/pages/ChatPage.qml | 36 +++++++++++++++++++++ rpm/harbour-fernschreiber.spec | 2 +- rpm/harbour-fernschreiber.yaml | 2 +- src/appsettings.cpp | 15 +++++++++ src/appsettings.h | 5 +++ translations/harbour-fernschreiber-de.ts | 4 +++ translations/harbour-fernschreiber-en.ts | 4 +++ translations/harbour-fernschreiber-es.ts | 4 +++ translations/harbour-fernschreiber-fi.ts | 4 +++ translations/harbour-fernschreiber-fr.ts | 4 +++ translations/harbour-fernschreiber-hu.ts | 4 +++ translations/harbour-fernschreiber-it.ts | 4 +++ translations/harbour-fernschreiber-pl.ts | 4 +++ translations/harbour-fernschreiber-ru.ts | 4 +++ translations/harbour-fernschreiber-sk.ts | 4 +++ translations/harbour-fernschreiber-sv.ts | 4 +++ translations/harbour-fernschreiber-zh_CN.ts | 4 +++ translations/harbour-fernschreiber.ts | 4 +++ 18 files changed, 110 insertions(+), 2 deletions(-) diff --git a/qml/pages/ChatPage.qml b/qml/pages/ChatPage.qml index c98c263..23f0da0 100644 --- a/qml/pages/ChatPage.qml +++ b/qml/pages/ChatPage.qml @@ -609,6 +609,15 @@ Page { chatViewCooldownTimer.restart(); chatViewStartupReadTimer.restart(); + + var remainingDoubleTapHints = appSettings.remainingDoubleTapHints; + Debug.log("Remaining double tap hints: " + remainingDoubleTapHints); + if (remainingDoubleTapHints > 0) { + doubleTapHintTimer.start(); + tapHint.visible = true; + tapHintLabel.visible = true; + appSettings.remainingDoubleTapHints = remainingDoubleTapHints - 1; + } } onNewMessageReceived: { if (( chatView.manuallyScrolledToBottom && Qt.application.state === Qt.ApplicationActive ) || message.sender_id.user_id === chatPage.myUserId) { @@ -2157,4 +2166,31 @@ Page { } } } + + Timer { + id: doubleTapHintTimer + running: true + triggeredOnStart: false + repeat: false + interval: 6000 + onTriggered: { + tapHint.visible = false; + tapHintLabel.visible = false; + } + } + + TapInteractionHint { + id: tapHint + loops: Animation.Infinite + taps: 2 + anchors.centerIn: parent + visible: false + } + + InteractionHintLabel { + id: tapHintLabel + anchors.bottom: parent.bottom + text: qsTr("Double-tap on a message to choose a reaction") + visible: false + } } diff --git a/rpm/harbour-fernschreiber.spec b/rpm/harbour-fernschreiber.spec index 247c3bc..c642703 100644 --- a/rpm/harbour-fernschreiber.spec +++ b/rpm/harbour-fernschreiber.spec @@ -12,7 +12,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 -Release: 5 +Release: 6 Group: Qt/Qt License: LICENSE URL: http://werkwolf.eu/ diff --git a/rpm/harbour-fernschreiber.yaml b/rpm/harbour-fernschreiber.yaml index 0e87ef4..e4c228f 100644 --- a/rpm/harbour-fernschreiber.yaml +++ b/rpm/harbour-fernschreiber.yaml @@ -1,7 +1,7 @@ Name: harbour-fernschreiber Summary: Fernschreiber is a Telegram client for Sailfish OS Version: 0.17 -Release: 5 +Release: 6 # The contents of the Group field should be one of the groups listed here: # https://github.com/mer-tools/spectacle/blob/master/data/GROUPS Group: Qt/Qt diff --git a/src/appsettings.cpp b/src/appsettings.cpp index efd5b33..d63537a 100644 --- a/src/appsettings.cpp +++ b/src/appsettings.cpp @@ -35,6 +35,7 @@ namespace { const QString KEY_STORAGE_OPTIMIZER("useStorageOptimizer"); const QString KEY_INLINEBOT_LOCATION_ACCESS("allowInlineBotLocationAccess"); const QString KEY_REMAINING_INTERACTION_HINTS("remainingInteractionHints"); + const QString KEY_REMAINING_DOUBLE_TAP_HINTS("remainingDoubleTapHints"); const QString KEY_ONLINE_ONLY_MODE("onlineOnlyMode"); const QString KEY_DELAY_MESSAGE_READ("delayMessageRead"); const QString KEY_FOCUS_TEXTAREA_ON_CHAT_OPEN("focusTextAreaOnChatOpen"); @@ -243,6 +244,20 @@ void AppSettings::setRemainingInteractionHints(int remainingHints) } } +int AppSettings::remainingDoubleTapHints() const +{ + return settings.value(KEY_REMAINING_DOUBLE_TAP_HINTS, 3).toInt(); +} + +void AppSettings::setRemainingDoubleTapHints(int remainingHints) +{ + if (remainingDoubleTapHints() != remainingHints) { + LOG(KEY_REMAINING_DOUBLE_TAP_HINTS << remainingHints); + settings.setValue(KEY_REMAINING_DOUBLE_TAP_HINTS, remainingHints); + emit remainingDoubleTapHintsChanged(); + } +} + bool AppSettings::onlineOnlyMode() const { return settings.value(KEY_ONLINE_ONLY_MODE, false).toBool(); diff --git a/src/appsettings.h b/src/appsettings.h index e4a1a2d..84e59d9 100644 --- a/src/appsettings.h +++ b/src/appsettings.h @@ -38,6 +38,7 @@ class AppSettings : public QObject { Q_PROPERTY(bool storageOptimizer READ storageOptimizer WRITE setStorageOptimizer NOTIFY storageOptimizerChanged) Q_PROPERTY(bool allowInlineBotLocationAccess READ allowInlineBotLocationAccess WRITE setAllowInlineBotLocationAccess NOTIFY allowInlineBotLocationAccessChanged) Q_PROPERTY(int remainingInteractionHints READ remainingInteractionHints WRITE setRemainingInteractionHints NOTIFY remainingInteractionHintsChanged) + Q_PROPERTY(int remainingDoubleTapHints READ remainingDoubleTapHints WRITE setRemainingDoubleTapHints NOTIFY remainingDoubleTapHintsChanged) Q_PROPERTY(bool onlineOnlyMode READ onlineOnlyMode WRITE setOnlineOnlyMode NOTIFY onlineOnlyModeChanged) Q_PROPERTY(bool delayMessageRead READ delayMessageRead WRITE setDelayMessageRead NOTIFY delayMessageReadChanged) Q_PROPERTY(bool focusTextAreaOnChatOpen READ getFocusTextAreaOnChatOpen WRITE setFocusTextAreaOnChatOpen NOTIFY focusTextAreaOnChatOpenChanged) @@ -104,6 +105,9 @@ public: int remainingInteractionHints() const; void setRemainingInteractionHints(int remainingHints); + int remainingDoubleTapHints() const; + void setRemainingDoubleTapHints(int remainingHints); + bool onlineOnlyMode() const; void setOnlineOnlyMode(bool enable); @@ -134,6 +138,7 @@ signals: void storageOptimizerChanged(); void allowInlineBotLocationAccessChanged(); void remainingInteractionHintsChanged(); + void remainingDoubleTapHintsChanged(); void onlineOnlyModeChanged(); void delayMessageReadChanged(); void focusTextAreaOnChatOpenChanged(); diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts index d0eac2d..c608557 100644 --- a/translations/harbour-fernschreiber-de.ts +++ b/translations/harbour-fernschreiber-de.ts @@ -483,6 +483,10 @@ Deleted User Gelöschtes Konto + + Double-tap on a message to choose a reaction + Drücke zweimal auf eine Nachricht, um eine Reaktion auszuwählen + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts index 4008317..3a0b0be 100644 --- a/translations/harbour-fernschreiber-en.ts +++ b/translations/harbour-fernschreiber-en.ts @@ -483,6 +483,10 @@ Deleted User Deleted User + + Double-tap on a message to choose a reaction + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts index 06fd254..6b87cf8 100644 --- a/translations/harbour-fernschreiber-es.ts +++ b/translations/harbour-fernschreiber-es.ts @@ -483,6 +483,10 @@ Deleted User Usuario borrado + + Double-tap on a message to choose a reaction + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts index d0b22c8..7d08abb 100644 --- a/translations/harbour-fernschreiber-fi.ts +++ b/translations/harbour-fernschreiber-fi.ts @@ -483,6 +483,10 @@ Deleted User + + Double-tap on a message to choose a reaction + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-fr.ts b/translations/harbour-fernschreiber-fr.ts index 96f7e9b..a1c44e4 100644 --- a/translations/harbour-fernschreiber-fr.ts +++ b/translations/harbour-fernschreiber-fr.ts @@ -483,6 +483,10 @@ Deleted User Supprimer l'utilisateur + + Double-tap on a message to choose a reaction + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts index 796c1c3..adcf023 100644 --- a/translations/harbour-fernschreiber-hu.ts +++ b/translations/harbour-fernschreiber-hu.ts @@ -473,6 +473,10 @@ Deleted User + + Double-tap on a message to choose a reaction + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts index 48e863e..0ff0bfa 100644 --- a/translations/harbour-fernschreiber-it.ts +++ b/translations/harbour-fernschreiber-it.ts @@ -483,6 +483,10 @@ Deleted User + + Double-tap on a message to choose a reaction + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts index b16825d..436cd14 100644 --- a/translations/harbour-fernschreiber-pl.ts +++ b/translations/harbour-fernschreiber-pl.ts @@ -493,6 +493,10 @@ Deleted User Usunięty użytkownik + + Double-tap on a message to choose a reaction + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts index 09982cd..9006ca3 100644 --- a/translations/harbour-fernschreiber-ru.ts +++ b/translations/harbour-fernschreiber-ru.ts @@ -493,6 +493,10 @@ Deleted User Удалённый пользователь + + Double-tap on a message to choose a reaction + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-sk.ts b/translations/harbour-fernschreiber-sk.ts index d4b14cf..df7ec3a 100644 --- a/translations/harbour-fernschreiber-sk.ts +++ b/translations/harbour-fernschreiber-sk.ts @@ -493,6 +493,10 @@ Deleted User Odstránený používateľ + + Double-tap on a message to choose a reaction + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts index d00eb6d..92078c6 100644 --- a/translations/harbour-fernschreiber-sv.ts +++ b/translations/harbour-fernschreiber-sv.ts @@ -483,6 +483,10 @@ Deleted User Tog bort användare + + Double-tap on a message to choose a reaction + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts index 88727e2..c904169 100644 --- a/translations/harbour-fernschreiber-zh_CN.ts +++ b/translations/harbour-fernschreiber-zh_CN.ts @@ -473,6 +473,10 @@ Deleted User + + Double-tap on a message to choose a reaction + + ChatSelectionPage diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts index cc90573..d816a18 100644 --- a/translations/harbour-fernschreiber.ts +++ b/translations/harbour-fernschreiber.ts @@ -483,6 +483,10 @@ Deleted User + + Double-tap on a message to choose a reaction + + ChatSelectionPage