diff --git a/qml/components/settingsPage/SettingsBehavior.qml b/qml/components/settingsPage/SettingsBehavior.qml
index 17746f7..9c6b961 100644
--- a/qml/components/settingsPage/SettingsBehavior.qml
+++ b/qml/components/settingsPage/SettingsBehavior.qml
@@ -191,6 +191,17 @@ AccordionItem {
}
Behavior on height { SmoothedAnimation { duration: 200 } }
}
+
+ TextSwitch {
+ width: parent.columnWidth
+ checked: appSettings.notificationAlwaysShowPreview
+ text: qsTr("Always append message preview to notifications")
+ description: qsTr("In addition to showing the number of unread messages, the latest message will also be appended to notifications.")
+ automaticCheck: false
+ onClicked: {
+ appSettings.notificationAlwaysShowPreview = !checked
+ }
+ }
}
}
}
diff --git a/src/appsettings.cpp b/src/appsettings.cpp
index 776c6ae..efd5b33 100644
--- a/src/appsettings.cpp
+++ b/src/appsettings.cpp
@@ -31,6 +31,7 @@ namespace {
const QString KEY_NOTIFICATION_SOUNDS_ENABLED("notificationSoundsEnabled");
const QString KEY_NOTIFICATION_SUPPRESS_ENABLED("notificationSuppressContent");
const QString KEY_NOTIFICATION_FEEDBACK("notificationFeedback");
+ const QString KEY_NOTIFICATION_ALWAYS_SHOW_PREVIEW("notificationAlwaysShowPreview");
const QString KEY_STORAGE_OPTIMIZER("useStorageOptimizer");
const QString KEY_INLINEBOT_LOCATION_ACCESS("allowInlineBotLocationAccess");
const QString KEY_REMAINING_INTERACTION_HINTS("remainingInteractionHints");
@@ -185,6 +186,20 @@ void AppSettings::setNotificationFeedback(NotificationFeedback feedback)
}
}
+bool AppSettings::notificationAlwaysShowPreview() const
+{
+ return settings.value(KEY_NOTIFICATION_ALWAYS_SHOW_PREVIEW, false).toBool();
+}
+
+void AppSettings::setNotificationAlwaysShowPreview(bool enable)
+{
+ if (notificationAlwaysShowPreview() != enable) {
+ LOG(KEY_NOTIFICATION_ALWAYS_SHOW_PREVIEW << enable);
+ settings.setValue(KEY_NOTIFICATION_ALWAYS_SHOW_PREVIEW, enable);
+ emit notificationAlwaysShowPreviewChanged();
+ }
+}
+
bool AppSettings::storageOptimizer() const
{
return settings.value(KEY_STORAGE_OPTIMIZER, true).toBool();
diff --git a/src/appsettings.h b/src/appsettings.h
index 7ddc7ca..e4a1a2d 100644
--- a/src/appsettings.h
+++ b/src/appsettings.h
@@ -34,6 +34,7 @@ class AppSettings : public QObject {
Q_PROPERTY(bool notificationSoundsEnabled READ notificationSoundsEnabled WRITE setNotificationSoundsEnabled NOTIFY notificationSoundsEnabledChanged)
Q_PROPERTY(bool notificationSuppressContent READ notificationSuppressContent WRITE setNotificationSuppressContent NOTIFY notificationSuppressContentChanged)
Q_PROPERTY(NotificationFeedback notificationFeedback READ notificationFeedback WRITE setNotificationFeedback NOTIFY notificationFeedbackChanged)
+ Q_PROPERTY(bool notificationAlwaysShowPreview READ notificationAlwaysShowPreview WRITE setNotificationAlwaysShowPreview NOTIFY notificationAlwaysShowPreviewChanged)
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)
@@ -91,6 +92,9 @@ public:
NotificationFeedback notificationFeedback() const;
void setNotificationFeedback(NotificationFeedback feedback);
+ bool notificationAlwaysShowPreview() const;
+ void setNotificationAlwaysShowPreview(bool enable);
+
bool storageOptimizer() const;
void setStorageOptimizer(bool enable);
@@ -126,6 +130,7 @@ signals:
void notificationSoundsEnabledChanged();
void notificationSuppressContentChanged();
void notificationFeedbackChanged();
+ void notificationAlwaysShowPreviewChanged();
void storageOptimizerChanged();
void allowInlineBotLocationAccessChanged();
void remainingInteractionHintsChanged();
diff --git a/src/notificationmanager.cpp b/src/notificationmanager.cpp
index 2bd4bd8..f4d6127 100644
--- a/src/notificationmanager.cpp
+++ b/src/notificationmanager.cpp
@@ -341,8 +341,18 @@ void NotificationManager::publishNotification(const NotificationGroup *notificat
QString notificationBody;
const QVariantMap senderInformation = messageMap.value(SENDER_ID).toMap();
- if (notificationGroup->totalCount == 1 && !messageMap.isEmpty()) {
+ bool outputMessageCount = notificationGroup->totalCount > 1;
+ bool messageIsEmpty = messageMap.isEmpty();
+ if (outputMessageCount || messageIsEmpty) {
+ // Either we have more than one notification or we have no content to display
+ LOG("Group" << notificationGroup->notificationGroupId << "has" << notificationGroup->totalCount << "notifications");
+ notificationBody = tr("%Ln unread messages", "", notificationGroup->totalCount);
+ }
+ if ((!outputMessageCount || appSettings->notificationAlwaysShowPreview()) && !messageIsEmpty) {
LOG("Group" << notificationGroup->notificationGroupId << "has 1 notification");
+ if (outputMessageCount) {
+ notificationBody += "; ";
+ }
if (chatInformation && (chatInformation->type == TDLibWrapper::ChatTypeBasicGroup ||
(chatInformation->type == TDLibWrapper::ChatTypeSupergroup && !chatInformation->isChannel))) {
// Add author
@@ -352,15 +362,9 @@ void NotificationManager::publishNotification(const NotificationGroup *notificat
} else {
fullName = FernschreiberUtils::getUserName(tdLibWrapper->getUserInformation(senderInformation.value(USER_ID).toString()));
}
-
- notificationBody = notificationBody + fullName.trimmed() + ": ";
+ notificationBody += fullName.trimmed() + ": ";
}
notificationBody += FernschreiberUtils::getMessageShortText(tdLibWrapper, messageMap.value(CONTENT).toMap(), (chatInformation ? chatInformation->isChannel : false), tdLibWrapper->getUserInformation().value(ID).toLongLong(), senderInformation );
- nemoNotification->setBody(notificationBody);
- } else {
- // Either we have more than one notification or we have no content to display
- LOG("Group" << notificationGroup->notificationGroupId << "has" << notificationGroup->totalCount << "notifications");
- notificationBody = tr("%Ln unread messages", "", notificationGroup->totalCount);
}
const QString summary(chatInformation ? chatInformation->title : QString());
diff --git a/translations/harbour-fernschreiber-de.ts b/translations/harbour-fernschreiber-de.ts
index 30489bc..88e83b9 100644
--- a/translations/harbour-fernschreiber-de.ts
+++ b/translations/harbour-fernschreiber-de.ts
@@ -1582,6 +1582,14 @@
Wenn Töne eingeschaltet sind, wird Fernschreiber den aktuellen Sailfish OS-Hinweiston für Chats verwenden, der in den Systemeinstellungen konfiguriert werden kann.
+
+
+ Immer bei Hinweisen die Nachricht ausgeben
+
+
+
+ Zusätzlich zur Anzahl der ungelesenen Nachrichten wird immer die neuste Nachricht an Hinweise angefügt.
+
SettingsPage
diff --git a/translations/harbour-fernschreiber-en.ts b/translations/harbour-fernschreiber-en.ts
index dc306a1..f625cdb 100644
--- a/translations/harbour-fernschreiber-en.ts
+++ b/translations/harbour-fernschreiber-en.ts
@@ -1584,6 +1584,14 @@ messages
When sounds are enabled, Fernschreiber will use the current Sailfish OS notification sound for chats, which can be configured in the system settings.
+
+
+ Always append message preview to notifications
+
+
+
+ In addition to showing the number of unread messages, the latest message will also be appended to notifications.
+
SettingsPage
diff --git a/translations/harbour-fernschreiber-es.ts b/translations/harbour-fernschreiber-es.ts
index 48fd1f2..34118fc 100644
--- a/translations/harbour-fernschreiber-es.ts
+++ b/translations/harbour-fernschreiber-es.ts
@@ -1582,6 +1582,14 @@
Cuando los sonidos están habilitados, Fernschreiber utilizará el sonido de notificación actual de Sailfish OS para los grupos, que se puede configurar en la configuración del sistema.
+
+
+
+
+
+
+
+
SettingsPage
diff --git a/translations/harbour-fernschreiber-fi.ts b/translations/harbour-fernschreiber-fi.ts
index a8e76f7..5a80d8d 100644
--- a/translations/harbour-fernschreiber-fi.ts
+++ b/translations/harbour-fernschreiber-fi.ts
@@ -1583,6 +1583,14 @@
Kun äänet ovat käytössä, Fernschreiber käyttää Sailfish OS:n ilmoitusääniä keskusteluille, jotia voit muuttaa järjestelmäasetuksista.
+
+
+
+
+
+
+
+
SettingsPage
diff --git a/translations/harbour-fernschreiber-fr.ts b/translations/harbour-fernschreiber-fr.ts
index cb76a6b..ef1651a 100644
--- a/translations/harbour-fernschreiber-fr.ts
+++ b/translations/harbour-fernschreiber-fr.ts
@@ -1582,6 +1582,14 @@
Lorsque le son est activé, Fernschreiber utilisera le réglage de Sailfish OS. Celui-ci est paramétrable depuis les paramètres du système.
+
+
+
+
+
+
+
+
SettingsPage
diff --git a/translations/harbour-fernschreiber-hu.ts b/translations/harbour-fernschreiber-hu.ts
index 49311be..c1668ee 100644
--- a/translations/harbour-fernschreiber-hu.ts
+++ b/translations/harbour-fernschreiber-hu.ts
@@ -1555,6 +1555,14 @@
+
+
+
+
+
+
+
+
SettingsPage
diff --git a/translations/harbour-fernschreiber-it.ts b/translations/harbour-fernschreiber-it.ts
index 15c21b2..6073681 100644
--- a/translations/harbour-fernschreiber-it.ts
+++ b/translations/harbour-fernschreiber-it.ts
@@ -1582,6 +1582,14 @@
Quando i suoni di notifica sono attivi, Fernschreiber utilizza l'attuale suono di notifica per i messaggi scelto per Sailfish OS, il quale può essere modificato dalle impostazioni di sistema.
+
+
+
+
+
+
+
+
SettingsPage
diff --git a/translations/harbour-fernschreiber-pl.ts b/translations/harbour-fernschreiber-pl.ts
index ab36a1c..d72d6da 100644
--- a/translations/harbour-fernschreiber-pl.ts
+++ b/translations/harbour-fernschreiber-pl.ts
@@ -1609,6 +1609,14 @@
Gdy dźwięki są włączone, Fernschreiber użyje bieżącego dźwięku powiadomienia Sailfish OS do czatów, które można skonfigurować w ustawieniach systemu.
+
+
+
+
+
+
+
+
SettingsPage
diff --git a/translations/harbour-fernschreiber-ru.ts b/translations/harbour-fernschreiber-ru.ts
index 31ec53d..4db5164 100644
--- a/translations/harbour-fernschreiber-ru.ts
+++ b/translations/harbour-fernschreiber-ru.ts
@@ -1612,6 +1612,14 @@
Если звуки разрешены, Fernschreiber использует звук, выбранный для чатов в настройках Sailfish OS.
+
+
+
+
+
+
+
+
SettingsPage
diff --git a/translations/harbour-fernschreiber-sk.ts b/translations/harbour-fernschreiber-sk.ts
index a7930ac..5ad68b4 100644
--- a/translations/harbour-fernschreiber-sk.ts
+++ b/translations/harbour-fernschreiber-sk.ts
@@ -1609,6 +1609,14 @@
Keď sú povolené zvukové oznamy, Fernschreiber použije aktuálne zvukové oznamy Sailfish OS pre čety, ktoré môžu byť upravené v nastaveniach systému.
+
+
+
+
+
+
+
+
SettingsPage
diff --git a/translations/harbour-fernschreiber-sv.ts b/translations/harbour-fernschreiber-sv.ts
index cca0617..a100f7c 100644
--- a/translations/harbour-fernschreiber-sv.ts
+++ b/translations/harbour-fernschreiber-sv.ts
@@ -1582,6 +1582,14 @@
När ljud är aktiverat, använder Fernschreiber aktuell Sailfish-signal för chatt-avisering, vilken kan ställas in i systemets ljudinställningar.
+
+
+
+
+
+
+
+
SettingsPage
diff --git a/translations/harbour-fernschreiber-zh_CN.ts b/translations/harbour-fernschreiber-zh_CN.ts
index 20b60e9..4b5c2ec 100644
--- a/translations/harbour-fernschreiber-zh_CN.ts
+++ b/translations/harbour-fernschreiber-zh_CN.ts
@@ -1556,6 +1556,14 @@
如果开启声音,Fernschreiber 会采用当前旗鱼系统通知声音作为对话通知声音,你可以在系统设置进行配置。
+
+
+
+
+
+
+
+
SettingsPage
diff --git a/translations/harbour-fernschreiber.ts b/translations/harbour-fernschreiber.ts
index 9cb3f0b..6d319bc 100644
--- a/translations/harbour-fernschreiber.ts
+++ b/translations/harbour-fernschreiber.ts
@@ -1582,6 +1582,14 @@
+
+
+
+
+
+
+
+
SettingsPage