Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'jb51257' into 'upgrade-3.4.0'
[buteo-sync-plugins-social] Backport notification changes to 3.4.0. Contributes to JB#51257

See merge request mer-core/buteo-sync-plugins-social!72
  • Loading branch information
adenexter committed Oct 20, 2020
2 parents 3dfd3f8 + 2ce9f20 commit 0b8a5a0
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 67 deletions.
6 changes: 0 additions & 6 deletions rpm/sociald.spec
Expand Up @@ -258,9 +258,6 @@ Requires: %{name} = %{version}-%{release}
#%%{_libdir}/buteo-plugins-qt5/libtwitter-notifications-client.so
%config %{_sysconfdir}/buteo/profiles/client/twitter-notifications.xml
%config %{_sysconfdir}/buteo/profiles/sync/twitter.Notifications.xml
%{_datadir}/lipstick/notificationcategories/x-nemo.social.twitter.mention.conf
%{_datadir}/lipstick/notificationcategories/x-nemo.social.twitter.retweet.conf
%{_datadir}/lipstick/notificationcategories/x-nemo.social.twitter.follower.conf
%{_datadir}/translations/lipstick-jolla-home-twitter-notif_eng_en.qm

%pre twitter-notifications
Expand Down Expand Up @@ -292,7 +289,6 @@ Requires: %{name} = %{version}-%{release}
#%%{_libdir}/buteo-plugins-qt5/libtwitter-posts-client.so
%config %{_sysconfdir}/buteo/profiles/client/twitter-posts.xml
%config %{_sysconfdir}/buteo/profiles/sync/twitter.Posts.xml
%{_datadir}/lipstick/notificationcategories/x-nemo.social.twitter.tweet.conf

%pre twitter-posts
USERS=$(getent group users | cut -d ":" -f 4 | tr "," "\n")
Expand Down Expand Up @@ -345,7 +341,6 @@ Requires: %{name} = %{version}-%{release}
%{summary}.

%files vk-posts
%{_datadir}/lipstick/notificationcategories/x-nemo.social.vk.statuspost.conf
#%{_datadir}/translations/lipstick-jolla-home-vk_eng_en.qm
#out-of-process-plugin form:
%{_libdir}/buteo-plugins-qt5/oopp/vk-posts-client
Expand Down Expand Up @@ -517,7 +512,6 @@ Requires: %{name} = %{version}-%{release}
#%%{_libdir}/buteo-plugins-qt5/libvk-notifications-client.so
%config %{_sysconfdir}/buteo/profiles/client/vk-notifications.xml
%config %{_sysconfdir}/buteo/profiles/sync/vk.Notifications.xml
%{_datadir}/lipstick/notificationcategories/x-nemo.social.vk.notification.conf

%pre vk-notifications
USERS=$(getent group users | cut -d ":" -f 4 | tr "," "\n")
Expand Down
9 changes: 1 addition & 8 deletions src/twitter/twitter-notifications/twitter-notifications.pro
Expand Up @@ -10,19 +10,13 @@ twitter_notifications_sync_profile.path = /etc/buteo/profiles/sync
twitter_notifications_sync_profile.files = $$PWD/twitter.Notifications.xml
twitter_notifications_client_plugin_xml.path = /etc/buteo/profiles/client
twitter_notifications_client_plugin_xml.files = $$PWD/twitter-notifications.xml
twitter_notifications_notification_xml.path = /usr/share/lipstick/notificationcategories/
twitter_notifications_notification_xml.files = \
$$PWD/x-nemo.social.twitter.mention.conf \
$$PWD/x-nemo.social.twitter.retweet.conf \
$$PWD/x-nemo.social.twitter.follower.conf

HEADERS += twitternotificationsplugin.h
SOURCES += twitternotificationsplugin.cpp

OTHER_FILES += \
twitter_notifications_sync_profile.files \
twitter_notifications_client_plugin_xml.files \
twitter_notifications_notification_xml.files
twitter_notifications_client_plugin_xml.files

