Fix migration issue

This commit is contained in:
nielsandriesse 2020-10-28 15:04:47 +11:00
parent ced392a555
commit c8f7d788b9
3 changed files with 13 additions and 9 deletions

View File

@ -465,11 +465,11 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
String groupId = GroupUtil.getEncodedOpenGroupId(publicChat.getId().getBytes()); String groupId = GroupUtil.getEncodedOpenGroupId(publicChat.getId().getBytes());
publicChatAPI.updateProfileIfNeeded( publicChatAPI.updateProfileIfNeeded(
publicChat.getChannel(), publicChat.getChannel(),
publicChat.getServer(), publicChat.getServer(),
groupId, groupId,
info, info,
false); false);
runOnUiThread(ConversationActivity.this::updateSubtitleTextView); runOnUiThread(ConversationActivity.this::updateSubtitleTextView);
return Unit.INSTANCE; return Unit.INSTANCE;

View File

@ -92,8 +92,9 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
private static final int lokiV13 = 34; private static final int lokiV13 = 34;
private static final int lokiV14_BACKUP_FILES = 35; private static final int lokiV14_BACKUP_FILES = 35;
private static final int lokiV15 = 36; private static final int lokiV15 = 36;
private static final int lokiV16 = 37;
private static final int DATABASE_VERSION = lokiV15; private static final int DATABASE_VERSION = lokiV16;
private static final String DATABASE_NAME = "signal.db"; private static final String DATABASE_NAME = "signal.db";
private final Context context; private final Context context;
@ -630,10 +631,13 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
} }
if (oldVersion < lokiV15) { if (oldVersion < lokiV15) {
db.execSQL(LokiAPIDatabase.getCreateOpenGroupProfilePictureTableCommand());
db.execSQL(SharedSenderKeysDatabase.getCreateOldClosedGroupRatchetTableCommand()); db.execSQL(SharedSenderKeysDatabase.getCreateOldClosedGroupRatchetTableCommand());
} }
if (oldVersion < lokiV16) {
db.execSQL(LokiAPIDatabase.getCreateOpenGroupProfilePictureTableCommand());
}
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} finally { } finally {
db.endTransaction(); db.endTransaction();

View File

@ -68,10 +68,10 @@ class ProfilePictureView : RelativeLayout {
return result ?: publicKey return result ?: publicKey
} }
} }
fun isOpenGroupWithAvatar(recipient: Recipient): Boolean { fun isOpenGroupWithProfilePicture(recipient: Recipient): Boolean {
return recipient.isOpenGroupRecipient && recipient.groupAvatarId != null return recipient.isOpenGroupRecipient && recipient.groupAvatarId != null
} }
if (recipient.isGroupRecipient && !isOpenGroupWithAvatar(recipient)) { if (recipient.isGroupRecipient && !isOpenGroupWithProfilePicture(recipient)) {
val users = MentionsManager.shared.userPublicKeyCache[threadID]?.toMutableList() ?: mutableListOf() val users = MentionsManager.shared.userPublicKeyCache[threadID]?.toMutableList() ?: mutableListOf()
users.remove(TextSecurePreferences.getLocalNumber(context)) users.remove(TextSecurePreferences.getLocalNumber(context))
val masterPublicKey = TextSecurePreferences.getMasterHexEncodedPublicKey(context) val masterPublicKey = TextSecurePreferences.getMasterHexEncodedPublicKey(context)