mirror of
https://github.com/oxen-io/session-android.git
synced 2025-05-06 04:47:14 +00:00
Cleanup for PR review
This commit is contained in:
parent
4ee5f36ad8
commit
3b3935f9be
@ -4,15 +4,10 @@ import android.content.Context
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import network.loki.messenger.R
|
|
||||||
import network.loki.messenger.databinding.ContactSectionHeaderBinding
|
import network.loki.messenger.databinding.ContactSectionHeaderBinding
|
||||||
import network.loki.messenger.databinding.ViewContactBinding
|
import network.loki.messenger.databinding.ViewContactBinding
|
||||||
import org.session.libsession.utilities.recipients.Recipient
|
import org.session.libsession.utilities.recipients.Recipient
|
||||||
import org.session.libsignal.utilities.Log
|
|
||||||
import org.thoughtcrime.securesms.database.Storage
|
|
||||||
import org.thoughtcrime.securesms.mms.GlideRequests
|
import org.thoughtcrime.securesms.mms.GlideRequests
|
||||||
import org.thoughtcrime.securesms.showSessionDialog
|
|
||||||
import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities
|
|
||||||
|
|
||||||
sealed class ContactListItem {
|
sealed class ContactListItem {
|
||||||
class Header(val name: String) : ContactListItem()
|
class Header(val name: String) : ContactListItem()
|
||||||
@ -41,7 +36,7 @@ class ContactListAdapter(
|
|||||||
binding.nameTextView.text = contact.displayName
|
binding.nameTextView.text = contact.displayName
|
||||||
binding.root.setOnClickListener { listener(contact.recipient) }
|
binding.root.setOnClickListener { listener(contact.recipient) }
|
||||||
|
|
||||||
// TODO: When we implement deleting contacts then probably do it here w/ something like:
|
// TODO: When we implement deleting contacts (hide might be safest) then probably set a long-click listener here w/ something like:
|
||||||
/*
|
/*
|
||||||
binding.root.setOnLongClickListener {
|
binding.root.setOnLongClickListener {
|
||||||
Log.w("[ACL]", "Long clicked on contact ${contact.recipient.name}")
|
Log.w("[ACL]", "Long clicked on contact ${contact.recipient.name}")
|
||||||
|
@ -1373,9 +1373,10 @@ open class Storage(
|
|||||||
threadDB.deleteConversation(threadID)
|
threadDB.deleteConversation(threadID)
|
||||||
|
|
||||||
val recipient = getRecipientForThread(threadID)
|
val recipient = getRecipientForThread(threadID)
|
||||||
if (recipient == null) { Log.w(TAG, "Got null recipient when deleting conversation - aborting."); return }
|
if (recipient == null) {
|
||||||
|
Log.w(TAG, "Got null recipient when deleting conversation - aborting.");
|
||||||
Log.w("[ACL]", "When deleting conversation, recipient is: ${recipient.name}")
|
return
|
||||||
|
}
|
||||||
|
|
||||||
when {
|
when {
|
||||||
// Note: We don't do anything if the thread is a 1-on-1 and the recipient is a contact
|
// Note: We don't do anything if the thread is a 1-on-1 and the recipient is a contact
|
||||||
|
@ -63,6 +63,7 @@ import java.util.HashMap;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class ThreadDatabase extends Database {
|
public class ThreadDatabase extends Database {
|
||||||
|
|
||||||
@ -187,8 +188,6 @@ public class ThreadDatabase extends Database {
|
|||||||
notifyConversationListListeners();
|
notifyConversationListListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ACL remove unused method
|
|
||||||
/*
|
|
||||||
public void updateSnippet(long threadId, String snippet, @Nullable Uri attachment, long date, long type, boolean unarchive) {
|
public void updateSnippet(long threadId, String snippet, @Nullable Uri attachment, long date, long type, boolean unarchive) {
|
||||||
ContentValues contentValues = new ContentValues(4);
|
ContentValues contentValues = new ContentValues(4);
|
||||||
|
|
||||||
@ -207,7 +206,6 @@ public class ThreadDatabase extends Database {
|
|||||||
db.update(TABLE_NAME, contentValues, ID + " = ?", new String[] {threadId + ""});
|
db.update(TABLE_NAME, contentValues, ID + " = ?", new String[] {threadId + ""});
|
||||||
notifyConversationListListeners();
|
notifyConversationListListeners();
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
private void deleteThread(long threadId) {
|
private void deleteThread(long threadId) {
|
||||||
Recipient recipient = getRecipientForThreadId(threadId);
|
Recipient recipient = getRecipientForThreadId(threadId);
|
||||||
@ -220,15 +218,11 @@ public class ThreadDatabase extends Database {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ACL remove unused methods
|
|
||||||
/*
|
|
||||||
private void deleteThreads(Set<Long> threadIds) {
|
private void deleteThreads(Set<Long> threadIds) {
|
||||||
SQLiteDatabase db = databaseHelper.getWritableDatabase();
|
SQLiteDatabase db = databaseHelper.getWritableDatabase();
|
||||||
String where = "";
|
String where = "";
|
||||||
|
|
||||||
for (long threadId : threadIds) {
|
for (long threadId : threadIds) { where += ID + " = '" + threadId + "' OR "; }
|
||||||
where += ID + " = '" + threadId + "' OR ";
|
|
||||||
}
|
|
||||||
|
|
||||||
where = where.substring(0, where.length() - 4);
|
where = where.substring(0, where.length() - 4);
|
||||||
|
|
||||||
@ -245,7 +239,6 @@ public class ThreadDatabase extends Database {
|
|||||||
addressCache.clear();
|
addressCache.clear();
|
||||||
notifyConversationListListeners();
|
notifyConversationListListeners();
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
public void trimAllThreads(int length, ProgressListener listener) {
|
public void trimAllThreads(int length, ProgressListener listener) {
|
||||||
Cursor cursor = null;
|
Cursor cursor = null;
|
||||||
@ -353,17 +346,14 @@ public class ThreadDatabase extends Database {
|
|||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
// ACL remove unused method
|
|
||||||
/*
|
|
||||||
public void setDistributionType(long threadId, int distributionType) {
|
public void setDistributionType(long threadId, int distributionType) {
|
||||||
ContentValues contentValues = new ContentValues(1);
|
ContentValues contentValues = new ContentValues(1);
|
||||||
contentValues.put(CONVERSATION_TYPE, distributionType);
|
contentValues.put(DISTRIBUTION_TYPE, distributionType);
|
||||||
|
|
||||||
SQLiteDatabase db = databaseHelper.getWritableDatabase();
|
SQLiteDatabase db = databaseHelper.getWritableDatabase();
|
||||||
db.update(TABLE_NAME, contentValues, ID_WHERE, new String[] {threadId + ""});
|
db.update(TABLE_NAME, contentValues, ID_WHERE, new String[] {threadId + ""});
|
||||||
notifyConversationListListeners();
|
notifyConversationListListeners();
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
public void setDate(long threadId, long date) {
|
public void setDate(long threadId, long date) {
|
||||||
ContentValues contentValues = new ContentValues(1);
|
ContentValues contentValues = new ContentValues(1);
|
||||||
@ -622,9 +612,6 @@ public class ThreadDatabase extends Database {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void deleteConversation(long threadId) {
|
public void deleteConversation(long threadId) {
|
||||||
|
|
||||||
Log.w("[ACL]", "Hit ThreadDatabase.deleteConversation");
|
|
||||||
|
|
||||||
DatabaseComponent.get(context).smsDatabase().deleteThread(threadId);
|
DatabaseComponent.get(context).smsDatabase().deleteThread(threadId);
|
||||||
DatabaseComponent.get(context).mmsDatabase().deleteThread(threadId);
|
DatabaseComponent.get(context).mmsDatabase().deleteThread(threadId);
|
||||||
DatabaseComponent.get(context).draftDatabase().clearDrafts(threadId);
|
DatabaseComponent.get(context).draftDatabase().clearDrafts(threadId);
|
||||||
@ -736,9 +723,6 @@ public class ThreadDatabase extends Database {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean update(long threadId, boolean unarchive, boolean shouldDeleteOnEmpty) {
|
public boolean update(long threadId, boolean unarchive, boolean shouldDeleteOnEmpty) {
|
||||||
|
|
||||||
Log.w("[ACL]", "Hit ThreadDatabase.update!");
|
|
||||||
|
|
||||||
MmsSmsDatabase mmsSmsDatabase = DatabaseComponent.get(context).mmsSmsDatabase();
|
MmsSmsDatabase mmsSmsDatabase = DatabaseComponent.get(context).mmsSmsDatabase();
|
||||||
long count = mmsSmsDatabase.getConversationCount(threadId);
|
long count = mmsSmsDatabase.getConversationCount(threadId);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user