# translations
TWITTER_TS_FILE = $$OUT_PWD/lipstick-jolla-home-twitter-notif.ts
Expand Down Expand Up @@ -52,6 +46,5 @@ INSTALLS += \
target \
twitter_notifications_sync_profile \
twitter_notifications_client_plugin_xml \
twitter_notifications_notification_xml \
twitter_ts_install \
twitter_engineering_english_install
Expand Up @@ -300,6 +300,8 @@ void TwitterNotificationSyncAdaptor::finishedMentionsHandler()
notification->setBody(qtTrId("qtn_social_notifications_twitter_n_mentions_include_n", notification->itemCount()));
openUrlArgs << QLatin1String("https://mobile.twitter.com/i/connect");
}
notification->clearPreviewSummary();
notification->clearPreviewBody();
notification->setRemoteAction(OPEN_BROWSER_ACTION(openUrlArgs));
notification->publish();
if (notification->replacesId() == 0) {
Expand Down Expand Up @@ -397,6 +399,8 @@ void TwitterNotificationSyncAdaptor::finishedRetweetsHandler()
notification->setBody(qtTrId("qtn_social_notifications_twitter_m_n_retweets_include_n", delta));
openUrlArgs << QLatin1String("https://mobile.twitter.com/i/connect");
}
notification->clearPreviewSummary();
notification->clearPreviewBody();
notification->setRemoteAction(OPEN_BROWSER_ACTION(openUrlArgs));
notification->publish();
if (notification->replacesId() == 0) {
Expand Down Expand Up @@ -506,6 +510,9 @@ void TwitterNotificationSyncAdaptor::finishedFollowersHandler()
//: The number of new followers (n) the user has on Twitter. Include n. e.g. "You" + "have 5 new followers".
//% "have %n new followers"
notification->setBody(qtTrId("qtn_social_notifications_n_followers_include_n", notification->itemCount()));
notification->clearPreviewSummary();
notification->clearPreviewBody();

QStringList openUrlArgs;
openUrlArgs << QLatin1String("https://mobile.twitter.com/i/connect");
notification->setRemoteAction(OPEN_BROWSER_ACTION(openUrlArgs));
Expand Down Expand Up @@ -550,13 +557,17 @@ void TwitterNotificationSyncAdaptor::finishedUserShowHandler()
if (ok && (response.contains("name") || response.contains("screen_name"))) {
QString name = response.value("name").toString();
QString screenName = response.value("screen_name").toString();

Notification *notification = createNotification(accountId, Retweet);
notification->setItemCount(1);
notification->setTimestamp(QDateTime::currentDateTimeUtc());
notification->setSummary(name.isEmpty() ? screenName : name);
//: Text telling the user that another user has followed them, e.g.: "John Smith" + "followed you".
//% "followed you"
notification->setBody(qtTrId("qtn_social_notifications_twitter_followed_you"));
notification->clearPreviewSummary();
notification->clearPreviewBody();

QStringList openUrlArgs;
openUrlArgs << QLatin1String("https://mobile.twitter.com/i/connect");
notification->setRemoteAction(OPEN_BROWSER_ACTION(openUrlArgs));
Expand All @@ -583,7 +594,9 @@ Notification *TwitterNotificationSyncAdaptor::createNotification(int accountId,
notification = new Notification(this);
//% "Twitter"
notification->setAppName(qtTrId("qtn_social_notifications_twitter"));
notification->setAppIcon("icon-lock-twitter");
notification->setHintValue("x-nemo.sociald.account-id", accountId);
notification->setHintValue("x-nemo-feedback", "social");
if (ntype == TwitterNotificationSyncAdaptor::Mention) {
notification->setCategory(QLatin1String("x-nemo.social.twitter.mention"));
} else if (ntype == TwitterNotificationSyncAdaptor::Retweet) {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

8 changes: 2 additions & 6 deletions src/twitter/twitter-posts/twitter-posts.pro
Expand Up @@ -10,19 +10,15 @@ twitter_posts_sync_profile.path = /etc/buteo/profiles/sync
twitter_posts_sync_profile.files = $$PWD/twitter.Posts.xml
twitter_posts_client_plugin_xml.path = /etc/buteo/profiles/client
twitter_posts_client_plugin_xml.files = $$PWD/twitter-posts.xml
twitter_posts_notification_xml.path = /usr/share/lipstick/notificationcategories/
twitter_posts_notification_xml.files = $$PWD/x-nemo.social.twitter.tweet.conf

HEADERS += twitterpostsplugin.h
SOURCES += twitterpostsplugin.cpp

OTHER_FILES += \
twitter_posts_sync_profile.files \
twitter_posts_client_plugin_xml.files \
twitter_posts_notification_xml.files
twitter_posts_client_plugin_xml.files

INSTALLS += \
target \
twitter_posts_sync_profile \
twitter_posts_client_plugin_xml \
twitter_posts_notification_xml
twitter_posts_client_plugin_xml
5 changes: 0 additions & 5 deletions src/twitter/twitter-posts/x-nemo.social.twitter.tweet.conf

This file was deleted.

8 changes: 2 additions & 6 deletions src/vk/vk-notifications/vk-notifications.pro
Expand Up @@ -10,19 +10,15 @@ vk_notifications_sync_profile.path = /etc/buteo/profiles/sync
vk_notifications_sync_profile.files = $$PWD/vk.Notifications.xml
vk_notifications_client_plugin_xml.path = /etc/buteo/profiles/client
vk_notifications_client_plugin_xml.files = $$PWD/vk-notifications.xml
vk_notifications_notification_xml.path = /usr/share/lipstick/notificationcategories/
vk_notifications_notification_xml.files = $$PWD/x-nemo.social.vk.notification.conf

HEADERS += vknotificationsplugin.h
SOURCES += vknotificationsplugin.cpp

OTHER_FILES += \
vk.Notifications.xml \
vk-notifications.xml \
x-nemo.social.vk.notification.conf
vk-notifications.xml

INSTALLS += \
target \
vk_notifications_sync_profile \
vk_notifications_client_plugin_xml \
vk_notifications_notification_xml
vk_notifications_client_plugin_xml
8 changes: 0 additions & 8 deletions src/vk/vk-notifications/x-nemo.social.vk.notification.conf

This file was deleted.

8 changes: 2 additions & 6 deletions src/vk/vk-posts/vk-posts.pro
Expand Up @@ -13,19 +13,15 @@ vk_posts_sync_profile.path = /etc/buteo/profiles/sync
vk_posts_sync_profile.files = $$PWD/vk.Posts.xml
vk_posts_client_plugin_xml.path = /etc/buteo/profiles/client
vk_posts_client_plugin_xml.files = $$PWD/vk-posts.xml
vk_posts_notification_xml.path = /usr/share/lipstick/notificationcategories/
vk_posts_notification_xml.files = $$PWD/x-nemo.social.vk.statuspost.conf

HEADERS += vkpostsplugin.h
SOURCES += vkpostsplugin.cpp

OTHER_FILES += \
vk.Posts.xml \
vk-posts.xml \
x-nemo.social.vk.statuspost.conf
vk-posts.xml

INSTALLS += \
target \
vk_posts_sync_profile \
vk_posts_client_plugin_xml \
vk_posts_notification_xml
vk_posts_client_plugin_xml
7 changes: 0 additions & 7 deletions src/vk/vk-posts/x-nemo.social.vk.statuspost.conf

This file was deleted.

0 comments on commit 0b8a5a0

Please sign in to comment.