mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Respect privacy settings on ticker content for Android <5
Fixes #5517 Closes #5592 // FREEBIE
This commit is contained in:
parent
e7ad77398f
commit
a370f086c0
@ -6,6 +6,9 @@
|
||||
<string name="delete">Delete</string>
|
||||
<string name="please_wait">Please wait...</string>
|
||||
|
||||
<!-- AbstractNotificationBuilder -->
|
||||
<string name="AbstractNotificationBuilder_new_message">New message</string>
|
||||
|
||||
<!-- ApplicationPreferencesActivity -->
|
||||
<string name="ApplicationPreferencesActivity_currently_s">Currently: %s</string>
|
||||
<string name="ApplicationPreferenceActivity_you_havent_set_a_passphrase_yet">You haven\'t set a passphrase yet!</string>
|
||||
|
@ -10,6 +10,7 @@ import android.support.v4.app.NotificationCompat;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.database.RecipientPreferenceDatabase;
|
||||
import org.thoughtcrime.securesms.preferences.NotificationPrivacyPreference;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
@ -61,6 +62,16 @@ public abstract class AbstractNotificationBuilder extends NotificationCompat.Bui
|
||||
}
|
||||
}
|
||||
|
||||
public void setTicker(@NonNull Recipient recipient, @Nullable CharSequence message) {
|
||||
if (privacy.isDisplayMessage()) {
|
||||
setTicker(getStyledMessage(recipient, message));
|
||||
} else if (privacy.isDisplayContact()) {
|
||||
setTicker(getStyledMessage(recipient, context.getString(R.string.AbstractNotificationBuilder_new_message)));
|
||||
} else {
|
||||
setTicker(context.getString(R.string.AbstractNotificationBuilder_new_message));
|
||||
}
|
||||
}
|
||||
|
||||
private String[] parseBlinkPattern(String blinkPattern, String blinkPatternCustom) {
|
||||
if (blinkPattern.equals("custom"))
|
||||
blinkPattern = blinkPatternCustom;
|
||||
|
@ -278,7 +278,8 @@ public class MessageNotifier {
|
||||
|
||||
if (signal) {
|
||||
builder.setAlarms(notificationState.getRingtone(), notificationState.getVibrate());
|
||||
builder.setTicker(notifications.get(0).getText());
|
||||
builder.setTicker(notifications.get(0).getIndividualRecipient(),
|
||||
notifications.get(0).getText());
|
||||
}
|
||||
|
||||
((NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE))
|
||||
|
@ -150,16 +150,6 @@ public class SingleRecipientNotificationBuilder extends AbstractNotificationBuil
|
||||
}
|
||||
}
|
||||
|
||||
public void setTicker(@NonNull Recipient recipient, @Nullable CharSequence message) {
|
||||
if (privacy.isDisplayMessage()) {
|
||||
setTicker(getStyledMessage(recipient, message));
|
||||
} else if (privacy.isDisplayContact()) {
|
||||
setTicker(getStyledMessage(recipient, context.getString(R.string.SingleRecipientNotificationBuilder_new_message)));
|
||||
} else {
|
||||
setTicker(context.getString(R.string.SingleRecipientNotificationBuilder_new_message));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Notification build() {
|
||||
if (privacy.isDisplayMessage()) {
|
||||
|
Loading…
Reference in New Issue
Block a user