mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-17 16:48:26 +00:00
Enable profile sharing upon becoming friends with a contact.
This commit is contained in:
parent
88234c26a3
commit
a852b019aa
@ -2376,9 +2376,11 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||||||
new AsyncTask<Void, Void, Long>() {
|
new AsyncTask<Void, Void, Long>() {
|
||||||
@Override
|
@Override
|
||||||
protected Long doInBackground(Void... param) {
|
protected Long doInBackground(Void... param) {
|
||||||
|
/* Loki - Don't enable profile sharing if we initiate conversation
|
||||||
if (initiating) {
|
if (initiating) {
|
||||||
DatabaseFactory.getRecipientDatabase(context).setProfileSharing(recipient, true);
|
DatabaseFactory.getRecipientDatabase(context).setProfileSharing(recipient, true);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return MessageSender.send(context, outgoingMessage, threadId, forceSms, () -> fragment.releaseOutgoingMessage(id));
|
return MessageSender.send(context, outgoingMessage, threadId, forceSms, () -> fragment.releaseOutgoingMessage(id));
|
||||||
}
|
}
|
||||||
@ -2431,9 +2433,11 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||||||
new AsyncTask<OutgoingTextMessage, Void, Long>() {
|
new AsyncTask<OutgoingTextMessage, Void, Long>() {
|
||||||
@Override
|
@Override
|
||||||
protected Long doInBackground(OutgoingTextMessage... messages) {
|
protected Long doInBackground(OutgoingTextMessage... messages) {
|
||||||
|
/* Loki - Don't enable profile sharing if we initiate conversation
|
||||||
if (initiatingConversation) {
|
if (initiatingConversation) {
|
||||||
DatabaseFactory.getRecipientDatabase(context).setProfileSharing(recipient, true);
|
DatabaseFactory.getRecipientDatabase(context).setProfileSharing(recipient, true);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return MessageSender.send(context, messages[0], threadId, forceSms, () -> fragment.releaseOutgoingMessage(id));
|
return MessageSender.send(context, messages[0], threadId, forceSms, () -> fragment.releaseOutgoingMessage(id));
|
||||||
}
|
}
|
||||||
@ -3052,12 +3056,14 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
|||||||
long originalThreadID = lokiMessageDatabase.getOriginalThreadID(friendRequest.id);
|
long originalThreadID = lokiMessageDatabase.getOriginalThreadID(friendRequest.id);
|
||||||
long threadId = originalThreadID < 0 ? this.threadId : originalThreadID;
|
long threadId = originalThreadID < 0 ? this.threadId : originalThreadID;
|
||||||
|
|
||||||
Address contact = DatabaseFactory.getThreadDatabase(this).getRecipientForThreadId(threadId).getAddress();
|
Recipient contact = DatabaseFactory.getThreadDatabase(this).getRecipientForThreadId(threadId);
|
||||||
String contactPubKey = contact.toString();
|
Address address = contact.getAddress();
|
||||||
|
String contactPubKey = address.serialize();
|
||||||
DatabaseFactory.getLokiThreadDatabase(this).setFriendRequestStatus(threadId, LokiThreadFriendRequestStatus.FRIENDS);
|
DatabaseFactory.getLokiThreadDatabase(this).setFriendRequestStatus(threadId, LokiThreadFriendRequestStatus.FRIENDS);
|
||||||
lokiMessageDatabase.setFriendRequestStatus(friendRequest.id, LokiMessageFriendRequestStatus.REQUEST_ACCEPTED);
|
lokiMessageDatabase.setFriendRequestStatus(friendRequest.id, LokiMessageFriendRequestStatus.REQUEST_ACCEPTED);
|
||||||
|
DatabaseFactory.getRecipientDatabase(this).setProfileSharing(contact, true);
|
||||||
MessageSender.sendBackgroundMessageToAllDevices(this, contactPubKey);
|
MessageSender.sendBackgroundMessageToAllDevices(this, contactPubKey);
|
||||||
MessageSender.syncContact(this, contact);
|
MessageSender.syncContact(this, address);
|
||||||
updateInputPanel();
|
updateInputPanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1200,6 +1200,8 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
|||||||
if (syncContact) {
|
if (syncContact) {
|
||||||
MessageSender.syncContact(context, contactID.getAddress());
|
MessageSender.syncContact(context, contactID.getAddress());
|
||||||
}
|
}
|
||||||
|
// Allow profile sharing with contact
|
||||||
|
DatabaseFactory.getRecipientDatabase(context).setProfileSharing(contactID, true);
|
||||||
// Update the last message if needed
|
// Update the last message if needed
|
||||||
LokiStorageAPI.shared.getPrimaryDevicePublicKey(pubKey).success(primaryDevice -> {
|
LokiStorageAPI.shared.getPrimaryDevicePublicKey(pubKey).success(primaryDevice -> {
|
||||||
Util.runOnMain(() -> {
|
Util.runOnMain(() -> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user