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