mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-17 16:48:26 +00:00
commit
df24a6d8a6
@ -1710,7 +1710,9 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||||||
private void initializeResources() {
|
private void initializeResources() {
|
||||||
if (recipient != null) recipient.removeListener(this);
|
if (recipient != null) recipient.removeListener(this);
|
||||||
|
|
||||||
recipient = Recipient.from(this, getIntent().getParcelableExtra(ADDRESS_EXTRA), true);
|
Address address = getIntent().getParcelableExtra(ADDRESS_EXTRA);
|
||||||
|
if (address == null) { finish(); return; }
|
||||||
|
recipient = Recipient.from(this, address, true);
|
||||||
threadId = getIntent().getLongExtra(THREAD_ID_EXTRA, -1);
|
threadId = getIntent().getLongExtra(THREAD_ID_EXTRA, -1);
|
||||||
archived = getIntent().getBooleanExtra(IS_ARCHIVED_EXTRA, false);
|
archived = getIntent().getBooleanExtra(IS_ARCHIVED_EXTRA, false);
|
||||||
distributionType = getIntent().getIntExtra(DISTRIBUTION_TYPE_EXTRA, ThreadDatabase.DistributionTypes.DEFAULT);
|
distributionType = getIntent().getIntExtra(DISTRIBUTION_TYPE_EXTRA, ThreadDatabase.DistributionTypes.DEFAULT);
|
||||||
|
@ -428,9 +428,7 @@ public class ConversationFragment extends Fragment
|
|||||||
|
|
||||||
private MessageRecord getSelectedMessageRecord() {
|
private MessageRecord getSelectedMessageRecord() {
|
||||||
Set<MessageRecord> messageRecords = getListAdapter().getSelectedItems();
|
Set<MessageRecord> messageRecords = getListAdapter().getSelectedItems();
|
||||||
|
return messageRecords.iterator().next();
|
||||||
if (messageRecords.size() == 1) return messageRecords.iterator().next();
|
|
||||||
else throw new AssertionError();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reload(Recipient recipient, long threadId) {
|
public void reload(Recipient recipient, long threadId) {
|
||||||
|
@ -131,10 +131,12 @@ public class GroupMessageProcessor {
|
|||||||
String id = GroupUtil.getEncodedId(group);
|
String id = GroupUtil.getEncodedId(group);
|
||||||
|
|
||||||
String userMasterDevice = TextSecurePreferences.getMasterHexEncodedPublicKey(context);
|
String userMasterDevice = TextSecurePreferences.getMasterHexEncodedPublicKey(context);
|
||||||
|
if (userMasterDevice == null) { userMasterDevice = TextSecurePreferences.getLocalNumber(context); }
|
||||||
|
|
||||||
if (group.getGroupType() == SignalServiceGroup.GroupType.SIGNAL) {
|
if (group.getGroupType() == SignalServiceGroup.GroupType.SIGNAL) {
|
||||||
// Loki - Only update the group if the group admin sent the message
|
// Loki - Only update the group if the group admin sent the message
|
||||||
String masterDevice = MultiDeviceProtocol.shared.getMasterDevice(content.getSender());
|
String masterDevice = MultiDeviceProtocol.shared.getMasterDevice(content.getSender());
|
||||||
|
if (masterDevice == null) { masterDevice = content.getSender(); }
|
||||||
if (!groupRecord.getAdmins().contains(Address.fromSerialized(masterDevice))) {
|
if (!groupRecord.getAdmins().contains(Address.fromSerialized(masterDevice))) {
|
||||||
Log.d("Loki", "Received a group update message from a non-admin user for: " + id +"; ignoring.");
|
Log.d("Loki", "Received a group update message from a non-admin user for: " + id +"; ignoring.");
|
||||||
return null;
|
return null;
|
||||||
@ -212,6 +214,7 @@ public class GroupMessageProcessor {
|
|||||||
@NonNull GroupRecord record)
|
@NonNull GroupRecord record)
|
||||||
{
|
{
|
||||||
String masterDevice = MultiDeviceProtocol.shared.getMasterDevice(content.getSender());
|
String masterDevice = MultiDeviceProtocol.shared.getMasterDevice(content.getSender());
|
||||||
|
if (masterDevice == null) { masterDevice = content.getSender(); }
|
||||||
if (record.getMembers().contains(Address.fromSerialized(masterDevice))) {
|
if (record.getMembers().contains(Address.fromSerialized(masterDevice))) {
|
||||||
ApplicationContext.getInstance(context)
|
ApplicationContext.getInstance(context)
|
||||||
.getJobManager()
|
.getJobManager()
|
||||||
@ -234,6 +237,7 @@ public class GroupMessageProcessor {
|
|||||||
builder.setType(GroupContext.Type.QUIT);
|
builder.setType(GroupContext.Type.QUIT);
|
||||||
|
|
||||||
String masterDevice = MultiDeviceProtocol.shared.getMasterDevice(content.getSender());
|
String masterDevice = MultiDeviceProtocol.shared.getMasterDevice(content.getSender());
|
||||||
|
if (masterDevice == null) { masterDevice = content.getSender(); }
|
||||||
if (members.contains(Address.fromExternal(context, masterDevice))) {
|
if (members.contains(Address.fromExternal(context, masterDevice))) {
|
||||||
database.remove(id, Address.fromExternal(context, masterDevice));
|
database.remove(id, Address.fromExternal(context, masterDevice));
|
||||||
if (outgoing) database.setActive(id, false);
|
if (outgoing) database.setActive(id, false);
|
||||||
@ -259,7 +263,7 @@ public class GroupMessageProcessor {
|
|||||||
try {
|
try {
|
||||||
if (outgoing) {
|
if (outgoing) {
|
||||||
MmsDatabase mmsDatabase = DatabaseFactory.getMmsDatabase(context);
|
MmsDatabase mmsDatabase = DatabaseFactory.getMmsDatabase(context);
|
||||||
Address address = Address.fromExternal(context, GroupUtil.getEncodedId(group));
|
Address address = Address.fromExternal(context, GroupUtil.getEncodedId(group));
|
||||||
Recipient recipient = Recipient.from(context, address, false);
|
Recipient recipient = Recipient.from(context, address, false);
|
||||||
OutgoingGroupMediaMessage outgoingMessage = new OutgoingGroupMediaMessage(recipient, storage, null, content.getTimestamp(), 0, null, Collections.emptyList(), Collections.emptyList());
|
OutgoingGroupMediaMessage outgoingMessage = new OutgoingGroupMediaMessage(recipient, storage, null, content.getTimestamp(), 0, null, Collections.emptyList(), Collections.emptyList());
|
||||||
long threadId = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(recipient);
|
long threadId = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(recipient);
|
||||||
|
@ -52,6 +52,8 @@ public class RotateSignedPreKeyJob extends BaseJob implements InjectableType {
|
|||||||
public void onRun() throws Exception {
|
public void onRun() throws Exception {
|
||||||
Log.i(TAG, "Rotating signed prekey...");
|
Log.i(TAG, "Rotating signed prekey...");
|
||||||
|
|
||||||
|
if (!IdentityKeyUtil.hasIdentityKey(context)) { return; }
|
||||||
|
|
||||||
IdentityKeyPair identityKey = IdentityKeyUtil.getIdentityKeyPair(context);
|
IdentityKeyPair identityKey = IdentityKeyUtil.getIdentityKeyPair(context);
|
||||||
SignedPreKeyRecord signedPreKeyRecord = PreKeyUtil.generateSignedPreKey(context, identityKey, false);
|
SignedPreKeyRecord signedPreKeyRecord = PreKeyUtil.generateSignedPreKey(context, identityKey, false);
|
||||||
|
|
||||||
|
@ -97,8 +97,8 @@ object SessionMetaProtocol {
|
|||||||
* Should be invoked for the recipient's master device.
|
* Should be invoked for the recipient's master device.
|
||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun shouldSendTypingIndicator(recipient: Recipient, context: Context): Boolean {
|
fun shouldSendTypingIndicator(recipient: Recipient?, context: Context): Boolean {
|
||||||
if (recipient.isGroupRecipient) { return false }
|
if (recipient == null || recipient.isGroupRecipient) { return false }
|
||||||
val threadID = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(recipient)
|
val threadID = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(recipient)
|
||||||
return DatabaseFactory.getLokiThreadDatabase(context).getFriendRequestStatus(threadID) == LokiThreadFriendRequestStatus.FRIENDS
|
return DatabaseFactory.getLokiThreadDatabase(context).getFriendRequestStatus(threadID) == LokiThreadFriendRequestStatus.FRIENDS
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user