From b099cdbd96ed06039f7c21bd096ab50d8dba6951 Mon Sep 17 00:00:00 2001 From: Daniele Ricci Date: Mon, 6 Aug 2018 20:48:00 +0200 Subject: [PATCH 01/13] Releasing version 4.2.0-beta1 (391) Signed-off-by: Daniele Ricci --- CHANGELOG.md | 6 +++--- app/src/main/play/de-DE/whatsnew | 1 + app/src/main/play/en-US/whatsnew | 14 +++++++++----- app/src/main/play/ru-RU/whatsnew | 8 ++++---- build.gradle | 4 ++-- dist/google_play.json | 2 +- utils/git-release | 2 +- 7 files changed, 21 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91e4fcad7..ca8a6cc32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## [Next] +## [4.2.0-beta1] - 2018-08-06 ### Changed - Badge indicators for OEMs supporting it (#292) - Migrate to Firebase Cloud Messaging (#779) @@ -24,7 +24,7 @@ ### Fixed - Temporarily revert to stable emoji version - Fix public key retrieval -- Fix attachment panel close icon (#1184) +- Fix attachment panel close icon (#1184) ## [4.1.5] - 2018-06-19 ### Changed @@ -494,7 +494,7 @@ - Fix draft saving on incoming message (#448) - Fix crash during sync (#454) -[Next]: https://github.com/kontalk/androidclient/compare/v4.1.6...HEAD +[4.2.0-beta1]: https://github.com/kontalk/androidclient/compare/v4.1.6...v4.2.0-beta1 [4.1.6]: https://github.com/kontalk/androidclient/compare/v4.1.5...v4.1.6 [4.1.5]: https://github.com/kontalk/androidclient/compare/v4.1.4...v4.1.5 [4.1.4]: https://github.com/kontalk/androidclient/compare/v4.1.3...v4.1.4 diff --git a/app/src/main/play/de-DE/whatsnew b/app/src/main/play/de-DE/whatsnew index 2162ea19b..d22a43767 100644 --- a/app/src/main/play/de-DE/whatsnew +++ b/app/src/main/play/de-DE/whatsnew @@ -3,5 +3,6 @@ Registrierungsverfahren angeboten von https://JMP.Chat Helfen Sie uns bei Verbesserungen und Fehlerbehebungen indem Sie Fehlerreports auf Github posten oder in unserem Forum darüber diskutieren: https://forum.kontalk.org * einige wichtige Leistungsverbesserungen +* Behoben: einige Probleme mit öffentlichen Schlüsseln * Behoben: einige Berechtigungsprobleme * Weitere Fehler behoben \ No newline at end of file diff --git a/app/src/main/play/en-US/whatsnew b/app/src/main/play/en-US/whatsnew index d6d2366fb..6d3eabe87 100644 --- a/app/src/main/play/en-US/whatsnew +++ b/app/src/main/play/en-US/whatsnew @@ -1,7 +1,11 @@ Registration provider kindly offered by https://JMP.Chat -Help us improve and fix bugs by reporting them on GitHub or discussing them on our forum: https://forum.kontalk.org +Help us improve and fix bugs by reporting them on GitHub or discussing them on our forum! -* fix some public key issues -* some major performance improvements -* fix some permission issues -* a lot of other bugfixes \ No newline at end of file +* NEW: Copy multiple messages to clipboard +* Badge indicators for OEMs supporting it +* Migrate to Firebase Cloud Messaging +* Upgrade to Smack 4.3 +* Accepted invitation is no longer required to chat +* More precise Google Maps location +* Fix some annoying public key issues +* Fix several other bugs \ No newline at end of file diff --git a/app/src/main/play/ru-RU/whatsnew b/app/src/main/play/ru-RU/whatsnew index 0a4243d42..893418949 100644 --- a/app/src/main/play/ru-RU/whatsnew +++ b/app/src/main/play/ru-RU/whatsnew @@ -1,7 +1,7 @@ -В этот релиз вошёл новый registration provider (разработка компании https://JMP.Chat) +В этом релизе новый registration provider (разработка компании https://JMP.Chat) Помогайте нам исправлять баги, сообщая он них на GitHub или обсуждая их на нашем форуме: https://forum. kontalk.org -* Обновили набор эмоджи и клавиатуру -* Больше не поддерживаем Android 2 -* Починили баг с передачей отложенных сообщений +* Починили баги с публичными ключами +* Значительно улучшили производительность +* Поправили сломанные разрешения * И ещё массу мелочей \ No newline at end of file diff --git a/build.gradle b/build.gradle index 895b6332a..f4ddde90e 100644 --- a/build.gradle +++ b/build.gradle @@ -29,8 +29,8 @@ allprojects { evaluationDependsOn ":client-common-java" ext { applicationId = 'org.kontalk' - versionCode = 317 - versionName = '4.1.6-next' + versionCode = 391 + versionName = '4.2.0-beta1' minSdkVersion = 15 targetSdkVersion = 23 compileSdkVersion = 27 diff --git a/dist/google_play.json b/dist/google_play.json index d886d5b3d..a32f6fc92 100644 --- a/dist/google_play.json +++ b/dist/google_play.json @@ -1,6 +1,6 @@ { "full_description": "Please help us making Kontalk better! E-mail us at devteam@kontalk.org if you have any issues!! Leaving a negative review won't help a non-profit project! Thank you!\nNOTE: DO NOT INSTALL ON SD CARD!\n\nFollow @kontalknet on Twitter or identi.ca to keep up to date with the latest changes and on service status!\n\nKontalk is a secure instant messenger, allowing you to send and receive text, image and voice messages (other file types coming soon) to and from other Kontalk users completely free of charge (*).\n\n•  Your phone number is your ID. No usernames or passwords
\n•  It automatically finds other Kontalk users by looking at your address book, making it even easier to start chatting on Kontalk with your friends
\n•  End-to-end encryption ensures safe and private conversations, so that only you and the person you are talking to can read them
\n•  Your and all phone numbers used on the network are irreversibly encrypted
\n•  It supports multiple devices, making it very easy to start chatting on your phone and continue the conversation on your tablet
\n•  Based on open standards: XMPP and OpenPGP\n\nKontalk is a completely Open Source community project, with all the source code hosted on GitHub (https://github.com/kontalk), allowing everyone to inspect its security and improve it.\nThe network relies on community donations to keep the infrastructure running, so if you can, please donate on http://kontalk.net/. Even small donations matter.\n\nYou can find all permissions used by the app explained at this page: https://github.com/kontalk/androidclient/wiki/Android-client-permissions\n\n(*) Carrier fees for Internet traffic may apply", - "recent_changes": "Registration provider kindly offered by https://JMP.Chat\nHelp us improve and fix bugs by reporting them on GitHub or discussing them on our forum: https://forum.kontalk.org\n\n* fix some public key issues\n* some major performance improvements\n* fix some permission issues\n* a lot of other bugfixes", + "recent_changes": "Registration provider kindly offered by https:\/\/JMP.Chat\nHelp us improve and fix bugs by reporting them on GitHub or discussing them on our forum!\n\n* NEW: Copy multiple messages to clipboard\n* Badge indicators for OEMs supporting it\n* Migrate to Firebase Cloud Messaging\n* Upgrade to Smack 4.3\n* Accepted invitation is no longer required to chat\n* More precise Google Maps location\n* Fix some annoying public key issues\n* Fix several other bugs", "short_description": "A new way of communicating: community-driven instant messaging network.", "title": "Kontalk Messenger" } diff --git a/utils/git-release b/utils/git-release index a31793470..9c494944d 100755 --- a/utils/git-release +++ b/utils/git-release @@ -142,7 +142,7 @@ cmd_continue() { git add ${REPO_DIR}/app/src/main/play git commit -as git push -u origin ${BRANCH} - git tag -a -m "${VERSION_NAME} release" -s -u 274BE2A3BD56E37A v${VERSION_NAME} + git tag -a -m "${VERSION_NAME} release" -s -u devteam@kontalk.org v${VERSION_NAME} git push --tags echo "Uploading builds to mirror" From eda911632dd920e793aca8d5d20aa90a49305cae Mon Sep 17 00:00:00 2001 From: Daniele Ricci Date: Tue, 7 Aug 2018 14:55:06 +0200 Subject: [PATCH 02/13] Bump to next preview version Signed-off-by: Daniele Ricci --- CHANGELOG.md | 8 ++++++++ build.gradle | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca8a6cc32..4351b41e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,13 @@ - Fix database deadlock (#1194) - Ask for permission to detect user's phone number (#1201) +## [Next] +### Fixed +- ... + +### Changed +- ... + ## [4.1.6] - 2018-06-24 ### Fixed - Temporarily revert to stable emoji version @@ -494,6 +501,7 @@ - Fix draft saving on incoming message (#448) - Fix crash during sync (#454) +[Next]: https://github.com/kontalk/androidclient/compare/v4.2.0-beta1...HEAD [4.2.0-beta1]: https://github.com/kontalk/androidclient/compare/v4.1.6...v4.2.0-beta1 [4.1.6]: https://github.com/kontalk/androidclient/compare/v4.1.5...v4.1.6 [4.1.5]: https://github.com/kontalk/androidclient/compare/v4.1.4...v4.1.5 diff --git a/build.gradle b/build.gradle index f4ddde90e..ae914bbb5 100644 --- a/build.gradle +++ b/build.gradle @@ -29,8 +29,8 @@ allprojects { evaluationDependsOn ":client-common-java" ext { applicationId = 'org.kontalk' - versionCode = 391 - versionName = '4.2.0-beta1' + versionCode = 393 + versionName = '4.2.0-beta1-next' minSdkVersion = 15 targetSdkVersion = 23 compileSdkVersion = 27 From 1c9912d10e72bb665cdea13bf225ec16e8118396 Mon Sep 17 00:00:00 2001 From: Daniele Ricci Date: Tue, 7 Aug 2018 14:55:15 +0200 Subject: [PATCH 03/13] Disable any Firebase analytics Signed-off-by: Daniele Ricci --- app/src/googleplay/AndroidManifest.xml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/src/googleplay/AndroidManifest.xml b/app/src/googleplay/AndroidManifest.xml index c77723f6e..2b9dbd7a2 100644 --- a/app/src/googleplay/AndroidManifest.xml +++ b/app/src/googleplay/AndroidManifest.xml @@ -41,7 +41,14 @@ + android:value="AIzaSyDwaCo60RpTZGSItEJznAwXd5tolLZijc4" /> + + + From f92159c5d0d458ee521c1a26313ce303c761fe5e Mon Sep 17 00:00:00 2001 From: Daniele Ricci Date: Tue, 7 Aug 2018 14:57:04 +0200 Subject: [PATCH 04/13] Fix changelog Signed-off-by: Daniele Ricci --- CHANGELOG.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4351b41e7..5e84f560e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [Next] +### Fixed +- ... + +### Changed +- ... + ## [4.2.0-beta1] - 2018-08-06 ### Changed - Badge indicators for OEMs supporting it (#292) @@ -20,13 +27,6 @@ - Fix database deadlock (#1194) - Ask for permission to detect user's phone number (#1201) -## [Next] -### Fixed -- ... - -### Changed -- ... - ## [4.1.6] - 2018-06-24 ### Fixed - Temporarily revert to stable emoji version From 933e9053d431f0c1a3d7b870c7e6292cc33a8fba Mon Sep 17 00:00:00 2001 From: Daniele Ricci Date: Tue, 7 Aug 2018 16:22:29 +0200 Subject: [PATCH 05/13] Restore my key :) Signed-off-by: Daniele Ricci --- utils/git-release | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/git-release b/utils/git-release index 9c494944d..3b898cf72 100755 --- a/utils/git-release +++ b/utils/git-release @@ -142,7 +142,7 @@ cmd_continue() { git add ${REPO_DIR}/app/src/main/play git commit -as git push -u origin ${BRANCH} - git tag -a -m "${VERSION_NAME} release" -s -u devteam@kontalk.org v${VERSION_NAME} + git tag -a -m "${VERSION_NAME} release" -s -u F28947756EB27311E86F6309274BE2A3BD56E37A v${VERSION_NAME} git push --tags echo "Uploading builds to mirror" From 9f3f0829191761bbf2a9fcee20ad08954f8cbb92 Mon Sep 17 00:00:00 2001 From: Daniele Ricci Date: Wed, 8 Aug 2018 15:08:46 +0200 Subject: [PATCH 06/13] Notification channels for Android Oreo Signed-off-by: Daniele Ricci --- .../org/kontalk/service/DownloadService.java | 11 +- .../service/KeyPairGeneratorService.java | 5 +- .../org/kontalk/service/UploadService.java | 7 +- .../org/kontalk/ui/MessagingNotification.java | 171 +++++++++++++++--- .../ui/ProgressNotificationBuilder.java | 7 +- app/src/main/res/values/strings.xml | 15 ++ 6 files changed, 178 insertions(+), 38 deletions(-) diff --git a/app/src/main/java/org/kontalk/service/DownloadService.java b/app/src/main/java/org/kontalk/service/DownloadService.java index 99a542d66..39bde794a 100644 --- a/app/src/main/java/org/kontalk/service/DownloadService.java +++ b/app/src/main/java/org/kontalk/service/DownloadService.java @@ -223,6 +223,7 @@ public void startForeground(long totalBytes) { if (mNotificationBuilder == null) { mNotificationBuilder = new ProgressNotificationBuilder(getApplicationContext(), + MessagingNotification.CHANNEL_MEDIA_DOWNLOAD, R.layout.progress_notification, getString(R.string.downloading_attachment), R.drawable.ic_stat_notify, @@ -343,13 +344,14 @@ public void completed(String url, String mime, File destination) { NOTIFICATION_ID_DOWNLOAD_OK, i, 0); // create notification - NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext()) + NotificationCompat.Builder builder = new NotificationCompat + .Builder(getApplicationContext(), MessagingNotification.CHANNEL_MEDIA_DOWNLOAD) .setSmallIcon(R.drawable.ic_stat_notify) .setContentTitle(getString(R.string.notify_title_download_completed)) .setContentText(getString(R.string.notify_text_download_completed)) .setTicker(getString(R.string.notify_ticker_download_completed)) .setContentIntent(pi) - .setPriority(NotificationCompat.PRIORITY_LOW) + .setPriority(NotificationCompat.PRIORITY_MIN) .setAutoCancel(true); // notify!! @@ -376,12 +378,13 @@ private void errorNotification(String ticker, String text) { NOTIFICATION_ID_DOWNLOAD_ERROR, i, 0); // create notification - NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext()) + NotificationCompat.Builder builder = new NotificationCompat + .Builder(getApplicationContext(), MessagingNotification.CHANNEL_MEDIA_DOWNLOAD) .setSmallIcon(R.drawable.ic_stat_notify) .setContentTitle(getString(R.string.notify_title_download_error)) .setContentText(text) .setTicker(ticker) - .setPriority(NotificationCompat.PRIORITY_LOW) + .setPriority(NotificationCompat.PRIORITY_DEFAULT) .setCategory(NotificationCompat.CATEGORY_ERROR) .setContentIntent(pi) .setAutoCancel(true); diff --git a/app/src/main/java/org/kontalk/service/KeyPairGeneratorService.java b/app/src/main/java/org/kontalk/service/KeyPairGeneratorService.java index 5a2b45674..6258f8801 100644 --- a/app/src/main/java/org/kontalk/service/KeyPairGeneratorService.java +++ b/app/src/main/java/org/kontalk/service/KeyPairGeneratorService.java @@ -40,6 +40,7 @@ import org.kontalk.R; import org.kontalk.crypto.PersonalKey; import org.kontalk.ui.ConversationsActivity; +import org.kontalk.ui.MessagingNotification; import static org.kontalk.ui.MessagingNotification.NOTIFICATION_ID_KEYPAIR_GEN; @@ -108,13 +109,15 @@ private void startForeground() { PendingIntent pi = PendingIntent.getActivity(getApplicationContext(), NOTIFICATION_ID_KEYPAIR_GEN, ni, 0); - Notification no = new NotificationCompat.Builder(this) + Notification no = new NotificationCompat + .Builder(this, MessagingNotification.CHANNEL_OTHER) .setOngoing(true) .setTicker(getString(R.string.notify_gen_keypair_ticker)) .setSmallIcon(R.drawable.ic_stat_notify) .setContentTitle(getString(R.string.notify_gen_keypair_title)) .setContentText(getString(R.string.notify_gen_keypair_text)) .setContentIntent(pi) + .setPriority(NotificationCompat.PRIORITY_MIN) .build(); startForeground(NOTIFICATION_ID_KEYPAIR_GEN, no); diff --git a/app/src/main/java/org/kontalk/service/UploadService.java b/app/src/main/java/org/kontalk/service/UploadService.java index e49ea6467..4940d7901 100644 --- a/app/src/main/java/org/kontalk/service/UploadService.java +++ b/app/src/main/java/org/kontalk/service/UploadService.java @@ -42,6 +42,7 @@ import org.kontalk.reporting.ReportingManager; import org.kontalk.service.msgcenter.MessageCenterService; import org.kontalk.ui.ConversationsActivity; +import org.kontalk.ui.MessagingNotification; import org.kontalk.ui.ProgressNotificationBuilder; import org.kontalk.upload.HTPPFileUploadConnection; import org.kontalk.upload.UploadConnection; @@ -234,6 +235,7 @@ public void startForeground(long totalBytes) { if (mNotificationBuilder == null) { mNotificationBuilder = new ProgressNotificationBuilder(getApplicationContext(), + MessagingNotification.CHANNEL_MEDIA_UPLOAD, R.layout.progress_notification, getString(R.string.sending_message), R.drawable.ic_stat_notify, @@ -300,13 +302,14 @@ private static void errorNotification(Context context, NotificationManager nm, S NOTIFICATION_ID_UPLOAD_ERROR, i, 0); // create notification - NotificationCompat.Builder builder = new NotificationCompat.Builder(context.getApplicationContext()) + NotificationCompat.Builder builder = new NotificationCompat + .Builder(context.getApplicationContext(), MessagingNotification.CHANNEL_MEDIA_UPLOAD) .setSmallIcon(R.drawable.ic_stat_notify) .setContentTitle(context.getString(R.string.notify_title_upload_error)) .setContentText(text) .setTicker(ticker) .setContentIntent(pi) - .setPriority(NotificationCompat.PRIORITY_LOW) + .setPriority(NotificationCompat.PRIORITY_DEFAULT) .setCategory(NotificationCompat.CATEGORY_ERROR) .setAutoCancel(true); diff --git a/app/src/main/java/org/kontalk/ui/MessagingNotification.java b/app/src/main/java/org/kontalk/ui/MessagingNotification.java index d30e5e643..e30315730 100644 --- a/app/src/main/java/org/kontalk/ui/MessagingNotification.java +++ b/app/src/main/java/org/kontalk/ui/MessagingNotification.java @@ -20,6 +20,10 @@ import java.io.File; import java.io.InputStream; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedList; @@ -32,17 +36,21 @@ import android.accounts.Account; import android.app.Notification; +import android.app.NotificationChannel; +import android.app.NotificationManager; import android.app.PendingIntent; import android.content.ContentResolver; import android.content.ContentUris; import android.content.Context; import android.content.Intent; +import android.content.res.Resources; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.Typeface; import android.media.AudioManager; import android.net.Uri; import android.os.Build; +import android.support.annotation.RequiresApi; import android.support.v4.app.NotificationCompat; import android.support.v4.app.NotificationCompat.BigPictureStyle; import android.support.v4.app.NotificationCompat.InboxStyle; @@ -57,6 +65,8 @@ import android.text.style.ForegroundColorSpan; import android.text.style.StyleSpan; +import me.leolin.shortcutbadger.ShortcutBadger; + import org.kontalk.R; import org.kontalk.authenticator.Authenticator; import org.kontalk.data.Contact; @@ -74,25 +84,58 @@ import org.kontalk.util.Preferences; import org.kontalk.util.SystemUtils; -import me.leolin.shortcutbadger.ShortcutBadger; - /** * Various utility methods for managing system notifications. * @author Daniele Ricci */ public class MessagingNotification { + + /** + * A simple documentation annotation to link a notification ID constant + * with a channel ID. Be sure to respect that. + */ + @Target(ElementType.FIELD) + @Retention(RetentionPolicy.SOURCE) + private @interface NotificationChannelId { + String value(); + } + + public static final String CHANNEL_INCOMING_MESSAGE = "incoming_message"; + public static final String CHANNEL_MEDIA_DOWNLOAD = "media_download"; + public static final String CHANNEL_MEDIA_UPLOAD = "media_upload"; + public static final String CHANNEL_MESSAGE_CENTER = "message_center"; + public static final String CHANNEL_OTHER = "other"; + + @NotificationChannelId(CHANNEL_INCOMING_MESSAGE) public static final int NOTIFICATION_ID_MESSAGES = 101; + + @NotificationChannelId(CHANNEL_MEDIA_UPLOAD) public static final int NOTIFICATION_ID_UPLOADING = 102; + + @NotificationChannelId(CHANNEL_MEDIA_UPLOAD) public static final int NOTIFICATION_ID_UPLOAD_ERROR = 103; + + @NotificationChannelId(CHANNEL_MEDIA_DOWNLOAD) public static final int NOTIFICATION_ID_DOWNLOADING = 104; + + @NotificationChannelId(CHANNEL_MEDIA_DOWNLOAD) public static final int NOTIFICATION_ID_DOWNLOAD_OK = 105; + + @NotificationChannelId(CHANNEL_MEDIA_DOWNLOAD) public static final int NOTIFICATION_ID_DOWNLOAD_ERROR = 106; - public static final int NOTIFICATION_ID_QUICK_REPLY = 107; - public static final int NOTIFICATION_ID_KEYPAIR_GEN = 108; - public static final int NOTIFICATION_ID_INVITATION = 109; - public static final int NOTIFICATION_ID_AUTH_ERROR = 110; - public static final int NOTIFICATION_ID_FOREGROUND = 111; + + @NotificationChannelId(CHANNEL_OTHER) + public static final int NOTIFICATION_ID_KEYPAIR_GEN = 107; + + @NotificationChannelId(CHANNEL_INCOMING_MESSAGE) + public static final int NOTIFICATION_ID_INVITATION = 108; + + @NotificationChannelId(CHANNEL_OTHER) + public static final int NOTIFICATION_ID_AUTH_ERROR = 109; + + @NotificationChannelId(CHANNEL_MESSAGE_CENTER) + public static final int NOTIFICATION_ID_FOREGROUND = 110; private static final String[] MESSAGES_UNREAD_PROJECTION = { @@ -172,6 +215,90 @@ public class MessagingNotification { private MessagingNotification() {} public static void init(Context context) { + createChannels(context); + } + + private static void createChannels(Context context) { + // Create the NotificationChannel, but only on API 26+ because + // the NotificationChannel class is new and not in the support library + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + Resources resources = context.getResources(); + NotificationManager notificationManager = context.getSystemService(NotificationManager.class); + createMessageChannel(resources, notificationManager); + createDownloadChannel(resources, notificationManager); + createUploadChannel(resources, notificationManager); + createMessageCenterChannel(resources, notificationManager); + createOtherChannel(resources, notificationManager); + } + } + + @RequiresApi(Build.VERSION_CODES.O) + private static void createMessageChannel(Resources resources, NotificationManager notificationManager) { + CharSequence name = resources.getString(R.string.notify_incoming_message_channel_name); + String description = resources.getString(R.string.notify_incoming_message_channel_description); + NotificationChannel channel = new NotificationChannel(CHANNEL_INCOMING_MESSAGE, name, + NotificationManager.IMPORTANCE_HIGH); + channel.setDescription(description); + channel.enableVibration(true); + channel.enableLights(true); + channel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE); + notificationManager.createNotificationChannel(channel); + } + + @RequiresApi(Build.VERSION_CODES.O) + private static void createDownloadChannel(Resources resources, NotificationManager notificationManager) { + CharSequence name = resources.getString(R.string.notify_media_download_channel_name); + String description = resources.getString(R.string.notify_media_download_channel_description); + NotificationChannel channel = new NotificationChannel(CHANNEL_MEDIA_DOWNLOAD, name, + NotificationManager.IMPORTANCE_MIN); + channel.setDescription(description); + channel.enableLights(false); + channel.enableVibration(false); + channel.setShowBadge(false); + channel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC); + notificationManager.createNotificationChannel(channel); + } + + @RequiresApi(Build.VERSION_CODES.O) + private static void createUploadChannel(Resources resources, NotificationManager notificationManager) { + CharSequence name = resources.getString(R.string.notify_media_upload_channel_name); + String description = resources.getString(R.string.notify_media_upload_channel_description); + NotificationChannel channel = new NotificationChannel(CHANNEL_MEDIA_UPLOAD, name, + NotificationManager.IMPORTANCE_MIN); + channel.setDescription(description); + channel.enableLights(false); + channel.enableVibration(false); + channel.setShowBadge(false); + channel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC); + notificationManager.createNotificationChannel(channel); + } + + @RequiresApi(Build.VERSION_CODES.O) + private static void createMessageCenterChannel(Resources resources, NotificationManager notificationManager) { + CharSequence name = resources.getString(R.string.notify_message_center_channel_name); + String description = resources.getString(R.string.notify_message_center_channel_description); + NotificationChannel channel = new NotificationChannel(CHANNEL_MESSAGE_CENTER, name, + NotificationManager.IMPORTANCE_MIN); + channel.setDescription(description); + channel.enableLights(false); + channel.enableVibration(false); + channel.setShowBadge(false); + channel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC); + notificationManager.createNotificationChannel(channel); + } + + @RequiresApi(Build.VERSION_CODES.O) + private static void createOtherChannel(Resources resources, NotificationManager notificationManager) { + CharSequence name = resources.getString(R.string.notify_other_channel_name); + String description = resources.getString(R.string.notify_other_channel_description); + NotificationChannel channel = new NotificationChannel(CHANNEL_OTHER, name, + NotificationManager.IMPORTANCE_DEFAULT); + channel.setDescription(description); + channel.enableLights(true); + channel.enableVibration(true); + channel.setShowBadge(true); + channel.setLockscreenVisibility(Notification.VISIBILITY_PUBLIC); + notificationManager.createNotificationChannel(channel); } public static void setPaused(String jid) { @@ -293,7 +420,8 @@ public static void updateMessagesNotification(Context context, boolean isNew) { return; } - NotificationCompat.Builder builder = new NotificationCompat.Builder(context.getApplicationContext()); + NotificationCompat.Builder builder = new NotificationCompat + .Builder(context.getApplicationContext(), CHANNEL_INCOMING_MESSAGE); Set conversationIds = new HashSet<>(unread); long latestTimestamp = 0; @@ -485,7 +613,7 @@ private static void setAlerts(Context context, NotificationCompat.Builder builde /** High priority message with Kontalk colors :-) */ private static void setFeatures(Context context, NotificationCompat.Builder builder) { builder - .setPriority(NotificationCompat.PRIORITY_HIGH) + .setPriority(NotificationCompat.PRIORITY_MAX) .setCategory(NotificationCompat.CATEGORY_MESSAGE) .setColor(ContextCompat.getColor(context, R.color.app_accent)); } @@ -559,11 +687,11 @@ public static void chatInvitation(Context context, String jid) { // build the notification NotificationCompat.Builder builder = new NotificationCompat - .Builder(context.getApplicationContext()); - builder + .Builder(context.getApplicationContext(), CHANNEL_INCOMING_MESSAGE) .setAutoCancel(true) .setSmallIcon(R.drawable.ic_stat_notify) .setTicker(context.getString(R.string.title_invitation)) + .setPriority(NotificationCompat.PRIORITY_HIGH) .setContentTitle(title) .setContentText(context.getString(R.string.invite_notification)) .setContentIntent(pi); @@ -602,8 +730,7 @@ public static void authenticationError(Context context) { // build the notification NotificationCompat.Builder builder = new NotificationCompat - .Builder(context.getApplicationContext()); - builder + .Builder(context.getApplicationContext(), CHANNEL_OTHER) .setAutoCancel(true) .setSmallIcon(R.drawable.ic_stat_notify) .setTicker(context.getString(R.string.title_auth_error)) @@ -630,7 +757,8 @@ public static Notification buildForegroundNotification(Context context) { NOTIFICATION_ID_FOREGROUND, ni, PendingIntent.FLAG_UPDATE_CURRENT); // build the notification - return new NotificationCompat.Builder(context.getApplicationContext()) + return new NotificationCompat + .Builder(context.getApplicationContext(), CHANNEL_MESSAGE_CENTER) .setOngoing(true) .setSmallIcon(R.drawable.ic_stat_notify) .setPriority(NotificationCompat.PRIORITY_MIN) @@ -1082,20 +1210,5 @@ public PendingIntent getPendingIntent() { } return createPendingIntent(mContext, ni); } - - public String getLastMessageText() { - return conversation.content; - } - - public String getLastMessagePeer() { - return conversation.peer; - } - - public PendingIntent getLastMessagePendingIntent() { - // one unread conversation - open ComposeMessage on that peer - Intent ni = ComposeMessage.fromConversation(mContext, conversation.id); - return PendingIntent.getActivity(mContext, NOTIFICATION_ID_QUICK_REPLY, - ni, 0); - } } } diff --git a/app/src/main/java/org/kontalk/ui/ProgressNotificationBuilder.java b/app/src/main/java/org/kontalk/ui/ProgressNotificationBuilder.java index 536317839..1d4e6393a 100644 --- a/app/src/main/java/org/kontalk/ui/ProgressNotificationBuilder.java +++ b/app/src/main/java/org/kontalk/ui/ProgressNotificationBuilder.java @@ -40,11 +40,12 @@ public class ProgressNotificationBuilder extends NotificationCompat.Builder { private int mLayout; public ProgressNotificationBuilder(Context context, + String channelId, int layout, CharSequence tickerText, int smallIcon, PendingIntent intent) { - super(context); + super(context, channelId); mContext = context; mLayout = layout; @@ -55,7 +56,9 @@ public ProgressNotificationBuilder(Context context, setContentIntent(intent); setOngoing(true); setCategory(NotificationCompat.CATEGORY_PROGRESS); - setPriority(NotificationCompat.PRIORITY_LOW); + // apparently PRIORITY_MIN/IMPORTANCE_MIN is not compatible with setOnGoing + // system will raise this to PRIORITY_LOW/IMPORTANCE_MIN unless changed by user + setPriority(NotificationCompat.PRIORITY_MIN); } /** diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d0d1b7688..000a06c03 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -683,6 +683,21 @@ Your server + Messages + Incoming messages + + Downloads + Media downloads + + Uploads + Media uploads + + Message Center + Required to keep Kontalk service alive + + Other + Other notifications + The selected chat will be deleted. The selected chats will be deleted. From 125459da487f7aa332c2bae146b825ecb9c51565 Mon Sep 17 00:00:00 2001 From: Daniele Ricci Date: Wed, 8 Aug 2018 15:35:25 +0200 Subject: [PATCH 07/13] Opt-out of server administrator messages (close #1132) Signed-off-by: Daniele Ricci --- CHANGELOG.md | 3 ++- .../org/kontalk/service/msgcenter/MessageListener.java | 8 ++++++++ app/src/main/java/org/kontalk/util/Preferences.java | 5 +++++ app/src/main/res/values/config.xml | 1 + app/src/main/res/values/strings.xml | 3 +++ app/src/main/res/xml/preferences_messaging.xml | 5 +++++ 6 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e84f560e..10e18104e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,8 @@ - ... ### Changed -- ... +- Notification channels (aka notification categoris) +- Opt-out of server administrator messages (#1132) ## [4.2.0-beta1] - 2018-08-06 ### Changed diff --git a/app/src/main/java/org/kontalk/service/msgcenter/MessageListener.java b/app/src/main/java/org/kontalk/service/msgcenter/MessageListener.java index 65082bbb1..39e71410f 100644 --- a/app/src/main/java/org/kontalk/service/msgcenter/MessageListener.java +++ b/app/src/main/java/org/kontalk/service/msgcenter/MessageListener.java @@ -276,6 +276,14 @@ private void processChatMessage(Message m, Intent chatStateBroadcast) throws Sma msgId = MessageUtils.messageId(); Jid from = m.getFrom(); + + // check if user opted out of server messages + if (!Preferences.isServerMessagesEnabled(getContext()) && + from.asBareJid().toString().equalsIgnoreCase(getServer().getNetwork())) { + Log.w(TAG, "user opted out of server messages, message will be ignored"); + return; + } + String body = m.getBody(); // create message diff --git a/app/src/main/java/org/kontalk/util/Preferences.java b/app/src/main/java/org/kontalk/util/Preferences.java index f597e07b9..92da51979 100644 --- a/app/src/main/java/org/kontalk/util/Preferences.java +++ b/app/src/main/java/org/kontalk/util/Preferences.java @@ -603,6 +603,11 @@ public static boolean isDebugLogEnabled(Context context) { .getResources().getBoolean(R.bool.pref_default_debug_log)); } + public static boolean isServerMessagesEnabled(Context context) { + return getBoolean("pref_server_messages", context + .getResources().getBoolean(R.bool.pref_default_server_messages)); + } + public static long getPingAlarmInterval(Context context, long defaultValue) { String networkType = SystemUtils.getCurrentNetworkName(context); return (networkType != null) ? diff --git a/app/src/main/res/values/config.xml b/app/src/main/res/values/config.xml index 80757f967..d44169f9b 100644 --- a/app/src/main/res/values/config.xml +++ b/app/src/main/res/values/config.xml @@ -32,6 +32,7 @@ false false false + true medium diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 000a06c03..6b9202e7c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -458,6 +458,9 @@ Include invisible contacts Include contacts not displayed in Contacts app. Enable if you use DAVDroid + Receive server messages + Allow messages from server administrators. You might miss important news if you disable this + Accept any SSL certificate Delete your account diff --git a/app/src/main/res/xml/preferences_messaging.xml b/app/src/main/res/xml/preferences_messaging.xml index fef8d9523..394b73e06 100644 --- a/app/src/main/res/xml/preferences_messaging.xml +++ b/app/src/main/res/xml/preferences_messaging.xml @@ -44,5 +44,10 @@ android:title="@string/pref_sync_invisible_contacts" android:defaultValue="@bool/pref_default_sync_invisible_contacts" android:layout="@layout/md_preference_custom"/> + From c6b628d5d9f0c974f9bc970f16d9b6627c0df0a2 Mon Sep 17 00:00:00 2001 From: Daniele Ricci Date: Wed, 8 Aug 2018 20:55:11 +0200 Subject: [PATCH 08/13] Remove deprecated code Signed-off-by: Daniele Ricci --- app/src/main/java/org/kontalk/Kontalk.java | 21 ------------- .../org/kontalk/client/NumberValidator.java | 7 ----- .../kontalk/service/XMPPConnectionHelper.java | 4 --- .../msgcenter/ImportKeyPairListener.java | 3 +- .../msgcenter/MessageCenterService.java | 9 ------ .../msgcenter/PGPKeyPairRingProvider.java | 31 ------------------- .../msgcenter/RegisterKeyPairListener.java | 14 +++------ 7 files changed, 7 insertions(+), 82 deletions(-) delete mode 100644 app/src/main/java/org/kontalk/service/msgcenter/PGPKeyPairRingProvider.java diff --git a/app/src/main/java/org/kontalk/Kontalk.java b/app/src/main/java/org/kontalk/Kontalk.java index a9c8e713a..b93e833fa 100644 --- a/app/src/main/java/org/kontalk/Kontalk.java +++ b/app/src/main/java/org/kontalk/Kontalk.java @@ -50,7 +50,6 @@ import org.kontalk.reporting.ReportingManager; import org.kontalk.service.DownloadService; import org.kontalk.service.NetworkStateReceiver; -import org.kontalk.service.ServerListUpdater; import org.kontalk.service.SystemBootStartup; import org.kontalk.service.UploadService; import org.kontalk.service.msgcenter.IPushService; @@ -61,7 +60,6 @@ import org.kontalk.ui.ComposeMessage; import org.kontalk.ui.MessagingNotification; import org.kontalk.ui.SearchActivity; -import org.kontalk.util.MediaStorage; import org.kontalk.util.Preferences; @@ -79,15 +77,6 @@ public class Kontalk extends Application { */ private static Kontalk sInstance; - // @deprecated - static { - try { - Class.forName(MediaStorage.class.getName()); - } - catch (ClassNotFoundException ignored) { - } - } - private PersonalKey mDefaultKey; /** @@ -212,9 +201,6 @@ public void onCreate() { AccountManager am = AccountManager.get(this); Account account = Authenticator.getDefaultAccount(am); if (account != null) { - if (!Authenticator.hasPersonalKey(am, account)) - xmppUpgrade(); - // update notifications from locally unread messages MessagingNotification.delayedUpdateMessagesNotification(this, false); @@ -265,13 +251,6 @@ public void onAccountsUpdated(Account[] accounts) { setBackendEnabled(this, false); } - private void xmppUpgrade() { - // delete custom server - Preferences.setServerURI(null); - // delete cached server list - ServerListUpdater.deleteCachedList(this); - } - public PersonalKey getPersonalKey() throws PGPException, IOException, CertificateException { try { if (mDefaultKey == null) diff --git a/app/src/main/java/org/kontalk/client/NumberValidator.java b/app/src/main/java/org/kontalk/client/NumberValidator.java index 0ed4e79ef..ef02b56d1 100644 --- a/app/src/main/java/org/kontalk/client/NumberValidator.java +++ b/app/src/main/java/org/kontalk/client/NumberValidator.java @@ -73,7 +73,6 @@ import org.kontalk.reporting.ReportingManager; import org.kontalk.service.XMPPConnectionHelper; import org.kontalk.service.XMPPConnectionHelper.ConnectionHelperListener; -import org.kontalk.service.msgcenter.PGPKeyPairRingProvider; /** @@ -221,12 +220,6 @@ public void setFallback(boolean fallback) { mFallback = fallback; } - @Override - public PGPKeyPairRingProvider getKeyPairRingProvider() { - // not supported - return null; - } - public void importKey(byte[] privateKeyData, byte[] publicKeyData) { mImportedPrivateKey = privateKeyData; mImportedPublicKey = publicKeyData; diff --git a/app/src/main/java/org/kontalk/service/XMPPConnectionHelper.java b/app/src/main/java/org/kontalk/service/XMPPConnectionHelper.java index 606b9da8f..1d64608ef 100644 --- a/app/src/main/java/org/kontalk/service/XMPPConnectionHelper.java +++ b/app/src/main/java/org/kontalk/service/XMPPConnectionHelper.java @@ -48,7 +48,6 @@ import org.kontalk.client.KontalkConnection; import org.kontalk.crypto.PersonalKey; import org.kontalk.service.msgcenter.MessageCenterService; -import org.kontalk.service.msgcenter.PGPKeyPairRingProvider; import org.kontalk.util.InternalTrustStore; import org.kontalk.util.Preferences; @@ -371,8 +370,5 @@ public interface ConnectionHelperListener extends ConnectionListener { void reconnectingIn(int seconds); void authenticationFailed(); - - PGPKeyPairRingProvider getKeyPairRingProvider(); - } } diff --git a/app/src/main/java/org/kontalk/service/msgcenter/ImportKeyPairListener.java b/app/src/main/java/org/kontalk/service/msgcenter/ImportKeyPairListener.java index d98ae98a0..1e0ad6eed 100644 --- a/app/src/main/java/org/kontalk/service/msgcenter/ImportKeyPairListener.java +++ b/app/src/main/java/org/kontalk/service/msgcenter/ImportKeyPairListener.java @@ -20,6 +20,7 @@ import android.widget.Toast; +import org.kontalk.Kontalk; import org.kontalk.R; import org.kontalk.crypto.PersonalKeyImporter; @@ -92,7 +93,7 @@ public void processStanza(Stanza packet) { protected void finish() { runOnUiThread(new Runnable() { public void run() { - Toast.makeText(getApplication(), + Toast.makeText(Kontalk.get(), R.string.msg_import_keypair_complete, Toast.LENGTH_LONG).show(); } diff --git a/app/src/main/java/org/kontalk/service/msgcenter/MessageCenterService.java b/app/src/main/java/org/kontalk/service/msgcenter/MessageCenterService.java index 13aa37b04..52c20740e 100644 --- a/app/src/main/java/org/kontalk/service/msgcenter/MessageCenterService.java +++ b/app/src/main/java/org/kontalk/service/msgcenter/MessageCenterService.java @@ -3130,15 +3130,6 @@ void endKeyPairRegeneration() { } } - /** - * Used by {@link XMPPConnectionHelper} to retrieve the keyring that will - * be used for the next login while upgrading from legacy. - */ - @Override - public PGPKeyPairRingProvider getKeyPairRingProvider() { - return mKeyPairRegenerator; - } - private void beginKeyPairImport(Uri keypack, String passphrase) { if (mKeyPairImporter == null) { try { diff --git a/app/src/main/java/org/kontalk/service/msgcenter/PGPKeyPairRingProvider.java b/app/src/main/java/org/kontalk/service/msgcenter/PGPKeyPairRingProvider.java deleted file mode 100644 index 2ba07ad7c..000000000 --- a/app/src/main/java/org/kontalk/service/msgcenter/PGPKeyPairRingProvider.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Kontalk Android client - * Copyright (C) 2018 Kontalk Devteam - - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package org.kontalk.service.msgcenter; - -import org.kontalk.crypto.PGP.PGPKeyPairRing; - - -/** - * Interface for retrieving a key pair ring. - * @author Daniele Ricci - */ -public interface PGPKeyPairRingProvider { - - public PGPKeyPairRing getKeyPair(); -} diff --git a/app/src/main/java/org/kontalk/service/msgcenter/RegisterKeyPairListener.java b/app/src/main/java/org/kontalk/service/msgcenter/RegisterKeyPairListener.java index 5e09f6697..6497cd2d0 100644 --- a/app/src/main/java/org/kontalk/service/msgcenter/RegisterKeyPairListener.java +++ b/app/src/main/java/org/kontalk/service/msgcenter/RegisterKeyPairListener.java @@ -42,6 +42,7 @@ import android.text.TextUtils; import android.util.Base64; +import org.kontalk.Kontalk; import org.kontalk.Log; import org.kontalk.authenticator.Authenticator; import org.kontalk.client.SmackInitializer; @@ -53,7 +54,7 @@ /** Abstract listener and manager for a key pair registration cycle. */ -abstract class RegisterKeyPairListener extends MessageCenterPacketListener implements PGPKeyPairRingProvider { +abstract class RegisterKeyPairListener extends MessageCenterPacketListener { private BroadcastReceiver mConnReceiver; protected PGPKeyPairRing mKeyRing; protected PGPPublicKey mRevoked; @@ -66,11 +67,6 @@ public RegisterKeyPairListener(MessageCenterService instance, String passphrase) mPassphrase = passphrase; } - @Override - public PGPKeyPairRing getKeyPair() { - return mKeyRing; - } - protected void configure() { SmackInitializer.initializeRegistration(); } @@ -175,7 +171,7 @@ public void onReceive(Context context, Intent intent) { protected void revokeCurrentKey() throws CertificateException, PGPException, IOException, SignatureException { - PersonalKey oldKey = getApplication().getPersonalKey(); + PersonalKey oldKey = Kontalk.get().getPersonalKey(); if (oldKey != null) mRevoked = oldKey.revoke(false); } @@ -222,13 +218,13 @@ public void processStanza(Stanza packet) { publicKeyData, privateKeyData, bridgeCertData, mPassphrase); // invalidate cached personal key - getApplication().invalidatePersonalKey(); + Kontalk.get().invalidatePersonalKey(); unconfigure(); finish(); // restart message center - MessageCenterService.restart(getApplication()); + MessageCenterService.restart(Kontalk.get()); } // TODO else? From 2433b02f954b40355f125f2c04264b3866056a51 Mon Sep 17 00:00:00 2001 From: Daniele Ricci Date: Wed, 8 Aug 2018 20:58:58 +0200 Subject: [PATCH 09/13] Do not notify at application startup It's a bit of an overkill. Use the good old BOOT_COMPLETED broadcast receiver instead. Signed-off-by: Daniele Ricci --- app/src/main/java/org/kontalk/Kontalk.java | 3 --- .../org/kontalk/service/SystemBootStartup.java | 15 ++++++++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/kontalk/Kontalk.java b/app/src/main/java/org/kontalk/Kontalk.java index b93e833fa..33d44ec6b 100644 --- a/app/src/main/java/org/kontalk/Kontalk.java +++ b/app/src/main/java/org/kontalk/Kontalk.java @@ -201,9 +201,6 @@ public void onCreate() { AccountManager am = AccountManager.get(this); Account account = Authenticator.getDefaultAccount(am); if (account != null) { - // update notifications from locally unread messages - MessagingNotification.delayedUpdateMessagesNotification(this, false); - // register account change listener final OnAccountsUpdateListener listener = new OnAccountsUpdateListener() { @Override diff --git a/app/src/main/java/org/kontalk/service/SystemBootStartup.java b/app/src/main/java/org/kontalk/service/SystemBootStartup.java index ad0702c38..6211e9ba6 100644 --- a/app/src/main/java/org/kontalk/service/SystemBootStartup.java +++ b/app/src/main/java/org/kontalk/service/SystemBootStartup.java @@ -19,7 +19,10 @@ package org.kontalk.service; import org.kontalk.Kontalk; +import org.kontalk.authenticator.Authenticator; +import org.kontalk.ui.MessagingNotification; +import android.accounts.Account; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; @@ -27,13 +30,19 @@ /** * Receiver for the BOOT_COMPLETED action. - * This is actually just a dummy to allow {@link Kontalk} do its jobs. + * Fires up any unread notifications before the last reboot. * @author Daniele Ricci - * @version 1.0 */ public class SystemBootStartup extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - // nothing to do here + if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) { + Account account = Authenticator.getDefaultAccount(Kontalk.get()); + if (account != null) { + // update notifications from locally unread messages + MessagingNotification + .delayedUpdateMessagesNotification(Kontalk.get(), false); + } + } } } From ab062c2880954aa369fa026fa1cadbe95e72623c Mon Sep 17 00:00:00 2001 From: Daniele Ricci Date: Thu, 9 Aug 2018 12:20:50 +0200 Subject: [PATCH 10/13] Prevent Smack from re-sending unacknowledged stanzas Messages were stuck in sending state until next reconnection because Smack was re-sending undelivered stanzas. While that's a useful feature, it messes with message listeners which must be managing sending of messages. Signed-off-by: Daniele Ricci --- CHANGELOG.md | 2 +- app/src/main/java/org/kontalk/client/XMPPTCPConnection.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10e18104e..c8de66260 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## [Next] ### Fixed -- ... +- Fix messages stuck in sending state ### Changed - Notification channels (aka notification categoris) diff --git a/app/src/main/java/org/kontalk/client/XMPPTCPConnection.java b/app/src/main/java/org/kontalk/client/XMPPTCPConnection.java index 7b1b553cd..602bc5c41 100644 --- a/app/src/main/java/org/kontalk/client/XMPPTCPConnection.java +++ b/app/src/main/java/org/kontalk/client/XMPPTCPConnection.java @@ -424,7 +424,8 @@ protected synchronized void loginInternal(String username, String password, Reso if (unacknowledgedStanzas != null) { // There was a previous connection with SM enabled but that was either not resumable or // failed to resume. Make sure that we (re-)send the unacknowledged stanzas. - unacknowledgedStanzas.drainTo(previouslyUnackedStanzas); + // HACK this line below was commented out to avoid re-sending lost stanzas automatically + // unacknowledgedStanzas.drainTo(previouslyUnackedStanzas); // Reset unacknowledged stanzas to 'null' to signal that we never send 'enable' in this // XMPP session (There maybe was an enabled in a previous XMPP session of this // connection instance though). This is used in writePackets to decide if stanzas should From 45788c5882882276ae6513a7d643eec8a4f9c374 Mon Sep 17 00:00:00 2001 From: Daniele Ricci Date: Mon, 20 Aug 2018 12:34:54 +0200 Subject: [PATCH 11/13] Upgrade tools Signed-off-by: Daniele Ricci --- app/build.gradle | 2 +- build.gradle | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f94e12882..27c7bcc04 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -188,7 +188,7 @@ dependencies { googleplayImplementation "com.google.android.gms:play-services-base:$googlePlayServicesVersion" googleplayImplementation "com.google.firebase:firebase-core:16.0.1" - googleplayImplementation "com.google.firebase:firebase-messaging:17.1.0" + googleplayImplementation "com.google.firebase:firebase-messaging:17.3.0" googleplayImplementation('com.crashlytics.sdk.android:crashlytics:2.9.4@aar') { transitive = true } diff --git a/build.gradle b/build.gradle index ae914bbb5..76bd3e244 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { maven { url 'https://maven.fabric.io/public' } } dependencies { - classpath 'com.android.tools.build:gradle:3.1.3' + classpath 'com.android.tools.build:gradle:3.1.4' classpath 'com.google.gms:google-services:4.0.0' classpath 'com.github.triplet.gradle:play-publisher:1.2.0' classpath 'io.fabric.tools:gradle:1.25.1' From 822af84040f2f6e840770ee7f1aafdb06a032ba0 Mon Sep 17 00:00:00 2001 From: Daniele Ricci Date: Mon, 20 Aug 2018 14:48:31 +0200 Subject: [PATCH 12/13] Fix missing Firebase data Signed-off-by: Daniele Ricci --- app/proguard.cfg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/proguard.cfg b/app/proguard.cfg index 1f2da3105..61a8a6914 100644 --- a/app/proguard.cfg +++ b/app/proguard.cfg @@ -11,6 +11,8 @@ -dontwarn org.xmlpull.v1.** -dontwarn java.lang.management.** +-keepattributes *Annotation*, Signature, Exception + # keep all of Kontalk -keep class org.kontalk.** { *; } From e91beec81401ea6a01e1a91f8b634b9261b092eb Mon Sep 17 00:00:00 2001 From: Daniele Ricci Date: Mon, 20 Aug 2018 14:58:03 +0200 Subject: [PATCH 13/13] Update changelog for previous commit Signed-off-by: Daniele Ricci --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8de66260..b8494afe2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [Next] ### Fixed - Fix messages stuck in sending state +- Fix push notifications not working ### Changed - Notification channels (aka notification categoris)