always show number of connected accounts in foreground notification. fixes #3352

This commit is contained in:
Daniel Gultsch 2019-01-23 17:07:14 +01:00
parent 2e0db4dcda
commit a32bb652f7
9 changed files with 13 additions and 20 deletions

View file

@ -51,7 +51,6 @@ public final class Config {
//Notification settings
public static final boolean HIDE_MESSAGE_TEXT_IN_NOTIFICATION = false;
public static final boolean SHOW_CONNECTED_ACCOUNTS = false; //show number of connected accounts in foreground notification
public static final boolean ALWAYS_NOTIFY_BY_DEFAULT = false;
public static final boolean SUPPRESS_ERROR_NOTIFICATION = false;

View file

@ -901,28 +901,24 @@ public class NotificationService {
Notification createForegroundNotification() {
final Notification.Builder mBuilder = new Notification.Builder(mXmppConnectionService);
mBuilder.setContentTitle(mXmppConnectionService.getString(R.string.app_name));
if (Compatibility.runsAndTargetsTwentySix(mXmppConnectionService) || Config.SHOW_CONNECTED_ACCOUNTS) {
final List<Account> accounts = mXmppConnectionService.getAccounts();
int enabled = 0;
int connected = 0;
if (accounts != null) {
for (Account account : accounts) {
if (account.isOnlineAndConnected()) {
connected++;
enabled++;
} else if (account.isEnabled()) {
enabled++;
}
final List<Account> accounts = mXmppConnectionService.getAccounts();
int enabled = 0;
int connected = 0;
if (accounts != null) {
for (Account account : accounts) {
if (account.isOnlineAndConnected()) {
connected++;
enabled++;
} else if (account.isEnabled()) {
enabled++;
}
}
mBuilder.setContentText(mXmppConnectionService.getString(R.string.connected_accounts, connected, enabled));
} else {
mBuilder.setContentText(mXmppConnectionService.getString(R.string.touch_to_open_conversations));
}
mBuilder.setContentText(mXmppConnectionService.getString(R.string.connected_accounts, connected, enabled));
mBuilder.setContentIntent(createOpenConversationsIntent());
mBuilder.setWhen(0);
mBuilder.setPriority(Notification.PRIORITY_MIN);
mBuilder.setSmallIcon(R.drawable.ic_link_white_24dp);
mBuilder.setSmallIcon(connected > 0 ? R.drawable.ic_link_white_24dp : R.drawable.ic_link_off_white_24dp);
if (Compatibility.runsTwentySix()) {
mBuilder.setChannelId("foreground");

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

View file

@ -400,7 +400,6 @@
<string name="pdf_document">PDF document</string>
<string name="apk">Android App</string>
<string name="vcard">Contact</string>
<string name="touch_to_open_conversations">Touch to open Conversations</string>
<string name="avatar_has_been_published">Avatar has been published!</string>
<string name="sending_x_file">Sending %s</string>
<string name="offering_x_file">Offering %s</string>

View file

@ -7,7 +7,6 @@
<string name="contacts_have_no_pgp_keys">Quicksy is unable to encrypt your messages because your contacts are not announcing their public key.\n\n<small>Please ask your contacts to setup OpenPGP.</small></string>
<string name="pref_notification_grace_period_summary">The length of time Quicksy keeps quiet after seeing activity on another device</string>
<string name="pref_never_send_crash_summary">By sending in stack traces you are helping the ongoing development of Quicksy</string>
<string name="touch_to_open_conversations">Touch to open Quicksy</string>
<string name="no_storage_permission">Quicksy needs access to external storage</string>
<string name="no_camera_permission">Quicksy needs access to the camera</string>
<string name="battery_optimizations_enabled_explained">Your device is doing some heavy battery optimizations on Quicksy that might lead to delayed notifications or even message loss.\nIt is recommended to disable those.</string>
@ -20,4 +19,4 @@
<string name="no_microphone_permission">Quicksy needs access to the microphone</string>
<string name="foreground_service_channel_description">This notification category is used to display a permanent notification indicating that Quicksy is running.</string>
<string name="set_profile_picture">Quicksy profile picture</string>
</resources>
</resources>