diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index d734317703..d508694ca2 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -291,7 +291,7 @@ android:exported="true" android:theme="@style/Theme.Session.DayNight.NoActionBar" /> diff --git a/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java b/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java index fdf2e5f60a..9dab6f1367 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java +++ b/app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java @@ -60,9 +60,9 @@ import org.thoughtcrime.securesms.logging.PersistentLogger; import org.thoughtcrime.securesms.logging.UncaughtExceptionLogger; import org.thoughtcrime.securesms.home.HomeActivity; import org.thoughtcrime.securesms.loki.api.BackgroundPollWorker; -import org.thoughtcrime.securesms.loki.api.LokiPushNotificationManager; -import org.thoughtcrime.securesms.loki.api.OpenGroupManager; -import org.thoughtcrime.securesms.loki.database.LokiAPIDatabase; +import org.thoughtcrime.securesms.notifications.LokiPushNotificationManager; +import org.thoughtcrime.securesms.groups.OpenGroupManager; +import org.thoughtcrime.securesms.database.LokiAPIDatabase; import org.thoughtcrime.securesms.util.Broadcaster; import org.thoughtcrime.securesms.notifications.FcmUtils; import org.thoughtcrime.securesms.util.UiModeUtilities; diff --git a/app/src/main/java/org/thoughtcrime/securesms/ShareActivity.java b/app/src/main/java/org/thoughtcrime/securesms/ShareActivity.java index ba7e145bf4..d92ff18d0a 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ShareActivity.java +++ b/app/src/main/java/org/thoughtcrime/securesms/ShareActivity.java @@ -42,9 +42,8 @@ import org.session.libsession.utilities.Address; import org.thoughtcrime.securesms.conversation.v2.ConversationActivityV2; import org.thoughtcrime.securesms.database.DatabaseFactory; import org.session.libsignal.utilities.Log; -import org.thoughtcrime.securesms.loki.fragments.ContactSelectionListFragment; -import org.thoughtcrime.securesms.loki.fragments.ContactSelectionListLoader.DisplayMode; -import org.thoughtcrime.securesms.mediasend.Media; +import org.thoughtcrime.securesms.contacts.ContactSelectionListFragment; +import org.thoughtcrime.securesms.contacts.ContactSelectionListLoader.DisplayMode; import org.thoughtcrime.securesms.mms.PartAuthority; import org.thoughtcrime.securesms.providers.BlobProvider; import org.session.libsession.utilities.recipients.Recipient; @@ -54,7 +53,6 @@ import org.session.libsession.utilities.ViewUtil; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.util.ArrayList; import network.loki.messenger.R; diff --git a/app/src/main/java/org/thoughtcrime/securesms/backup/FullBackupExporter.kt b/app/src/main/java/org/thoughtcrime/securesms/backup/FullBackupExporter.kt index 25c902800e..3ea5d8e400 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/backup/FullBackupExporter.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/backup/FullBackupExporter.kt @@ -21,8 +21,7 @@ import org.thoughtcrime.securesms.crypto.ClassicDecryptingPartInputStream import org.thoughtcrime.securesms.crypto.ModernDecryptingPartInputStream import org.thoughtcrime.securesms.database.* import org.session.libsignal.utilities.Log -import org.thoughtcrime.securesms.loki.database.LokiAPIDatabase -import org.thoughtcrime.securesms.loki.database.LokiBackupFilesDatabase +import org.thoughtcrime.securesms.database.LokiBackupFilesDatabase import org.thoughtcrime.securesms.util.BackupUtil import org.session.libsession.utilities.Util import org.session.libsignal.crypto.kdf.HKDFv3 diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/QuoteView.java b/app/src/main/java/org/thoughtcrime/securesms/components/QuoteView.java index 2d1db4fb7d..5e8c9a99c5 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/QuoteView.java +++ b/app/src/main/java/org/thoughtcrime/securesms/components/QuoteView.java @@ -22,7 +22,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy; import org.session.libsession.messaging.contacts.Contact; import org.session.libsession.messaging.sending_receiving.attachments.Attachment; import org.thoughtcrime.securesms.database.DatabaseFactory; -import org.thoughtcrime.securesms.loki.database.SessionContactDatabase; +import org.thoughtcrime.securesms.database.SessionContactDatabase; import org.thoughtcrime.securesms.util.UiModeUtilities; import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader.DecryptableUri; import org.thoughtcrime.securesms.mms.GlideRequests; diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/fragments/ContactSelectionListAdapter.kt b/app/src/main/java/org/thoughtcrime/securesms/contacts/ContactSelectionListAdapter.kt similarity index 98% rename from app/src/main/java/org/thoughtcrime/securesms/loki/fragments/ContactSelectionListAdapter.kt rename to app/src/main/java/org/thoughtcrime/securesms/contacts/ContactSelectionListAdapter.kt index 043ba1207f..73be89270a 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/fragments/ContactSelectionListAdapter.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/contacts/ContactSelectionListAdapter.kt @@ -1,4 +1,4 @@ -package org.thoughtcrime.securesms.loki.fragments +package org.thoughtcrime.securesms.contacts import android.content.Context import androidx.recyclerview.widget.RecyclerView diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/fragments/ContactSelectionListFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/contacts/ContactSelectionListFragment.kt similarity index 94% rename from app/src/main/java/org/thoughtcrime/securesms/loki/fragments/ContactSelectionListFragment.kt rename to app/src/main/java/org/thoughtcrime/securesms/contacts/ContactSelectionListFragment.kt index 8a68d4e3b8..b32e5a20b8 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/fragments/ContactSelectionListFragment.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/contacts/ContactSelectionListFragment.kt @@ -1,4 +1,4 @@ -package org.thoughtcrime.securesms.loki.fragments +package org.thoughtcrime.securesms.contacts import android.os.Bundle import androidx.fragment.app.Fragment @@ -11,10 +11,11 @@ import android.view.View import android.view.ViewGroup import kotlinx.android.synthetic.main.contact_selection_list_fragment.* import network.loki.messenger.R -import org.thoughtcrime.securesms.contacts.ContactsCursorLoader import org.session.libsignal.utilities.Log import org.thoughtcrime.securesms.mms.GlideApp import org.session.libsession.utilities.recipients.Recipient +import org.thoughtcrime.securesms.contacts.ContactSelectionListItem +import org.thoughtcrime.securesms.contacts.ContactSelectionListLoader class ContactSelectionListFragment : Fragment(), LoaderManager.LoaderCallbacks>, ContactClickListener { private var cursorFilter: String? = null @@ -98,7 +99,7 @@ class ContactSelectionListFragment : Fragment(), LoaderManager.LoaderCallbacks) { + private fun update(items: List) { if (activity?.isDestroyed == true) { Log.e(ContactSelectionListFragment::class.java.name, "Received a loader callback after the fragment was detached from the activity.", diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/fragments/ContactSelectionListLoader.kt b/app/src/main/java/org/thoughtcrime/securesms/contacts/ContactSelectionListLoader.kt similarity index 98% rename from app/src/main/java/org/thoughtcrime/securesms/loki/fragments/ContactSelectionListLoader.kt rename to app/src/main/java/org/thoughtcrime/securesms/contacts/ContactSelectionListLoader.kt index ab9c866654..3a2b2cbb5c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/fragments/ContactSelectionListLoader.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/contacts/ContactSelectionListLoader.kt @@ -1,4 +1,4 @@ -package org.thoughtcrime.securesms.loki.fragments +package org.thoughtcrime.securesms.contacts import android.content.Context import network.loki.messenger.R diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/dialogs/JoinOpenGroupDialog.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/dialogs/JoinOpenGroupDialog.kt index fba97ed406..0d4c30508f 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/dialogs/JoinOpenGroupDialog.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/dialogs/JoinOpenGroupDialog.kt @@ -12,7 +12,7 @@ import network.loki.messenger.R import org.session.libsession.utilities.OpenGroupUrlParser import org.session.libsignal.utilities.ThreadUtils import org.thoughtcrime.securesms.conversation.v2.utilities.BaseDialog -import org.thoughtcrime.securesms.loki.api.OpenGroupManager +import org.thoughtcrime.securesms.groups.OpenGroupManager import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities /** Shown upon tapping an open group invitation. */ diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/database/BackupFileRecord.kt b/app/src/main/java/org/thoughtcrime/securesms/database/BackupFileRecord.kt similarity index 88% rename from app/src/main/java/org/thoughtcrime/securesms/loki/database/BackupFileRecord.kt rename to app/src/main/java/org/thoughtcrime/securesms/database/BackupFileRecord.kt index 0d3fc63bcf..7a78a09892 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/database/BackupFileRecord.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/database/BackupFileRecord.kt @@ -1,4 +1,4 @@ -package org.thoughtcrime.securesms.loki.database +package org.thoughtcrime.securesms.database import android.net.Uri import java.util.* diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/DatabaseFactory.java b/app/src/main/java/org/thoughtcrime/securesms/database/DatabaseFactory.java index 9a87fa8730..211223fd41 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/DatabaseFactory.java +++ b/app/src/main/java/org/thoughtcrime/securesms/database/DatabaseFactory.java @@ -25,13 +25,8 @@ import org.thoughtcrime.securesms.crypto.AttachmentSecretProvider; import org.thoughtcrime.securesms.crypto.DatabaseSecret; import org.thoughtcrime.securesms.crypto.DatabaseSecretProvider; import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper; -import org.thoughtcrime.securesms.loki.database.LokiAPIDatabase; -import org.thoughtcrime.securesms.loki.database.LokiBackupFilesDatabase; -import org.thoughtcrime.securesms.loki.database.LokiMessageDatabase; -import org.thoughtcrime.securesms.loki.database.LokiThreadDatabase; -import org.thoughtcrime.securesms.loki.database.LokiUserDatabase; -import org.thoughtcrime.securesms.loki.database.SessionJobDatabase; -import org.thoughtcrime.securesms.loki.database.SessionContactDatabase; +import org.thoughtcrime.securesms.database.LokiAPIDatabase; +import org.thoughtcrime.securesms.database.SessionJobDatabase; public class DatabaseFactory { diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/database/LokiAPIDatabase.kt b/app/src/main/java/org/thoughtcrime/securesms/database/LokiAPIDatabase.kt similarity index 99% rename from app/src/main/java/org/thoughtcrime/securesms/loki/database/LokiAPIDatabase.kt rename to app/src/main/java/org/thoughtcrime/securesms/database/LokiAPIDatabase.kt index 8d65c7e328..ab0e0ba0f7 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/database/LokiAPIDatabase.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/database/LokiAPIDatabase.kt @@ -1,4 +1,4 @@ -package org.thoughtcrime.securesms.loki.database +package org.thoughtcrime.securesms.database import android.content.ContentValues import android.content.Context diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/database/LokiBackupFilesDatabase.kt b/app/src/main/java/org/thoughtcrime/securesms/database/LokiBackupFilesDatabase.kt similarity index 97% rename from app/src/main/java/org/thoughtcrime/securesms/loki/database/LokiBackupFilesDatabase.kt rename to app/src/main/java/org/thoughtcrime/securesms/database/LokiBackupFilesDatabase.kt index fd92fe4bf1..03e964de71 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/database/LokiBackupFilesDatabase.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/database/LokiBackupFilesDatabase.kt @@ -1,10 +1,9 @@ -package org.thoughtcrime.securesms.loki.database +package org.thoughtcrime.securesms.database import android.content.ContentValues import android.content.Context import android.database.Cursor import android.net.Uri -import org.thoughtcrime.securesms.database.Database import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper import java.lang.IllegalArgumentException import java.util.* diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/database/LokiMessageDatabase.kt b/app/src/main/java/org/thoughtcrime/securesms/database/LokiMessageDatabase.kt similarity index 89% rename from app/src/main/java/org/thoughtcrime/securesms/loki/database/LokiMessageDatabase.kt rename to app/src/main/java/org/thoughtcrime/securesms/database/LokiMessageDatabase.kt index 4c829dcad1..c36c197cbb 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/database/LokiMessageDatabase.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/database/LokiMessageDatabase.kt @@ -1,13 +1,10 @@ -package org.thoughtcrime.securesms.loki.database +package org.thoughtcrime.securesms.database import android.content.ContentValues import android.content.Context import net.sqlcipher.database.SQLiteDatabase.CONFLICT_REPLACE import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper -import org.thoughtcrime.securesms.util.* import org.session.libsignal.database.LokiMessageDatabaseProtocol -import org.session.libsignal.utilities.Log -import org.thoughtcrime.securesms.database.* class LokiMessageDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(context, helper), LokiMessageDatabaseProtocol { @@ -62,9 +59,9 @@ class LokiMessageDatabase(context: Context, helper: SQLCipherOpenHelper) : Datab val database = databaseHelper.writableDatabase val serverID = database.get(messageIDTable, - "${Companion.messageID} = ? AND ${Companion.messageType} = ?", + "${Companion.messageID} = ? AND $messageType = ?", arrayOf(messageID.toString(), (if (isSms) SMS_TYPE else MMS_TYPE).toString())) { cursor -> - cursor.getInt(Companion.serverID).toLong() + cursor.getInt(serverID).toLong() } ?: return database.beginTransaction() @@ -88,7 +85,7 @@ class LokiMessageDatabase(context: Context, helper: SQLCipherOpenHelper) : Datab return database.get(messageIDTable, "$messageID = ? AND ${Companion.serverID} = ?", arrayOf(mappedID.toString(), mappedServerID.toString())) { cursor -> - cursor.getInt(Companion.messageID).toLong() to (cursor.getInt(messageType) == SMS_TYPE) + cursor.getInt(messageID).toLong() to (cursor.getInt(messageType) == SMS_TYPE) } } @@ -136,18 +133,18 @@ class LokiMessageDatabase(context: Context, helper: SQLCipherOpenHelper) : Datab val database = databaseHelper.writableDatabase try { val messages = mutableSetOf>() - database.get(messageThreadMappingTable, "${Companion.threadID} = ?", arrayOf(threadId.toString())) { cursor -> + database.get(messageThreadMappingTable, "$threadID = ?", arrayOf(threadId.toString())) { cursor -> // for each add while (cursor.moveToNext()) { - messages.add(cursor.getLong(Companion.messageID) to cursor.getLong(Companion.serverID)) + messages.add(cursor.getLong(messageID) to cursor.getLong(serverID)) } } var deletedCount = 0L database.beginTransaction() messages.forEach { (messageId, serverId) -> - deletedCount += database.delete(messageIDTable, "${Companion.messageID} = ? AND ${Companion.serverID} = ?", arrayOf(messageId.toString(), serverId.toString())) + deletedCount += database.delete(messageIDTable, "$messageID = ? AND $serverID = ?", arrayOf(messageId.toString(), serverId.toString())) } - val mappingDeleted = database.delete(messageThreadMappingTable, "${Companion.threadID} = ?", arrayOf(threadId.toString())) + val mappingDeleted = database.delete(messageThreadMappingTable, "$threadID = ?", arrayOf(threadId.toString())) database.setTransactionSuccessful() } finally { database.endTransaction() diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/database/LokiThreadDatabase.kt b/app/src/main/java/org/thoughtcrime/securesms/database/LokiThreadDatabase.kt similarity index 94% rename from app/src/main/java/org/thoughtcrime/securesms/loki/database/LokiThreadDatabase.kt rename to app/src/main/java/org/thoughtcrime/securesms/database/LokiThreadDatabase.kt index 82e5a236fd..0b45875bd6 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/database/LokiThreadDatabase.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/database/LokiThreadDatabase.kt @@ -1,16 +1,13 @@ -package org.thoughtcrime.securesms.loki.database +package org.thoughtcrime.securesms.database import android.content.ContentValues import android.content.Context import android.database.Cursor import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper -import org.thoughtcrime.securesms.util.* import org.session.libsession.messaging.open_groups.OpenGroupV2 import org.session.libsession.utilities.Address import org.session.libsession.utilities.recipients.Recipient import org.session.libsignal.utilities.JsonUtil -import org.thoughtcrime.securesms.database.* -import org.thoughtcrime.securesms.database.getString class LokiThreadDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(context, helper) { diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/database/LokiUserDatabase.kt b/app/src/main/java/org/thoughtcrime/securesms/database/LokiUserDatabase.kt similarity index 92% rename from app/src/main/java/org/thoughtcrime/securesms/loki/database/LokiUserDatabase.kt rename to app/src/main/java/org/thoughtcrime/securesms/database/LokiUserDatabase.kt index 5a7c3cf64e..4a5468c5d4 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/database/LokiUserDatabase.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/database/LokiUserDatabase.kt @@ -1,10 +1,8 @@ -package org.thoughtcrime.securesms.loki.database +package org.thoughtcrime.securesms.database import android.content.Context -import org.thoughtcrime.securesms.database.Database import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper import org.session.libsession.utilities.TextSecurePreferences -import org.thoughtcrime.securesms.database.get class LokiUserDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(context, helper) { diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/database/SessionContactDatabase.kt b/app/src/main/java/org/thoughtcrime/securesms/database/SessionContactDatabase.kt similarity index 92% rename from app/src/main/java/org/thoughtcrime/securesms/loki/database/SessionContactDatabase.kt rename to app/src/main/java/org/thoughtcrime/securesms/database/SessionContactDatabase.kt index 07c0e37ff7..0c3159ee16 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/database/SessionContactDatabase.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/database/SessionContactDatabase.kt @@ -1,13 +1,11 @@ -package org.thoughtcrime.securesms.loki.database +package org.thoughtcrime.securesms.database import android.content.ContentValues import android.content.Context import net.sqlcipher.Cursor import org.session.libsession.messaging.contacts.Contact import org.session.libsignal.utilities.Base64 -import org.thoughtcrime.securesms.database.* import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper -import org.thoughtcrime.securesms.util.* class SessionContactDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(context, helper) { @@ -35,7 +33,7 @@ class SessionContactDatabase(context: Context, helper: SQLCipherOpenHelper) : Da fun getContactWithSessionID(sessionID: String): Contact? { val database = databaseHelper.readableDatabase - return database.get(sessionContactTable, "${SessionContactDatabase.sessionID} = ?", arrayOf( sessionID )) { cursor -> + return database.get(sessionContactTable, "${Companion.sessionID} = ?", arrayOf( sessionID )) { cursor -> contactFromCursor(cursor) } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/database/SessionJobDatabase.kt b/app/src/main/java/org/thoughtcrime/securesms/database/SessionJobDatabase.kt similarity index 99% rename from app/src/main/java/org/thoughtcrime/securesms/loki/database/SessionJobDatabase.kt rename to app/src/main/java/org/thoughtcrime/securesms/database/SessionJobDatabase.kt index fd4940b197..49729241a5 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/database/SessionJobDatabase.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/database/SessionJobDatabase.kt @@ -1,4 +1,4 @@ -package org.thoughtcrime.securesms.loki.database +package org.thoughtcrime.securesms.database import android.content.ContentValues import android.content.Context diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt b/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt index 14448eb4d1..552b631089 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/database/Storage.kt @@ -29,8 +29,7 @@ import org.thoughtcrime.securesms.ApplicationContext import org.thoughtcrime.securesms.crypto.IdentityKeyUtil import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper import org.thoughtcrime.securesms.jobs.RetrieveProfileAvatarJob -import org.thoughtcrime.securesms.loki.api.OpenGroupManager -import org.thoughtcrime.securesms.loki.database.LokiThreadDatabase +import org.thoughtcrime.securesms.groups.OpenGroupManager import org.thoughtcrime.securesms.loki.protocol.SessionMetaProtocol import org.thoughtcrime.securesms.mms.PartAuthority diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/helpers/SQLCipherOpenHelper.java b/app/src/main/java/org/thoughtcrime/securesms/database/helpers/SQLCipherOpenHelper.java index 11f85cabf4..8c0763d233 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/helpers/SQLCipherOpenHelper.java +++ b/app/src/main/java/org/thoughtcrime/securesms/database/helpers/SQLCipherOpenHelper.java @@ -23,13 +23,13 @@ import org.thoughtcrime.securesms.database.SearchDatabase; import org.thoughtcrime.securesms.database.SmsDatabase; import org.thoughtcrime.securesms.database.ThreadDatabase; import org.session.libsignal.utilities.Log; -import org.thoughtcrime.securesms.loki.database.LokiAPIDatabase; -import org.thoughtcrime.securesms.loki.database.LokiBackupFilesDatabase; -import org.thoughtcrime.securesms.loki.database.LokiMessageDatabase; -import org.thoughtcrime.securesms.loki.database.LokiThreadDatabase; -import org.thoughtcrime.securesms.loki.database.LokiUserDatabase; -import org.thoughtcrime.securesms.loki.database.SessionContactDatabase; -import org.thoughtcrime.securesms.loki.database.SessionJobDatabase; +import org.thoughtcrime.securesms.database.LokiAPIDatabase; +import org.thoughtcrime.securesms.database.LokiBackupFilesDatabase; +import org.thoughtcrime.securesms.database.LokiMessageDatabase; +import org.thoughtcrime.securesms.database.LokiThreadDatabase; +import org.thoughtcrime.securesms.database.LokiUserDatabase; +import org.thoughtcrime.securesms.database.SessionContactDatabase; +import org.thoughtcrime.securesms.database.SessionJobDatabase; public class SQLCipherOpenHelper extends SQLiteOpenHelper { diff --git a/app/src/main/java/org/thoughtcrime/securesms/groups/JoinPublicChatActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/groups/JoinPublicChatActivity.kt index 562497c2ca..6a8a98b606 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/groups/JoinPublicChatActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/groups/JoinPublicChatActivity.kt @@ -34,7 +34,7 @@ import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity import org.thoughtcrime.securesms.conversation.v2.ConversationActivityV2 import org.thoughtcrime.securesms.groups.DefaultGroupsViewModel import org.thoughtcrime.securesms.groups.GroupManager -import org.thoughtcrime.securesms.loki.api.OpenGroupManager +import org.thoughtcrime.securesms.groups.OpenGroupManager import org.thoughtcrime.securesms.loki.fragments.ScanQRCodeWrapperFragment import org.thoughtcrime.securesms.loki.fragments.ScanQRCodeWrapperFragmentDelegate import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/api/OpenGroupManager.kt b/app/src/main/java/org/thoughtcrime/securesms/groups/OpenGroupManager.kt similarity index 98% rename from app/src/main/java/org/thoughtcrime/securesms/loki/api/OpenGroupManager.kt rename to app/src/main/java/org/thoughtcrime/securesms/groups/OpenGroupManager.kt index 72afe11c6e..f25e238b0c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/api/OpenGroupManager.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/groups/OpenGroupManager.kt @@ -1,4 +1,4 @@ -package org.thoughtcrime.securesms.loki.api +package org.thoughtcrime.securesms.groups import android.content.Context import android.graphics.Bitmap @@ -11,7 +11,6 @@ import org.session.libsession.messaging.sending_receiving.pollers.OpenGroupPolle import org.session.libsession.utilities.Util import org.session.libsignal.utilities.ThreadUtils import org.thoughtcrime.securesms.database.DatabaseFactory -import org.thoughtcrime.securesms.groups.GroupManager import org.thoughtcrime.securesms.util.BitmapUtil import java.util.concurrent.Executors diff --git a/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt index 7b79e0ece1..e804e439c7 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt @@ -42,7 +42,7 @@ import org.thoughtcrime.securesms.database.DatabaseFactory import org.thoughtcrime.securesms.database.model.ThreadRecord import org.thoughtcrime.securesms.groups.CreateClosedGroupActivity import org.thoughtcrime.securesms.loki.activities.* -import org.thoughtcrime.securesms.loki.api.OpenGroupManager +import org.thoughtcrime.securesms.groups.OpenGroupManager import org.thoughtcrime.securesms.loki.dialogs.* import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities import org.thoughtcrime.securesms.util.* diff --git a/app/src/main/java/org/thoughtcrime/securesms/jobs/JobManagerFactories.java b/app/src/main/java/org/thoughtcrime/securesms/jobs/JobManagerFactories.java index 0a078fc017..028eb0b421 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/jobs/JobManagerFactories.java +++ b/app/src/main/java/org/thoughtcrime/securesms/jobs/JobManagerFactories.java @@ -14,7 +14,6 @@ import org.thoughtcrime.securesms.jobmanager.impl.NetworkConstraintObserver; import org.thoughtcrime.securesms.jobmanager.impl.NetworkOrCellServiceConstraint; import org.thoughtcrime.securesms.jobmanager.impl.SqlCipherMigrationConstraint; import org.thoughtcrime.securesms.jobmanager.impl.SqlCipherMigrationConstraintObserver; -import org.thoughtcrime.securesms.loki.api.PrepareAttachmentAudioExtrasJob; import java.util.ArrayList; import java.util.Arrays; diff --git a/app/src/main/java/org/thoughtcrime/securesms/jobs/LocalBackupJob.java b/app/src/main/java/org/thoughtcrime/securesms/jobs/LocalBackupJob.java index 147db87ce5..e5715db263 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/jobs/LocalBackupJob.java +++ b/app/src/main/java/org/thoughtcrime/securesms/jobs/LocalBackupJob.java @@ -6,7 +6,7 @@ import org.session.libsession.messaging.utilities.Data; import org.session.libsignal.utilities.NoExternalStorageException; import org.thoughtcrime.securesms.jobmanager.Job; import org.session.libsignal.utilities.Log; -import org.thoughtcrime.securesms.loki.database.BackupFileRecord; +import org.thoughtcrime.securesms.database.BackupFileRecord; import org.thoughtcrime.securesms.notifications.NotificationChannels; import org.thoughtcrime.securesms.service.GenericForegroundService; import org.thoughtcrime.securesms.util.BackupUtil; diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/api/PrepareAttachmentAudioExtrasJob.kt b/app/src/main/java/org/thoughtcrime/securesms/jobs/PrepareAttachmentAudioExtrasJob.kt similarity index 96% rename from app/src/main/java/org/thoughtcrime/securesms/loki/api/PrepareAttachmentAudioExtrasJob.kt rename to app/src/main/java/org/thoughtcrime/securesms/jobs/PrepareAttachmentAudioExtrasJob.kt index fa92ba3d29..017c335712 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/api/PrepareAttachmentAudioExtrasJob.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/jobs/PrepareAttachmentAudioExtrasJob.kt @@ -1,9 +1,7 @@ -package org.thoughtcrime.securesms.loki.api +package org.thoughtcrime.securesms.jobs -import android.media.MediaDataSource import android.os.Build import org.session.libsignal.utilities.Log -import androidx.annotation.RequiresApi import org.greenrobot.eventbus.EventBus import org.session.libsession.messaging.utilities.Data import org.session.libsession.messaging.sending_receiving.attachments.Attachment @@ -13,9 +11,7 @@ import org.session.libsession.utilities.DecodedAudio import org.session.libsession.utilities.InputStreamMediaDataSource import org.thoughtcrime.securesms.database.DatabaseFactory import org.thoughtcrime.securesms.jobmanager.Job -import org.thoughtcrime.securesms.jobs.BaseJob import org.thoughtcrime.securesms.mms.PartAuthority -import java.io.InputStream import java.lang.IllegalStateException import java.util.* import java.util.concurrent.TimeUnit diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/api/PublicChatInfoUpdateWorker.kt b/app/src/main/java/org/thoughtcrime/securesms/loki/api/PublicChatInfoUpdateWorker.kt deleted file mode 100644 index 236f450b26..0000000000 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/api/PublicChatInfoUpdateWorker.kt +++ /dev/null @@ -1,71 +0,0 @@ -package org.thoughtcrime.securesms.loki.api - -import android.content.Context -import androidx.work.* -import org.session.libsignal.utilities.Log -import org.thoughtcrime.securesms.groups.OpenGroupUtilities - -/** - * Delegates the [OpenGroupUtilities.updateGroupInfo] call to the work manager. - */ -class PublicChatInfoUpdateWorker(val context: Context, params: WorkerParameters) : Worker(context, params) { - - companion object { - const val TAG = "PublicChatInfoUpdateWorker" - - private const val DATA_KEY_SERVER_URL = "server_uRL" - private const val DATA_KEY_CHANNEL = "channel" - private const val DATA_KEY_ROOM = "room" - - @JvmStatic - fun scheduleInstant(context: Context, serverUrl: String, room :String) { - val workRequest = OneTimeWorkRequestBuilder() - .setConstraints(Constraints.Builder() - .setRequiredNetworkType(NetworkType.CONNECTED) - .build() - ) - .setInputData(workDataOf( - DATA_KEY_SERVER_URL to serverUrl, - DATA_KEY_ROOM to room - )) - .build() - - WorkManager - .getInstance(context) - .enqueue(workRequest) - } - - @JvmStatic - fun scheduleInstant(context: Context, serverURL: String, channel: Long) { - val workRequest = OneTimeWorkRequestBuilder() - .setConstraints(Constraints.Builder() - .setRequiredNetworkType(NetworkType.CONNECTED) - .build() - ) - .setInputData(workDataOf( - DATA_KEY_SERVER_URL to serverURL, - DATA_KEY_CHANNEL to channel - )) - .build() - - WorkManager - .getInstance(context) - .enqueue(workRequest) - } - } - - override fun doWork(): Result { - val serverUrl = inputData.getString(DATA_KEY_SERVER_URL)!! - val room = inputData.getString(DATA_KEY_ROOM) - val openGroupId = "$serverUrl.$room" - return try { - Log.v(TAG, "Updating open group info for $openGroupId.") - OpenGroupUtilities.updateGroupInfo(context, serverUrl, room!!) - Log.v(TAG, "Open group info was successfully updated for $openGroupId.") - Result.success() - } catch (e: Exception) { - Log.e(TAG, "Failed to update open group info for $openGroupId", e) - Result.failure() - } - } -} diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/api/LokiPushNotificationManager.kt b/app/src/main/java/org/thoughtcrime/securesms/notifications/LokiPushNotificationManager.kt similarity index 99% rename from app/src/main/java/org/thoughtcrime/securesms/loki/api/LokiPushNotificationManager.kt rename to app/src/main/java/org/thoughtcrime/securesms/notifications/LokiPushNotificationManager.kt index 05c6c768f4..64e67b4b68 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/api/LokiPushNotificationManager.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/notifications/LokiPushNotificationManager.kt @@ -1,4 +1,4 @@ -package org.thoughtcrime.securesms.loki.api +package org.thoughtcrime.securesms.notifications import android.content.Context import nl.komponents.kovenant.functional.map diff --git a/app/src/main/java/org/thoughtcrime/securesms/notifications/MultipleRecipientNotificationBuilder.java b/app/src/main/java/org/thoughtcrime/securesms/notifications/MultipleRecipientNotificationBuilder.java index 4c4f96b25e..24374ddd0f 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/notifications/MultipleRecipientNotificationBuilder.java +++ b/app/src/main/java/org/thoughtcrime/securesms/notifications/MultipleRecipientNotificationBuilder.java @@ -17,7 +17,7 @@ import org.session.libsession.utilities.Util; import org.session.libsession.utilities.recipients.Recipient; import org.thoughtcrime.securesms.database.DatabaseFactory; import org.thoughtcrime.securesms.home.HomeActivity; -import org.thoughtcrime.securesms.loki.database.SessionContactDatabase; +import org.thoughtcrime.securesms.database.SessionContactDatabase; import java.util.LinkedList; import java.util.List; diff --git a/app/src/main/java/org/thoughtcrime/securesms/notifications/OptimizedMessageNotifier.java b/app/src/main/java/org/thoughtcrime/securesms/notifications/OptimizedMessageNotifier.java index aac737add2..4a72d7757c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/notifications/OptimizedMessageNotifier.java +++ b/app/src/main/java/org/thoughtcrime/securesms/notifications/OptimizedMessageNotifier.java @@ -10,10 +10,9 @@ import org.session.libsession.messaging.sending_receiving.notifications.MessageN import org.session.libsession.messaging.sending_receiving.pollers.Poller; import org.session.libsession.utilities.recipients.Recipient; import org.session.libsession.utilities.Debouncer; -import org.session.libsignal.utilities.Log; import org.session.libsignal.utilities.ThreadUtils; import org.thoughtcrime.securesms.ApplicationContext; -import org.thoughtcrime.securesms.loki.api.OpenGroupManager; +import org.thoughtcrime.securesms.groups.OpenGroupManager; import java.util.concurrent.TimeUnit; diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/api/PushNotificationService.kt b/app/src/main/java/org/thoughtcrime/securesms/notifications/PushNotificationService.kt similarity index 95% rename from app/src/main/java/org/thoughtcrime/securesms/loki/api/PushNotificationService.kt rename to app/src/main/java/org/thoughtcrime/securesms/notifications/PushNotificationService.kt index 74f6f25c88..e035bbb7ea 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/api/PushNotificationService.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/notifications/PushNotificationService.kt @@ -1,4 +1,4 @@ -package org.thoughtcrime.securesms.loki.api +package org.thoughtcrime.securesms.notifications import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat @@ -10,7 +10,6 @@ import org.session.libsession.messaging.utilities.MessageWrapper import org.session.libsession.utilities.TextSecurePreferences import org.session.libsignal.utilities.Base64 import org.session.libsignal.utilities.Log -import org.thoughtcrime.securesms.notifications.NotificationChannels class PushNotificationService : FirebaseMessagingService() { diff --git a/app/src/main/java/org/thoughtcrime/securesms/notifications/SingleRecipientNotificationBuilder.java b/app/src/main/java/org/thoughtcrime/securesms/notifications/SingleRecipientNotificationBuilder.java index 3c5c39d607..80dd7d2602 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/notifications/SingleRecipientNotificationBuilder.java +++ b/app/src/main/java/org/thoughtcrime/securesms/notifications/SingleRecipientNotificationBuilder.java @@ -28,7 +28,7 @@ import org.session.libsession.avatars.GeneratedContactPhoto; import org.session.libsession.messaging.contacts.Contact; import org.session.libsignal.utilities.Log; import org.thoughtcrime.securesms.database.DatabaseFactory; -import org.thoughtcrime.securesms.loki.database.SessionContactDatabase; +import org.thoughtcrime.securesms.database.SessionContactDatabase; import org.thoughtcrime.securesms.util.AvatarPlaceholderGenerator; import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader; import org.thoughtcrime.securesms.mms.GlideApp; diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/BackupUtil.kt b/app/src/main/java/org/thoughtcrime/securesms/util/BackupUtil.kt index 5d2e84ed7a..74014bc819 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/util/BackupUtil.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/util/BackupUtil.kt @@ -23,7 +23,7 @@ import org.thoughtcrime.securesms.backup.FullBackupExporter import org.thoughtcrime.securesms.crypto.AttachmentSecretProvider import org.thoughtcrime.securesms.crypto.IdentityKeyUtil import org.thoughtcrime.securesms.database.DatabaseFactory -import org.thoughtcrime.securesms.loki.database.BackupFileRecord +import org.thoughtcrime.securesms.database.BackupFileRecord import org.thoughtcrime.securesms.service.LocalBackupListener import java.io.IOException import java.security.MessageDigest diff --git a/app/src/main/res/layout/share_activity.xml b/app/src/main/res/layout/share_activity.xml index 4d7db2c603..78bb2822aa 100644 --- a/app/src/main/res/layout/share_activity.xml +++ b/app/src/main/res/layout/share_activity.xml @@ -47,7 +47,7 @@ android:layout_below="@id/toolbar" android:layout_width="match_parent" android:layout_height="match_parent" - android:name="org.thoughtcrime.securesms.loki.fragments.ContactSelectionListFragment" /> + android:name="org.thoughtcrime.securesms.contacts.ContactSelectionListFragment" />