kopia lustrzana https://github.com/ryukoposting/Signal-Android
Temporary fix for Signal contact displaying as SMS for N seconds
The whole recipient pipeline needs to be changed more subsantially, particularly given the way directory discovery works with it. This will temporarily solve the problem though.fork-5.53.8
rodzic
6ff0a62338
commit
7eb089c9de
|
@ -1053,7 +1053,16 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||||
Context context = ConversationActivity.this;
|
Context context = ConversationActivity.this;
|
||||||
Recipient recipient = params[0];
|
Recipient recipient = params[0];
|
||||||
Log.w(TAG, "Resolving registered state...");
|
Log.w(TAG, "Resolving registered state...");
|
||||||
RegisteredState registeredState = recipient.resolve().getRegistered();
|
RegisteredState registeredState;
|
||||||
|
|
||||||
|
if (recipient.isResolving()) {
|
||||||
|
Log.w(TAG, "Talking to DB directly.");
|
||||||
|
registeredState = DatabaseFactory.getRecipientDatabase(ConversationActivity.this).isRegistered(recipient.getAddress());
|
||||||
|
} else {
|
||||||
|
Log.w(TAG, "Checking through resolved recipient");
|
||||||
|
registeredState = recipient.resolve().getRegistered();
|
||||||
|
}
|
||||||
|
|
||||||
Log.w(TAG, "Resolved registered state: " + registeredState);
|
Log.w(TAG, "Resolved registered state: " + registeredState);
|
||||||
boolean signalEnabled = TextSecurePreferences.isPushRegistered(context);
|
boolean signalEnabled = TextSecurePreferences.isPushRegistered(context);
|
||||||
|
|
||||||
|
|
|
@ -345,6 +345,16 @@ public class RecipientDatabase extends Database {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// XXX This shouldn't be here, and is just a temporary workaround
|
||||||
|
public RegisteredState isRegistered(@NonNull Address address) {
|
||||||
|
SQLiteDatabase db = databaseHelper.getReadableDatabase();
|
||||||
|
|
||||||
|
try (Cursor cursor = db.query(TABLE_NAME, new String[] {REGISTERED}, ADDRESS + " = ?", new String[] {address.serialize()}, null, null, null)) {
|
||||||
|
if (cursor != null && cursor.moveToFirst()) return RegisteredState.fromId(cursor.getInt(0));
|
||||||
|
else return RegisteredState.UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateOrInsert(Address address, ContentValues contentValues) {
|
private void updateOrInsert(Address address, ContentValues contentValues) {
|
||||||
SQLiteDatabase database = databaseHelper.getWritableDatabase();
|
SQLiteDatabase database = databaseHelper.getWritableDatabase();
|
||||||
|
|
||||||
|
|
|
@ -529,7 +529,8 @@ public class Recipient implements RecipientModifiedListener {
|
||||||
this.stale = true;
|
this.stale = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized boolean isResolving() {
|
// XXX This shouldn't be public, temporary workaround
|
||||||
|
public synchronized boolean isResolving() {
|
||||||
return resolving;
|
return resolving;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue