Fix migration of group names when creating Notification Channels.

master
Greyson Parrelli 2018-08-22 14:19:37 -07:00
parent ca2efcac8a
commit cedab7f504
2 changed files with 12 additions and 1 deletions

View File

@ -261,6 +261,18 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
String displayName = NotificationChannels.getChannelDisplayNameFor(context, systemName, profileName, address);
boolean vibrateEnabled = vibrateState == 0 ? TextSecurePreferences.isNotificationVibrateEnabled(context) : vibrateState == 1;
if (address.isGroup()) {
try(Cursor groupCursor = db.rawQuery("SELECT title FROM groups WHERE group_id = ?", new String[] { address.toGroupString() })) {
if (groupCursor != null && groupCursor.moveToFirst()) {
String title = groupCursor.getString(groupCursor.getColumnIndexOrThrow("title"));
if (!TextUtils.isEmpty(title)) {
displayName = title;
}
}
}
}
String channelId = NotificationChannels.createChannelFor(context, address, displayName, messageSoundUri, vibrateEnabled);
ContentValues values = new ContentValues(1);

View File

@ -17,7 +17,6 @@
*/
package org.thoughtcrime.securesms.recipients;
import android.app.NotificationChannel;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.net.Uri;