mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +00:00
parent
bdb67725c5
commit
e172b84603
@ -317,9 +317,9 @@ public class ConversationAdapter <V extends View & BindableConversationItem>
|
|||||||
if (lastSeen <= 0) return -1;
|
if (lastSeen <= 0) return -1;
|
||||||
if (!isActiveCursor()) return -1;
|
if (!isActiveCursor()) return -1;
|
||||||
|
|
||||||
int count = getItemCount() - (hasHeaderView() ? 1 : 0) - (hasFooterView() ? 1 : 0);
|
int count = getItemCount() - (hasFooterView() ? 1 : 0);
|
||||||
|
|
||||||
for (int i=0;i<count;i++) {
|
for (int i=(hasHeaderView() ? 1 : 0);i<count;i++) {
|
||||||
MessageRecord messageRecord = getRecordForPositionOrThrow(i);
|
MessageRecord messageRecord = getRecordForPositionOrThrow(i);
|
||||||
|
|
||||||
if (messageRecord.isOutgoing() || messageRecord.getDateReceived() <= lastSeen) {
|
if (messageRecord.isOutgoing() || messageRecord.getDateReceived() <= lastSeen) {
|
||||||
|
@ -431,7 +431,7 @@ public class ConversationFragment extends Fragment
|
|||||||
setLastSeen(loader.getLastSeen());
|
setLastSeen(loader.getLastSeen());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!loader.hasSent() && !recipient.isSystemContact() && !recipient.isGroupRecipient() && recipient.getRegistered() != RecipientDatabase.RegisteredState.REGISTERED) {
|
if (!loader.hasSent() && !recipient.isSystemContact() && !recipient.isGroupRecipient() && recipient.getRegistered() == RecipientDatabase.RegisteredState.REGISTERED) {
|
||||||
getListAdapter().setHeaderView(unknownSenderView);
|
getListAdapter().setHeaderView(unknownSenderView);
|
||||||
} else {
|
} else {
|
||||||
getListAdapter().setHeaderView(null);
|
getListAdapter().setHeaderView(null);
|
||||||
|
@ -69,6 +69,7 @@ public class DatabaseUpgradeActivity extends BaseActivity {
|
|||||||
public static final int MEDIA_DOWNLOAD_CONTROLS_VERSION = 151;
|
public static final int MEDIA_DOWNLOAD_CONTROLS_VERSION = 151;
|
||||||
public static final int REDPHONE_SUPPORT_VERSION = 157;
|
public static final int REDPHONE_SUPPORT_VERSION = 157;
|
||||||
public static final int NO_MORE_CANONICAL_DB_VERSION = 276;
|
public static final int NO_MORE_CANONICAL_DB_VERSION = 276;
|
||||||
|
public static final int PROFILES = 289;
|
||||||
|
|
||||||
private static final SortedSet<Integer> UPGRADE_VERSIONS = new TreeSet<Integer>() {{
|
private static final SortedSet<Integer> UPGRADE_VERSIONS = new TreeSet<Integer>() {{
|
||||||
add(NO_MORE_KEY_EXCHANGE_PREFIX_VERSION);
|
add(NO_MORE_KEY_EXCHANGE_PREFIX_VERSION);
|
||||||
@ -233,6 +234,12 @@ public class DatabaseUpgradeActivity extends BaseActivity {
|
|||||||
.add(new DirectoryRefreshJob(getApplicationContext()));
|
.add(new DirectoryRefreshJob(getApplicationContext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (params[0] < PROFILES) {
|
||||||
|
ApplicationContext.getInstance(getApplicationContext())
|
||||||
|
.getJobManager()
|
||||||
|
.add(new DirectoryRefreshJob(getApplicationContext()));
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import android.support.annotation.NonNull;
|
|||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.R;
|
import org.thoughtcrime.securesms.R;
|
||||||
@ -27,6 +28,7 @@ public class UnknownSenderView extends FrameLayout {
|
|||||||
this.threadId = threadId;
|
this.threadId = threadId;
|
||||||
|
|
||||||
inflate(context, R.layout.unknown_sender_view, this);
|
inflate(context, R.layout.unknown_sender_view, this);
|
||||||
|
setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
|
||||||
|
|
||||||
View block = ViewUtil.findById(this, R.id.block);
|
View block = ViewUtil.findById(this, R.id.block);
|
||||||
View add = ViewUtil.findById(this, R.id.add_to_contacts);
|
View add = ViewUtil.findById(this, R.id.add_to_contacts);
|
||||||
|
@ -67,7 +67,7 @@ class RecipientProvider {
|
|||||||
private static final Map<String, RecipientDetails> STATIC_DETAILS = new HashMap<String, RecipientDetails>() {{
|
private static final Map<String, RecipientDetails> STATIC_DETAILS = new HashMap<String, RecipientDetails>() {{
|
||||||
put("262966", new RecipientDetails("Amazon", null, null,
|
put("262966", new RecipientDetails("Amazon", null, null,
|
||||||
ContactPhotoFactory.getResourceContactPhoto(R.drawable.ic_amazon),
|
ContactPhotoFactory.getResourceContactPhoto(R.drawable.ic_amazon),
|
||||||
null, null));
|
false, null, null));
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@NonNull Recipient getRecipient(Context context, Address address, Optional<RecipientSettings> settings, Optional<GroupRecord> groupRecord, boolean asynchronous) {
|
@NonNull Recipient getRecipient(Context context, Address address, Optional<RecipientSettings> settings, Optional<GroupRecord> groupRecord, boolean asynchronous) {
|
||||||
@ -100,7 +100,7 @@ class RecipientProvider {
|
|||||||
if (address.isGroup() && settings.isPresent() && groupRecord.isPresent()) {
|
if (address.isGroup() && settings.isPresent() && groupRecord.isPresent()) {
|
||||||
return Optional.of(getGroupRecipientDetails(context, address, groupRecord, settings, true));
|
return Optional.of(getGroupRecipientDetails(context, address, groupRecord, settings, true));
|
||||||
} else if (!address.isGroup() && settings.isPresent()) {
|
} else if (!address.isGroup() && settings.isPresent()) {
|
||||||
return Optional.of(new RecipientDetails(null, null, null, ContactPhotoFactory.getLoadingPhoto(), settings.get(), null));
|
return Optional.of(new RecipientDetails(null, null, null, ContactPhotoFactory.getLoadingPhoto(), !TextUtils.isEmpty(settings.get().getSystemDisplayName()), settings.get(), null));
|
||||||
}
|
}
|
||||||
|
|
||||||
return Optional.absent();
|
return Optional.absent();
|
||||||
@ -145,7 +145,7 @@ class RecipientProvider {
|
|||||||
address,
|
address,
|
||||||
name);
|
name);
|
||||||
|
|
||||||
return new RecipientDetails(cursor.getString(0), cursor.getString(4), contactUri, contactPhoto, settings.orNull(), null);
|
return new RecipientDetails(cursor.getString(0), cursor.getString(4), contactUri, contactPhoto, true, settings.orNull(), null);
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "resultNumber is null");
|
Log.w(TAG, "resultNumber is null");
|
||||||
}
|
}
|
||||||
@ -157,7 +157,7 @@ class RecipientProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (STATIC_DETAILS.containsKey(address.serialize())) return STATIC_DETAILS.get(address.serialize());
|
if (STATIC_DETAILS.containsKey(address.serialize())) return STATIC_DETAILS.get(address.serialize());
|
||||||
else return new RecipientDetails(null, null, null, ContactPhotoFactory.getSignalAvatarContactPhoto(context, address, null, context.getResources().getDimensionPixelSize(R.dimen.contact_photo_target_size)), settings.orNull(), null);
|
else return new RecipientDetails(null, null, null, ContactPhotoFactory.getSignalAvatarContactPhoto(context, address, null, context.getResources().getDimensionPixelSize(R.dimen.contact_photo_target_size)), false, settings.orNull(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private @NonNull RecipientDetails getGroupRecipientDetails(Context context, Address groupId, Optional<GroupRecord> groupRecord, Optional<RecipientSettings> settings, boolean asynchronous) {
|
private @NonNull RecipientDetails getGroupRecipientDetails(Context context, Address groupId, Optional<GroupRecord> groupRecord, Optional<RecipientSettings> settings, boolean asynchronous) {
|
||||||
@ -183,10 +183,10 @@ class RecipientProvider {
|
|||||||
title = context.getString(R.string.RecipientProvider_unnamed_group);;
|
title = context.getString(R.string.RecipientProvider_unnamed_group);;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new RecipientDetails(title, null, null, contactPhoto, settings.orNull(), members);
|
return new RecipientDetails(title, null, null, contactPhoto, false, settings.orNull(), members);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new RecipientDetails(context.getString(R.string.RecipientProvider_unnamed_group), null, null, ContactPhotoFactory.getDefaultGroupPhoto(), settings.orNull(), null);
|
return new RecipientDetails(context.getString(R.string.RecipientProvider_unnamed_group), null, null, ContactPhotoFactory.getDefaultGroupPhoto(), false, settings.orNull(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
static class RecipientDetails {
|
static class RecipientDetails {
|
||||||
@ -212,7 +212,7 @@ class RecipientProvider {
|
|||||||
|
|
||||||
public RecipientDetails(@Nullable String name, @Nullable String customLabel,
|
public RecipientDetails(@Nullable String name, @Nullable String customLabel,
|
||||||
@Nullable Uri contactUri, @NonNull ContactPhoto avatar,
|
@Nullable Uri contactUri, @NonNull ContactPhoto avatar,
|
||||||
@Nullable RecipientSettings settings,
|
boolean systemContact, @Nullable RecipientSettings settings,
|
||||||
@Nullable List<Recipient> participants)
|
@Nullable List<Recipient> participants)
|
||||||
{
|
{
|
||||||
this.customLabel = customLabel;
|
this.customLabel = customLabel;
|
||||||
@ -232,7 +232,7 @@ class RecipientProvider {
|
|||||||
this.profileKey = settings != null ? settings.getProfileKey() : null;
|
this.profileKey = settings != null ? settings.getProfileKey() : null;
|
||||||
this.profileAvatar = settings != null ? settings.getProfileAvatar() : null;
|
this.profileAvatar = settings != null ? settings.getProfileAvatar() : null;
|
||||||
this.profileSharing = settings != null && settings.isProfileSharing();
|
this.profileSharing = settings != null && settings.isProfileSharing();
|
||||||
this.systemContact = settings != null && !TextUtils.isEmpty(settings.getSystemDisplayName());
|
this.systemContact = systemContact;
|
||||||
|
|
||||||
if (name == null && settings != null) this.name = settings.getSystemDisplayName();
|
if (name == null && settings != null) this.name = settings.getSystemDisplayName();
|
||||||
else this.name = name;
|
else this.name = name;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user