From a99407ec6a1509d71362dc3d7bb1d4770251b258 Mon Sep 17 00:00:00 2001 From: 0x330a <92654767+0x330a@users.noreply.github.com> Date: Mon, 7 Aug 2023 11:02:13 +1000 Subject: [PATCH 1/4] refactor: remove checks for whether new config is enabled throughout config factory generation --- .../securesms/dependencies/ConfigFactory.kt | 9 --- .../securesms/home/HomeActivity.kt | 6 +- .../util/ConfigurationMessageUtilities.kt | 58 ++----------------- .../loki/messenger/libsession_util/Config.kt | 6 -- .../messaging/jobs/ConfigurationSyncJob.kt | 8 +-- .../ReceivedMessageHandler.kt | 13 ++--- 6 files changed, 14 insertions(+), 86 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/dependencies/ConfigFactory.kt b/app/src/main/java/org/thoughtcrime/securesms/dependencies/ConfigFactory.kt index d664ffedb..7662be1f3 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/dependencies/ConfigFactory.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/dependencies/ConfigFactory.kt @@ -7,7 +7,6 @@ import network.loki.messenger.libsession_util.Contacts import network.loki.messenger.libsession_util.ConversationVolatileConfig import network.loki.messenger.libsession_util.UserGroupsConfig import network.loki.messenger.libsession_util.UserProfile -import org.session.libsession.snode.SnodeAPI import org.session.libsession.utilities.ConfigFactoryProtocol import org.session.libsession.utilities.ConfigFactoryUpdateListener import org.session.libsession.utilities.TextSecurePreferences @@ -72,7 +71,6 @@ class ConfigFactory( override val user: UserProfile? get() = synchronizedWithLog(userLock) { - if (!ConfigBase.isNewConfigEnabled(isConfigForcedOn, SnodeAPI.nowWithOffset)) return null if (_userConfig == null) { val (secretKey, publicKey) = maybeGetUserInfo() ?: return null val userDump = configDatabase.retrieveConfigAndHashes( @@ -92,7 +90,6 @@ class ConfigFactory( override val contacts: Contacts? get() = synchronizedWithLog(contactsLock) { - if (!ConfigBase.isNewConfigEnabled(isConfigForcedOn, SnodeAPI.nowWithOffset)) return null if (_contacts == null) { val (secretKey, publicKey) = maybeGetUserInfo() ?: return null val contactsDump = configDatabase.retrieveConfigAndHashes( @@ -112,7 +109,6 @@ class ConfigFactory( override val convoVolatile: ConversationVolatileConfig? get() = synchronizedWithLog(convoVolatileLock) { - if (!ConfigBase.isNewConfigEnabled(isConfigForcedOn, SnodeAPI.nowWithOffset)) return null if (_convoVolatileConfig == null) { val (secretKey, publicKey) = maybeGetUserInfo() ?: return null val convoDump = configDatabase.retrieveConfigAndHashes( @@ -133,7 +129,6 @@ class ConfigFactory( override val userGroups: UserGroupsConfig? get() = synchronizedWithLog(userGroupsLock) { - if (!ConfigBase.isNewConfigEnabled(isConfigForcedOn, SnodeAPI.nowWithOffset)) return null if (_userGroups == null) { val (secretKey, publicKey) = maybeGetUserInfo() ?: return null val userGroupsDump = configDatabase.retrieveConfigAndHashes( @@ -207,8 +202,6 @@ class ConfigFactory( openGroupId: String?, visibleOnly: Boolean ): Boolean { - if (!ConfigBase.isNewConfigEnabled(isConfigForcedOn, SnodeAPI.nowWithOffset)) return true - val (_, userPublicKey) = maybeGetUserInfo() ?: return true if (openGroupId != null) { @@ -241,8 +234,6 @@ class ConfigFactory( } override fun canPerformChange(variant: String, publicKey: String, changeTimestampMs: Long): Boolean { - if (!ConfigBase.isNewConfigEnabled(isConfigForcedOn, SnodeAPI.nowWithOffset)) return true - val lastUpdateTimestampMs = configDatabase.retrieveConfigLastUpdateTimestamp(variant, publicKey) // Ensure the change occurred after the last config message was handled (minus the buffer period) 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 72bd098f4..41c6d1cbd 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/home/HomeActivity.kt @@ -30,7 +30,6 @@ import kotlinx.coroutines.withContext import network.loki.messenger.R import network.loki.messenger.databinding.ActivityHomeBinding import network.loki.messenger.databinding.ViewMessageRequestBannerBinding -import network.loki.messenger.libsession_util.ConfigBase import org.greenrobot.eventbus.EventBus import org.greenrobot.eventbus.Subscribe import org.greenrobot.eventbus.ThreadMode @@ -71,8 +70,8 @@ import org.thoughtcrime.securesms.onboarding.SeedActivity import org.thoughtcrime.securesms.onboarding.SeedReminderViewDelegate import org.thoughtcrime.securesms.permissions.Permissions import org.thoughtcrime.securesms.preferences.SettingsActivity -import org.thoughtcrime.securesms.showSessionDialog import org.thoughtcrime.securesms.showMuteDialog +import org.thoughtcrime.securesms.showSessionDialog import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities import org.thoughtcrime.securesms.util.DateUtils import org.thoughtcrime.securesms.util.IP2Country @@ -354,8 +353,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(), } private fun updateLegacyConfigView() { - binding.configOutdatedView.isVisible = ConfigBase.isNewConfigEnabled(textSecurePreferences.hasForcedNewConfig(), SnodeAPI.nowWithOffset) - && textSecurePreferences.getHasLegacyConfig() + binding.configOutdatedView.isVisible = textSecurePreferences.getHasLegacyConfig() } override fun onResume() { diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/ConfigurationMessageUtilities.kt b/app/src/main/java/org/thoughtcrime/securesms/util/ConfigurationMessageUtilities.kt index 297014d86..356632401 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/util/ConfigurationMessageUtilities.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/util/ConfigurationMessageUtilities.kt @@ -17,8 +17,6 @@ import org.session.libsession.messaging.jobs.ConfigurationSyncJob import org.session.libsession.messaging.jobs.JobQueue import org.session.libsession.messaging.messages.Destination import org.session.libsession.messaging.messages.control.ConfigurationMessage -import org.session.libsession.messaging.sending_receiving.MessageSender -import org.session.libsession.snode.SnodeAPI import org.session.libsession.utilities.Address import org.session.libsession.utilities.GroupUtil import org.session.libsession.utilities.TextSecurePreferences @@ -55,61 +53,17 @@ object ConfigurationMessageUtilities { fun syncConfigurationIfNeeded(context: Context) { // add if check here to schedule new config job process and return early val userPublicKey = TextSecurePreferences.getLocalNumber(context) ?: return - val forcedConfig = TextSecurePreferences.hasForcedNewConfig(context) - val currentTime = SnodeAPI.nowWithOffset - if (ConfigBase.isNewConfigEnabled(forcedConfig, currentTime)) { - scheduleConfigSync(userPublicKey) - return - } - val lastSyncTime = TextSecurePreferences.getLastConfigurationSyncTime(context) - val now = System.currentTimeMillis() - if (now - lastSyncTime < 7 * 24 * 60 * 60 * 1000) return - val contacts = ContactUtilities.getAllContacts(context).filter { recipient -> - !recipient.name.isNullOrEmpty() && !recipient.isLocalNumber && recipient.address.serialize().isNotEmpty() - }.map { recipient -> - ConfigurationMessage.Contact( - publicKey = recipient.address.serialize(), - name = recipient.name!!, - profilePicture = recipient.profileAvatar, - profileKey = recipient.profileKey, - isApproved = recipient.isApproved, - isBlocked = recipient.isBlocked, - didApproveMe = recipient.hasApprovedMe() - ) - } - val configurationMessage = ConfigurationMessage.getCurrent(contacts) ?: return - MessageSender.send(configurationMessage, Address.fromSerialized(userPublicKey)) - TextSecurePreferences.setLastConfigurationSyncTime(context, now) + scheduleConfigSync(userPublicKey) + return } fun forceSyncConfigurationNowIfNeeded(context: Context): Promise { // add if check here to schedule new config job process and return early val userPublicKey = TextSecurePreferences.getLocalNumber(context) ?: return Promise.ofFail(NullPointerException("User Public Key is null")) - val forcedConfig = TextSecurePreferences.hasForcedNewConfig(context) - val currentTime = SnodeAPI.nowWithOffset - if (ConfigBase.isNewConfigEnabled(forcedConfig, currentTime)) { - // schedule job if none exist - // don't schedule job if we already have one - scheduleConfigSync(userPublicKey) - return Promise.ofSuccess(Unit) - } - val contacts = ContactUtilities.getAllContacts(context).filter { recipient -> - !recipient.isGroupRecipient && !recipient.name.isNullOrEmpty() && !recipient.isLocalNumber && recipient.address.serialize().isNotEmpty() - }.map { recipient -> - ConfigurationMessage.Contact( - publicKey = recipient.address.serialize(), - name = recipient.name!!, - profilePicture = recipient.profileAvatar, - profileKey = recipient.profileKey, - isApproved = recipient.isApproved, - isBlocked = recipient.isBlocked, - didApproveMe = recipient.hasApprovedMe() - ) - } - val configurationMessage = ConfigurationMessage.getCurrent(contacts) ?: return Promise.ofSuccess(Unit) - val promise = MessageSender.send(configurationMessage, Destination.from(Address.fromSerialized(userPublicKey)), isSyncMessage = true) - TextSecurePreferences.setLastConfigurationSyncTime(context, System.currentTimeMillis()) - return promise + // schedule job if none exist + // don't schedule job if we already have one + scheduleConfigSync(userPublicKey) + return Promise.ofSuccess(Unit) } private fun maybeUserSecretKey() = MessagingModuleConfiguration.shared.getUserED25519KeyPair()?.secretKey?.asBytes diff --git a/libsession-util/src/main/java/network/loki/messenger/libsession_util/Config.kt b/libsession-util/src/main/java/network/loki/messenger/libsession_util/Config.kt index 52fb541d7..b7b631017 100644 --- a/libsession-util/src/main/java/network/loki/messenger/libsession_util/Config.kt +++ b/libsession-util/src/main/java/network/loki/messenger/libsession_util/Config.kt @@ -25,12 +25,6 @@ sealed class ConfigBase(protected val /* yucky */ pointer: Long) { is UserGroupsConfig -> Kind.GROUPS } - // TODO: time in future to activate (hardcoded to 1st jan 2024 for testing, change before release) - private const val ACTIVATE_TIME = 1690761600000 - - fun isNewConfigEnabled(forced: Boolean, currentTime: Long) = - forced || currentTime >= ACTIVATE_TIME - const val PRIORITY_HIDDEN = -1 const val PRIORITY_VISIBLE = 0 const val PRIORITY_PINNED = 1 diff --git a/libsession/src/main/java/org/session/libsession/messaging/jobs/ConfigurationSyncJob.kt b/libsession/src/main/java/org/session/libsession/messaging/jobs/ConfigurationSyncJob.kt index ec8de4416..241853df5 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/jobs/ConfigurationSyncJob.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/jobs/ConfigurationSyncJob.kt @@ -1,6 +1,5 @@ package org.session.libsession.messaging.jobs -import network.loki.messenger.libsession_util.ConfigBase import network.loki.messenger.libsession_util.ConfigBase.Companion.protoKindFor import nl.komponents.kovenant.functional.bind import org.session.libsession.messaging.MessagingModuleConfiguration @@ -10,7 +9,6 @@ import org.session.libsession.messaging.sending_receiving.MessageSender import org.session.libsession.messaging.utilities.Data import org.session.libsession.snode.RawResponse import org.session.libsession.snode.SnodeAPI -import org.session.libsession.utilities.TextSecurePreferences import org.session.libsignal.utilities.Log import java.util.concurrent.atomic.AtomicBoolean @@ -26,14 +24,10 @@ data class ConfigurationSyncJob(val destination: Destination): Job { override suspend fun execute(dispatcherName: String) { val storage = MessagingModuleConfiguration.shared.storage - val forcedConfig = TextSecurePreferences.hasForcedNewConfig(MessagingModuleConfiguration.shared.context) - val currentTime = SnodeAPI.nowWithOffset val userEdKeyPair = MessagingModuleConfiguration.shared.getUserED25519KeyPair() val userPublicKey = storage.getUserPublicKey() val delegate = delegate - if (destination is Destination.ClosedGroup // TODO: closed group configs will be handled in closed group feature - // if we haven't enabled the new configs don't run - || !ConfigBase.isNewConfigEnabled(forcedConfig, currentTime) + if (destination is Destination.ClosedGroup // if we don't have a user ed key pair for signing updates || userEdKeyPair == null // this will be useful to not handle null delegate cases diff --git a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageHandler.kt b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageHandler.kt index 19278aadd..3659bfcdc 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageHandler.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/ReceivedMessageHandler.kt @@ -1,7 +1,6 @@ package org.session.libsession.messaging.sending_receiving import android.text.TextUtils -import network.loki.messenger.libsession_util.ConfigBase import org.session.libsession.avatars.AvatarHelper import org.session.libsession.messaging.MessagingModuleConfiguration import org.session.libsession.messaging.jobs.BackgroundGroupAddJob @@ -181,18 +180,16 @@ private fun handleConfigurationMessage(message: ConfigurationMessage) { TextSecurePreferences.setConfigurationMessageSynced(context, true) TextSecurePreferences.setLastProfileUpdateTime(context, message.sentTimestamp!!) - val isForceSync = TextSecurePreferences.hasForcedNewConfig(context) - val currentTime = SnodeAPI.nowWithOffset - if (ConfigBase.isNewConfigEnabled(isForceSync, currentTime)) { - TextSecurePreferences.setHasLegacyConfig(context, true) - if (!firstTimeSync) return - } + + TextSecurePreferences.setHasLegacyConfig(context, true) + if (!firstTimeSync) return + val allClosedGroupPublicKeys = storage.getAllClosedGroupPublicKeys() for (closedGroup in message.closedGroups) { if (allClosedGroupPublicKeys.contains(closedGroup.publicKey)) { // just handle the closed group encryption key pairs to avoid sync'd devices getting out of sync storage.addClosedGroupEncryptionKeyPair(closedGroup.encryptionKeyPair!!, closedGroup.publicKey, message.sentTimestamp!!) - } else if (firstTimeSync) { + } else { // only handle new closed group if it's first time sync handleNewClosedGroup(message.sender!!, message.sentTimestamp!!, closedGroup.publicKey, closedGroup.name, closedGroup.encryptionKeyPair!!, closedGroup.members, closedGroup.admins, message.sentTimestamp!!, closedGroup.expirationTimer) From 56a7bc6c8e8858f1cd5e8ffee697c8809559013f Mon Sep 17 00:00:00 2001 From: 0x330a <92654767+0x330a@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:59:58 +1000 Subject: [PATCH 2/4] refactor: gradle kotlin etc, broken trying to make instrumented tests actually run again --- app/build.gradle | 21 +++++++---- .../securesms/MediaOverviewActivity.java | 35 ++++++++++--------- .../securesms/MediaPreviewActivity.java | 23 ++++++++---- .../securesms/PassphrasePromptActivity.java | 9 +++-- .../securesms/SessionDialogBuilder.kt | 2 +- .../securesms/calls/WebRtcCallActivity.kt | 3 +- .../components/emoji/EmojiEditText.java | 2 +- .../securesms/contacts/UserView.kt | 4 +-- .../v2/input_bar/InputBarButton.kt | 2 +- .../conversation/v2/messages/QuoteView.kt | 4 +-- .../v2/messages/VisibleMessageView.kt | 4 +-- .../v2/messages/VoiceMessageView.kt | 5 +-- .../v2/utilities/MentionUtilities.kt | 2 +- .../database/helpers/SQLCipherOpenHelper.java | 2 +- .../giph/ui/GiphyActivityToolbar.java | 12 ++++--- .../groups/EditClosedGroupActivity.kt | 2 +- .../securesms/home/PathStatusView.kt | 2 +- .../mediasend/MediaPickerItemFragment.java | 30 ++++++++-------- .../MultipleRecipientNotificationBuilder.java | 2 +- .../PendingMessageNotificationBuilder.java | 2 +- .../notifications/PushNotificationService.kt | 3 +- .../SingleRecipientNotificationBuilder.java | 2 +- .../securesms/onboarding/PNModeActivity.kt | 6 ++-- .../CorrectedPreferenceFragment.java | 2 +- .../appearance/AppearanceSettingsActivity.kt | 19 +++++----- .../widgets/ContactPreference.java | 8 ++--- .../service/UpdateApkReadyListener.java | 2 +- .../securesms/util/ActivityUtilities.kt | 4 +-- .../securesms/util/ViewUtilities.kt | 7 ++-- gradle.properties | 17 +++++++-- gradle/wrapper/gradle-wrapper.properties | 2 +- libsession-util/build.gradle | 12 +++---- libsession/build.gradle | 13 +++---- .../utilities/TextSecurePreferences.kt | 2 +- libsignal/build.gradle | 5 +-- 35 files changed, 150 insertions(+), 122 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 74b9f84f0..a614c93b7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,7 +6,7 @@ buildscript { } dependencies { classpath "com.android.tools.build:gradle:$gradlePluginVersion" - classpath files('libs/gradle-witness.jar') +// classpath files('libs/gradle-witness.jar') classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion" classpath "com.google.gms:google-services:$googleServicesVersion" @@ -130,9 +130,9 @@ dependencies { testImplementation 'org.assertj:assertj-core:3.11.1' testImplementation "org.mockito:mockito-inline:4.10.0" testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion" - androidTestImplementation "org.mockito:mockito-android:4.10.0" + androidTestImplementation "org.mockito:mockito-android:$mockitoAndroidVersion" androidTestImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion" - testImplementation "androidx.test:core:$testCoreVersion" +// testImplementation "androidx.test:core:$testCoreVersion" testImplementation "androidx.arch.core:core-testing:2.2.0" testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion" androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion" @@ -144,7 +144,7 @@ dependencies { } // AndroidJUnitRunner and JUnit Rules - androidTestImplementation 'androidx.test:runner:1.5.2' + androidTestImplementation "androidx.test:runner:$testRunnerVersion" androidTestImplementation 'androidx.test:rules:1.5.0' // Assertions @@ -192,12 +192,12 @@ android { useLibrary 'org.apache.http.legacy' compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } packagingOptions { @@ -220,6 +220,7 @@ android { } buildFeatures { + buildConfig true compose true } composeOptions { @@ -337,3 +338,9 @@ def autoResConfig() { kapt { correctErrorTypes = true } + +tasks.register("myConfigs") { + doLast { + configurations.forEach { println(it) } + } +} \ No newline at end of file diff --git a/app/src/main/java/org/thoughtcrime/securesms/MediaOverviewActivity.java b/app/src/main/java/org/thoughtcrime/securesms/MediaOverviewActivity.java index 95ba15c82..c0ad2a53b 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/MediaOverviewActivity.java +++ b/app/src/main/java/org/thoughtcrime/securesms/MediaOverviewActivity.java @@ -20,7 +20,6 @@ import android.annotation.SuppressLint; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; -import android.content.res.Resources; import android.database.Cursor; import android.os.Build; import android.os.Bundle; @@ -35,7 +34,6 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBar; -import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.view.ActionMode; import androidx.appcompat.widget.Toolbar; @@ -56,6 +54,10 @@ import org.session.libsession.messaging.messages.control.DataExtractionNotificat import org.session.libsession.messaging.sending_receiving.MessageSender; import org.session.libsession.snode.SnodeAPI; import org.session.libsession.utilities.Address; +import org.session.libsession.utilities.Util; +import org.session.libsession.utilities.ViewUtil; +import org.session.libsession.utilities.recipients.Recipient; +import org.session.libsession.utilities.task.ProgressDialogAsyncTask; import org.thoughtcrime.securesms.database.CursorRecyclerViewAdapter; import org.thoughtcrime.securesms.database.MediaDatabase; import org.thoughtcrime.securesms.database.loaders.BucketedThreadMediaLoader; @@ -63,13 +65,9 @@ import org.thoughtcrime.securesms.database.loaders.BucketedThreadMediaLoader.Buc import org.thoughtcrime.securesms.database.loaders.ThreadMediaLoader; import org.thoughtcrime.securesms.mms.GlideApp; import org.thoughtcrime.securesms.permissions.Permissions; -import org.session.libsession.utilities.recipients.Recipient; import org.thoughtcrime.securesms.util.AttachmentUtil; import org.thoughtcrime.securesms.util.SaveAttachmentTask; import org.thoughtcrime.securesms.util.StickyHeaderDecoration; -import org.session.libsession.utilities.Util; -import org.session.libsession.utilities.ViewUtil; -import org.session.libsession.utilities.task.ProgressDialogAsyncTask; import java.util.Collection; import java.util.LinkedList; @@ -436,17 +434,20 @@ public class MediaOverviewActivity extends PassphraseRequiredActionBarActivity { @Override public boolean onActionItemClicked(ActionMode mode, MenuItem menuItem) { - switch (menuItem.getItemId()) { - case R.id.save: - handleSaveMedia(getListAdapter().getSelectedMedia()); - return true; - case R.id.delete: - handleDeleteMedia(getListAdapter().getSelectedMedia()); - actionMode.finish(); - return true; - case R.id.select_all: - handleSelectAllMedia(); - return true; + int itemId = menuItem.getItemId(); + if (itemId == R.id.save) { + handleSaveMedia(getListAdapter().getSelectedMedia()); + return true; + } else if (itemId == R.id.save) { + handleSaveMedia(getListAdapter().getSelectedMedia()); + return true; + } else if (itemId == R.id.delete) { + handleDeleteMedia(getListAdapter().getSelectedMedia()); + actionMode.finish(); + return true; + } else if (itemId == R.id.select_all) { + handleSelectAllMedia(); + return true; } return false; } diff --git a/app/src/main/java/org/thoughtcrime/securesms/MediaPreviewActivity.java b/app/src/main/java/org/thoughtcrime/securesms/MediaPreviewActivity.java index f19a1fc45..c163ed07e 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/MediaPreviewActivity.java +++ b/app/src/main/java/org/thoughtcrime/securesms/MediaPreviewActivity.java @@ -47,7 +47,6 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.ActionBar; -import androidx.appcompat.app.AlertDialog; import androidx.core.util.Pair; import androidx.lifecycle.ViewModelProvider; import androidx.loader.app.LoaderManager; @@ -491,12 +490,22 @@ public class MediaPreviewActivity extends PassphraseRequiredActionBarActivity im public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); - switch (item.getItemId()) { - case R.id.media_preview__overview: showOverview(); return true; - case R.id.media_preview__forward: forward(); return true; - case R.id.save: saveToDisk(); return true; - case R.id.delete: deleteMedia(); return true; - case android.R.id.home: finish(); return true; + int id = item.getItemId(); + if (id == R.id.media_preview__overview) { + showOverview(); + return true; + } else if (id == R.id.media_preview__forward) { + forward(); + return true; + } else if (id == R.id.save) { + saveToDisk(); + return true; + } else if (id == R.id.delete) { + deleteMedia(); + return true; + } else if (id == android.R.id.home) { + finish(); + return true; } return false; diff --git a/app/src/main/java/org/thoughtcrime/securesms/PassphrasePromptActivity.java b/app/src/main/java/org/thoughtcrime/securesms/PassphrasePromptActivity.java index afc993df8..fd571a87a 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/PassphrasePromptActivity.java +++ b/app/src/main/java/org/thoughtcrime/securesms/PassphrasePromptActivity.java @@ -46,7 +46,6 @@ import org.thoughtcrime.securesms.crypto.BiometricSecretProvider; import org.thoughtcrime.securesms.service.KeyCachingService; import org.thoughtcrime.securesms.util.AnimationCompleteListener; -import java.security.InvalidKeyException; import java.security.Signature; import network.loki.messenger.R; @@ -170,7 +169,7 @@ public class PassphrasePromptActivity extends BaseActionBarActivity { hint.setSpan(new TypefaceSpan("sans-serif"), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE); fingerprintPrompt.setImageResource(R.drawable.ic_fingerprint_white_48dp); - fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(R.color.signal_primary), PorterDuff.Mode.SRC_IN); + fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(org.session.libsession.R.color.signal_primary), PorterDuff.Mode.SRC_IN); lockScreenButton.setOnClickListener(v -> resumeScreenLock()); } @@ -258,7 +257,7 @@ public class PassphrasePromptActivity extends BaseActionBarActivity { handleAuthenticated(); fingerprintPrompt.setImageResource(R.drawable.ic_fingerprint_white_48dp); - fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(R.color.signal_primary), PorterDuff.Mode.SRC_IN); + fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(org.session.libsession.R.color.signal_primary), PorterDuff.Mode.SRC_IN); } }).start(); } @@ -288,7 +287,7 @@ public class PassphrasePromptActivity extends BaseActionBarActivity { handleAuthenticated(); fingerprintPrompt.setImageResource(R.drawable.ic_fingerprint_white_48dp); - fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(R.color.signal_primary), PorterDuff.Mode.SRC_IN); + fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(org.session.libsession.R.color.signal_primary), PorterDuff.Mode.SRC_IN); } }).start(); } @@ -310,7 +309,7 @@ public class PassphrasePromptActivity extends BaseActionBarActivity { @Override public void onAnimationEnd(Animation animation) { fingerprintPrompt.setImageResource(R.drawable.ic_fingerprint_white_48dp); - fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(R.color.signal_primary), PorterDuff.Mode.SRC_IN); + fingerprintPrompt.getBackground().setColorFilter(getResources().getColor(org.session.libsession.R.color.signal_primary), PorterDuff.Mode.SRC_IN); } @Override diff --git a/app/src/main/java/org/thoughtcrime/securesms/SessionDialogBuilder.kt b/app/src/main/java/org/thoughtcrime/securesms/SessionDialogBuilder.kt index 141a98e4a..01e5b84d6 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/SessionDialogBuilder.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/SessionDialogBuilder.kt @@ -53,7 +53,7 @@ class SessionDialogBuilder(val context: Context) { fun title(text: CharSequence?) = title(text?.toString()) fun title(text: String?) { - text(text, R.style.TextAppearance_AppCompat_Title) { setPadding(dp20) } + text(text, androidx.appcompat.R.style.TextAppearance_AppCompat_Title) { setPadding(dp20) } } fun text(@StringRes id: Int, style: Int = 0) = text(context.getString(id), style) diff --git a/app/src/main/java/org/thoughtcrime/securesms/calls/WebRtcCallActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/calls/WebRtcCallActivity.kt index b87eac12c..08ff9b3a9 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/calls/WebRtcCallActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/calls/WebRtcCallActivity.kt @@ -22,7 +22,6 @@ import kotlinx.coroutines.Job import kotlinx.coroutines.delay import kotlinx.coroutines.isActive import kotlinx.coroutines.launch -import network.loki.messenger.R import network.loki.messenger.databinding.ActivityWebrtcBinding import org.apache.commons.lang3.time.DurationFormatUtils import org.session.libsession.avatars.ProfileContactPhoto @@ -269,7 +268,7 @@ class WebRtcCallActivity : PassphraseRequiredActionBarActivity() { val signalProfilePicture = latestRecipient.recipient.contactPhoto val avatar = (signalProfilePicture as? ProfileContactPhoto)?.avatarObject val sizeInPX = - resources.getDimensionPixelSize(R.dimen.extra_large_profile_picture_size) + resources.getDimensionPixelSize(org.session.libsession.R.dimen.extra_large_profile_picture_size) binding.remoteRecipientName.text = displayName if (signalProfilePicture != null && avatar != "0" && avatar != "") { glide.clear(binding.remoteRecipient) diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/emoji/EmojiEditText.java b/app/src/main/java/org/thoughtcrime/securesms/components/emoji/EmojiEditText.java index 757ccc36b..af0e28bd5 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/emoji/EmojiEditText.java +++ b/app/src/main/java/org/thoughtcrime/securesms/components/emoji/EmojiEditText.java @@ -24,7 +24,7 @@ public class EmojiEditText extends AppCompatEditText { } public EmojiEditText(Context context, AttributeSet attrs) { - this(context, attrs, R.attr.editTextStyle); + this(context, attrs, android.R.attr.editTextStyle); } public EmojiEditText(Context context, AttributeSet attrs, int defStyleAttr) { diff --git a/app/src/main/java/org/thoughtcrime/securesms/contacts/UserView.kt b/app/src/main/java/org/thoughtcrime/securesms/contacts/UserView.kt index 36a8c1adf..eb07c511e 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/contacts/UserView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/contacts/UserView.kt @@ -7,10 +7,8 @@ import android.view.View import android.widget.LinearLayout import network.loki.messenger.R import network.loki.messenger.databinding.ViewUserBinding -import org.session.libsession.messaging.MessagingModuleConfiguration import org.session.libsession.messaging.contacts.Contact import org.session.libsession.utilities.recipients.Recipient -import org.thoughtcrime.securesms.conversation.v2.utilities.MentionManagerUtilities import org.thoughtcrime.securesms.dependencies.DatabaseComponent import org.thoughtcrime.securesms.mms.GlideRequests @@ -50,7 +48,7 @@ class UserView : LinearLayout { fun bind(user: Recipient, glide: GlideRequests, actionIndicator: ActionIndicator, isSelected: Boolean = false) { val isLocalUser = user.isLocalNumber fun getUserDisplayName(publicKey: String): String { - if (isLocalUser) return context.getString(R.string.MessageRecord_you) + if (isLocalUser) return context.getString(org.session.libsession.R.string.MessageRecord_you) val contact = DatabaseComponent.get(context).sessionContactDatabase().getContactWithSessionID(publicKey) return contact?.displayName(Contact.ContactContext.REGULAR) ?: publicKey } diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBarButton.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBarButton.kt index c88e05dbf..982383815 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBarButton.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/input_bar/InputBarButton.kt @@ -50,7 +50,7 @@ class InputBarButton : RelativeLayout { if (hasOpaqueBackground) { R.attr.input_bar_button_background_opaque } else if (isSendButton) { - R.attr.colorAccent + androidx.appcompat.R.attr.colorAccent } else { R.attr.input_bar_button_background } diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/QuoteView.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/QuoteView.kt index 4e9140043..b21ffa24d 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/QuoteView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/QuoteView.kt @@ -121,9 +121,9 @@ class QuoteView @JvmOverloads constructor(context: Context, attrs: AttributeSet? // region Convenience @ColorInt private fun getLineColor(isOutgoingMessage: Boolean): Int { return when { - mode == Mode.Regular && !isOutgoingMessage -> context.getColorFromAttr(R.attr.colorAccent) + mode == Mode.Regular && !isOutgoingMessage -> context.getColorFromAttr(androidx.appcompat.R.attr.colorAccent) mode == Mode.Regular -> context.getColorFromAttr(R.attr.message_sent_text_color) - else -> context.getColorFromAttr(R.attr.colorAccent) + else -> context.getColorFromAttr(androidx.appcompat.R.attr.colorAccent) } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VisibleMessageView.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VisibleMessageView.kt index 9538148fd..2d151e208 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VisibleMessageView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VisibleMessageView.kt @@ -310,7 +310,7 @@ class VisibleMessageView : LinearLayout { message.isSyncFailed -> MessageStatusInfo( R.drawable.ic_delivery_status_failed, - context.getColor(R.color.accent_orange), + context.getColor(org.session.libsession.R.color.accent_orange), R.string.delivery_status_sync_failed, null ) @@ -323,7 +323,7 @@ class VisibleMessageView : LinearLayout { message.isResyncing -> MessageStatusInfo( R.drawable.ic_delivery_status_sending, - context.getColor(R.color.accent_orange), R.string.delivery_status_syncing, + context.getColor(org.session.libsession.R.color.accent_orange), R.string.delivery_status_syncing, context.getString(R.string.AccessibilityId_message_sent_status_syncing) ) message.isRead -> diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VoiceMessageView.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VoiceMessageView.kt index 2b829af15..631a9c07d 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VoiceMessageView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VoiceMessageView.kt @@ -7,7 +7,6 @@ import android.view.View import android.widget.RelativeLayout import androidx.core.view.isVisible import dagger.hilt.android.AndroidEntryPoint -import network.loki.messenger.R import network.loki.messenger.databinding.ViewVoiceMessageBinding import org.session.libsession.messaging.sending_receiving.attachments.DatabaseAttachment import org.thoughtcrime.securesms.audio.AudioSlidePlayer @@ -118,7 +117,9 @@ class VoiceMessageView : RelativeLayout, AudioSlidePlayer.Listener { } private fun renderIcon() { - val iconID = if (isPlaying) R.drawable.exo_icon_pause else R.drawable.exo_icon_play + val iconID = + if (isPlaying) com.google.android.exoplayer2.ui.R.drawable.exo_icon_pause + else com.google.android.exoplayer2.ui.R.drawable.exo_icon_play binding.voiceMessagePlaybackImageView.setImageResource(iconID) } diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/utilities/MentionUtilities.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/utilities/MentionUtilities.kt index 1ba4a0c3e..f71f7bf6d 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/utilities/MentionUtilities.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/utilities/MentionUtilities.kt @@ -39,7 +39,7 @@ object MentionUtilities { val publicKey = text.subSequence(matcher.start() + 1, matcher.end()).toString() // +1 to get rid of the @ val isUserBlindedPublicKey = openGroup?.let { SodiumUtilities.sessionId(userPublicKey, publicKey, it.publicKey) } ?: false val userDisplayName: String? = if (publicKey.equals(userPublicKey, ignoreCase = true) || isUserBlindedPublicKey) { - context.getString(R.string.MessageRecord_you) + context.getString(org.session.libsession.R.string.MessageRecord_you) } else { val contact = DatabaseComponent.get(context).sessionContactDatabase().getContactWithSessionID(publicKey) @Suppress("NAME_SHADOWING") val context = if (openGroup != null) Contact.ContactContext.OPEN_GROUP else Contact.ContactContext.REGULAR 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 89bda0994..13a86009e 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 @@ -255,7 +255,7 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper { NotificationCompat.Builder builder = new NotificationCompat.Builder(context, channelId) .setSmallIcon(R.drawable.ic_notification) - .setColor(context.getResources().getColor(R.color.textsecure_primary)) + .setColor(context.getResources().getColor(org.session.libsession.R.color.textsecure_primary)) .setCategory(NotificationCompat.CATEGORY_ERROR) .setContentTitle(context.getString(R.string.ErrorNotifier_migration)) .setContentText(context.getString(R.string.ErrorNotifier_migration_downgrade)) diff --git a/app/src/main/java/org/thoughtcrime/securesms/giph/ui/GiphyActivityToolbar.java b/app/src/main/java/org/thoughtcrime/securesms/giph/ui/GiphyActivityToolbar.java index 93293bcff..ed1cb9b1f 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/giph/ui/GiphyActivityToolbar.java +++ b/app/src/main/java/org/thoughtcrime/securesms/giph/ui/GiphyActivityToolbar.java @@ -3,9 +3,6 @@ package org.thoughtcrime.securesms.giph.ui; import android.content.Context; import android.graphics.Rect; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.appcompat.widget.Toolbar; import android.text.Editable; import android.text.InputType; import android.text.TextWatcher; @@ -20,9 +17,14 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; -import network.loki.messenger.R; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.widget.Toolbar; + import org.thoughtcrime.securesms.components.AnimatingToggle; +import network.loki.messenger.R; + public class GiphyActivityToolbar extends Toolbar { @Nullable private OnFilterChangedListener filterListener; @@ -42,7 +44,7 @@ public class GiphyActivityToolbar extends Toolbar { } public GiphyActivityToolbar(Context context, AttributeSet attrs) { - this(context, attrs, R.attr.toolbarStyle); + this(context, attrs, android.R.attr.toolbarStyle); } public GiphyActivityToolbar(Context context, AttributeSet attrs, int defStyleAttr) { diff --git a/app/src/main/java/org/thoughtcrime/securesms/groups/EditClosedGroupActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/groups/EditClosedGroupActivity.kt index 9fee8adaf..56c9cad2f 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/groups/EditClosedGroupActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/groups/EditClosedGroupActivity.kt @@ -102,7 +102,7 @@ class EditClosedGroupActivity : PassphraseRequiredActionBarActivity() { setContentView(R.layout.activity_edit_closed_group) supportActionBar!!.setHomeAsUpIndicator( - ThemeUtil.getThemedDrawableResId(this, R.attr.actionModeCloseDrawable)) + ThemeUtil.getThemedDrawableResId(this, androidx.appcompat.R.attr.actionModeCloseDrawable)) groupID = intent.getStringExtra(groupIDKey)!! val groupInfo = DatabaseComponent.get(this).groupDatabase().getGroup(groupID).get() diff --git a/app/src/main/java/org/thoughtcrime/securesms/home/PathStatusView.kt b/app/src/main/java/org/thoughtcrime/securesms/home/PathStatusView.kt index 7ab7bfb50..c0af85224 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/home/PathStatusView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/home/PathStatusView.kt @@ -99,7 +99,7 @@ class PathStatusView : View { val paths = withContext(Dispatchers.IO) { OnionRequestAPI.paths } if (paths.isNotEmpty()) { setBackgroundResource(R.drawable.accent_dot) - val hasPathsColor = context.getColor(R.color.accent_green) + val hasPathsColor = context.getColor(org.session.libsession.R.color.accent_green) mainColor = hasPathsColor sessionShadowColor = hasPathsColor } else { diff --git a/app/src/main/java/org/thoughtcrime/securesms/mediasend/MediaPickerItemFragment.java b/app/src/main/java/org/thoughtcrime/securesms/mediasend/MediaPickerItemFragment.java index 9e3db73bf..a14b87aa0 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/mediasend/MediaPickerItemFragment.java +++ b/app/src/main/java/org/thoughtcrime/securesms/mediasend/MediaPickerItemFragment.java @@ -1,18 +1,9 @@ package org.thoughtcrime.securesms.mediasend; -import androidx.appcompat.app.ActionBar; -import androidx.lifecycle.ViewModelProvider; import android.content.Context; import android.content.res.Configuration; import android.graphics.Point; import android.os.Bundle; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.fragment.app.Fragment; -import androidx.appcompat.app.AppCompatActivity; -import androidx.recyclerview.widget.GridLayoutManager; -import androidx.recyclerview.widget.RecyclerView; -import androidx.appcompat.widget.Toolbar; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; @@ -21,8 +12,18 @@ import android.view.ViewGroup; import android.view.WindowManager; import android.widget.Toast; -import org.thoughtcrime.securesms.mms.GlideApp; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import androidx.fragment.app.Fragment; +import androidx.lifecycle.ViewModelProvider; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + import org.session.libsession.utilities.Util; +import org.thoughtcrime.securesms.mms.GlideApp; import java.util.ArrayList; import java.util.List; @@ -130,11 +131,10 @@ public class MediaPickerItemFragment extends Fragment implements MediaPickerItem @Override public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case R.id.mediapicker_menu_add: - adapter.setForcedMultiSelect(true); - viewModel.onMultiSelectStarted(); - return true; + if (item.getItemId() == R.id.mediapicker_menu_add) { + adapter.setForcedMultiSelect(true); + viewModel.onMultiSelectStarted(); + return true; } return false; } 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 a4871f0fc..d691c57b4 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/notifications/MultipleRecipientNotificationBuilder.java +++ b/app/src/main/java/org/thoughtcrime/securesms/notifications/MultipleRecipientNotificationBuilder.java @@ -31,7 +31,7 @@ public class MultipleRecipientNotificationBuilder extends AbstractNotificationBu public MultipleRecipientNotificationBuilder(Context context, NotificationPrivacyPreference privacy) { super(context, privacy); - setColor(context.getResources().getColor(R.color.textsecure_primary)); + setColor(context.getResources().getColor(org.session.libsession.R.color.textsecure_primary)); setSmallIcon(R.drawable.ic_notification); setContentTitle(context.getString(R.string.app_name)); setContentIntent(PendingIntent.getActivity(context, 0, new Intent(context, HomeActivity.class), PendingIntent.FLAG_IMMUTABLE)); diff --git a/app/src/main/java/org/thoughtcrime/securesms/notifications/PendingMessageNotificationBuilder.java b/app/src/main/java/org/thoughtcrime/securesms/notifications/PendingMessageNotificationBuilder.java index 935d575c5..503e4550b 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/notifications/PendingMessageNotificationBuilder.java +++ b/app/src/main/java/org/thoughtcrime/securesms/notifications/PendingMessageNotificationBuilder.java @@ -22,7 +22,7 @@ public class PendingMessageNotificationBuilder extends AbstractNotificationBuild Intent intent = new Intent(context, HomeActivity.class); setSmallIcon(R.drawable.ic_notification); - setColor(context.getResources().getColor(R.color.textsecure_primary)); + setColor(context.getResources().getColor(org.session.libsession.R.color.textsecure_primary)); setCategory(NotificationCompat.CATEGORY_MESSAGE); setContentTitle(context.getString(R.string.MessageNotifier_pending_signal_messages)); diff --git a/app/src/main/java/org/thoughtcrime/securesms/notifications/PushNotificationService.kt b/app/src/main/java/org/thoughtcrime/securesms/notifications/PushNotificationService.kt index fc399d293..04bf8bc89 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/notifications/PushNotificationService.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/notifications/PushNotificationService.kt @@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.notifications import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat +import androidx.core.content.ContextCompat import com.google.firebase.messaging.FirebaseMessagingService import com.google.firebase.messaging.RemoteMessage import org.session.libsession.messaging.jobs.BatchMessageReceiveJob @@ -37,7 +38,7 @@ class PushNotificationService : FirebaseMessagingService() { Log.d("Loki", "Failed to decode data for message.") val builder = NotificationCompat.Builder(this, NotificationChannels.OTHER) .setSmallIcon(network.loki.messenger.R.drawable.ic_notification) - .setColor(this.getResources().getColor(network.loki.messenger.R.color.textsecure_primary)) + .setColor(ContextCompat.getColor(this, org.session.libsession.R.color.textsecure_primary)) .setContentTitle("Session") .setContentText("You've got a new message.") .setPriority(NotificationCompat.PRIORITY_DEFAULT) 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 da0896d05..958159a90 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/notifications/SingleRecipientNotificationBuilder.java +++ b/app/src/main/java/org/thoughtcrime/securesms/notifications/SingleRecipientNotificationBuilder.java @@ -65,7 +65,7 @@ public class SingleRecipientNotificationBuilder extends AbstractNotificationBuil super(context, privacy); setSmallIcon(R.drawable.ic_notification); - setColor(ContextCompat.getColor(context, R.color.accent_green)); + setColor(ContextCompat.getColor(context, org.session.libsession.R.color.accent_green)); setCategory(NotificationCompat.CATEGORY_MESSAGE); if (!NotificationChannels.supported()) { diff --git a/app/src/main/java/org/thoughtcrime/securesms/onboarding/PNModeActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/onboarding/PNModeActivity.kt index 2de626953..483909bb4 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/onboarding/PNModeActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/onboarding/PNModeActivity.kt @@ -42,10 +42,10 @@ class PNModeActivity : BaseActionBarActivity() { with(binding) { contentView.disableClipping() fcmOptionView.setOnClickListener { toggleFCM() } - fcmOptionView.mainColor = ThemeUtil.getThemedColor(root.context, R.attr.colorPrimary) + fcmOptionView.mainColor = ThemeUtil.getThemedColor(root.context, androidx.appcompat.R.attr.colorPrimary) fcmOptionView.strokeColor = resources.getColorWithID(R.color.pn_option_border, theme) backgroundPollingOptionView.setOnClickListener { toggleBackgroundPolling() } - backgroundPollingOptionView.mainColor = ThemeUtil.getThemedColor(root.context, R.attr.colorPrimary) + backgroundPollingOptionView.mainColor = ThemeUtil.getThemedColor(root.context, androidx.appcompat.R.attr.colorPrimary) backgroundPollingOptionView.strokeColor = resources.getColorWithID(R.color.pn_option_border, theme) registerButton.setOnClickListener { register() } } @@ -153,7 +153,7 @@ class PNModeActivity : BaseActionBarActivity() { if (selectedOptionView == null) { showSessionDialog { title(R.string.activity_pn_mode_no_option_picked_dialog_title) - button(R.string.ok) + button(android.R.string.ok) } return } diff --git a/app/src/main/java/org/thoughtcrime/securesms/preferences/CorrectedPreferenceFragment.java b/app/src/main/java/org/thoughtcrime/securesms/preferences/CorrectedPreferenceFragment.java index 8c3e6190e..499931f27 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/preferences/CorrectedPreferenceFragment.java +++ b/app/src/main/java/org/thoughtcrime/securesms/preferences/CorrectedPreferenceFragment.java @@ -155,7 +155,7 @@ public abstract class CorrectedPreferenceFragment extends PreferenceFragmentComp holder.itemView.setLayoutParams(layoutParams); setZeroPaddingToLayoutChildren(holder.itemView); } else { - View iconFrame = holder.itemView.findViewById(R.id.icon_frame); + View iconFrame = holder.itemView.findViewById(androidx.preference.R.id.icon_frame); if (iconFrame != null) { iconFrame.setVisibility(preference.getIcon() == null ? View.GONE : View.VISIBLE); } diff --git a/app/src/main/java/org/thoughtcrime/securesms/preferences/appearance/AppearanceSettingsActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/preferences/appearance/AppearanceSettingsActivity.kt index 823728c35..794907785 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/preferences/appearance/AppearanceSettingsActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/preferences/appearance/AppearanceSettingsActivity.kt @@ -5,7 +5,6 @@ import android.os.Parcelable import android.util.SparseArray import android.view.View import androidx.activity.viewModels -import androidx.appcompat.widget.SwitchCompat import androidx.core.view.children import androidx.lifecycle.lifecycleScope import dagger.hilt.android.AndroidEntryPoint @@ -33,13 +32,13 @@ class AppearanceSettingsActivity: PassphraseRequiredActionBarActivity(), View.On private val accentColors get() = mapOf( - binding.accentGreen to R.style.PrimaryGreen, - binding.accentBlue to R.style.PrimaryBlue, - binding.accentYellow to R.style.PrimaryYellow, - binding.accentPink to R.style.PrimaryPink, - binding.accentPurple to R.style.PrimaryPurple, - binding.accentOrange to R.style.PrimaryOrange, - binding.accentRed to R.style.PrimaryRed + binding.accentGreen to org.session.libsession.R.style.PrimaryGreen, + binding.accentBlue to org.session.libsession.R.style.PrimaryBlue, + binding.accentYellow to org.session.libsession.R.style.PrimaryYellow, + binding.accentPink to org.session.libsession.R.style.PrimaryPink, + binding.accentPurple to org.session.libsession.R.style.PrimaryPurple, + binding.accentOrange to org.session.libsession.R.style.PrimaryOrange, + binding.accentRed to org.session.libsession.R.style.PrimaryRed ) private val themeViews @@ -73,9 +72,9 @@ class AppearanceSettingsActivity: PassphraseRequiredActionBarActivity(), View.On viewModel.setNewStyle(mappedStyle) if (currentBase != newBase) { if (newBase == R.style.Ocean) { - viewModel.setNewAccent(R.style.PrimaryBlue) + viewModel.setNewAccent(org.session.libsession.R.style.PrimaryBlue) } else if (newBase == R.style.Classic) { - viewModel.setNewAccent(R.style.PrimaryGreen) + viewModel.setNewAccent(org.session.libsession.R.style.PrimaryGreen) } } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/preferences/widgets/ContactPreference.java b/app/src/main/java/org/thoughtcrime/securesms/preferences/widgets/ContactPreference.java index f5417f3e9..9bbc2b7db 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/preferences/widgets/ContactPreference.java +++ b/app/src/main/java/org/thoughtcrime/securesms/preferences/widgets/ContactPreference.java @@ -3,11 +3,11 @@ package org.thoughtcrime.securesms.preferences.widgets; import android.content.Context; import android.graphics.PorterDuff; +import android.util.AttributeSet; +import android.widget.ImageView; + import androidx.preference.Preference; import androidx.preference.PreferenceViewHolder; -import android.util.AttributeSet; -import android.view.View; -import android.widget.ImageView; import network.loki.messenger.R; @@ -58,7 +58,7 @@ public class ContactPreference extends Preference { int color; if (secure) { - color = getContext().getResources().getColor(R.color.textsecure_primary); + color = getContext().getResources().getColor(org.session.libsession.R.color.textsecure_primary); } else { color = getContext().getResources().getColor(R.color.grey_600); } diff --git a/app/src/main/java/org/thoughtcrime/securesms/service/UpdateApkReadyListener.java b/app/src/main/java/org/thoughtcrime/securesms/service/UpdateApkReadyListener.java index eea6ba00f..e454cd608 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/service/UpdateApkReadyListener.java +++ b/app/src/main/java/org/thoughtcrime/securesms/service/UpdateApkReadyListener.java @@ -69,7 +69,7 @@ public class UpdateApkReadyListener extends BroadcastReceiver { .setContentTitle(context.getString(R.string.UpdateApkReadyListener_Signal_update)) .setContentText(context.getString(R.string.UpdateApkReadyListener_a_new_version_of_signal_is_available_tap_to_update)) .setSmallIcon(R.drawable.ic_notification) - .setColor(context.getResources().getColor(R.color.textsecure_primary)) + .setColor(context.getResources().getColor(org.session.libsession.R.color.textsecure_primary)) .setPriority(NotificationCompat.PRIORITY_HIGH) .setCategory(NotificationCompat.CATEGORY_REMINDER) .setContentIntent(pendingIntent) diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/ActivityUtilities.kt b/app/src/main/java/org/thoughtcrime/securesms/util/ActivityUtilities.kt index 5ff823a15..19cba2f84 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/util/ActivityUtilities.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/util/ActivityUtilities.kt @@ -91,8 +91,8 @@ fun String.getThemeStyle(): Int = when (this) { @StyleRes fun Int.getDefaultAccentColor(): Int = - if (this == R.style.Ocean_Dark || this == R.style.Ocean_Light) R.style.PrimaryBlue - else R.style.PrimaryGreen + if (this == R.style.Ocean_Dark || this == R.style.Ocean_Light) org.session.libsession.R.style.PrimaryBlue + else org.session.libsession.R.style.PrimaryGreen data class ThemeState ( @StyleRes val theme: Int, diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/ViewUtilities.kt b/app/src/main/java/org/thoughtcrime/securesms/util/ViewUtilities.kt index dfd4ffe41..63d206ffa 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/util/ViewUtilities.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/util/ViewUtilities.kt @@ -10,12 +10,11 @@ import android.graphics.PointF import android.graphics.Rect import android.util.Size import android.view.View +import android.view.inputmethod.InputMethodManager import androidx.annotation.ColorInt import androidx.annotation.DimenRes -import network.loki.messenger.R -import org.session.libsession.utilities.getColorFromAttr -import android.view.inputmethod.InputMethodManager import androidx.core.graphics.applyCanvas +import org.session.libsession.utilities.getColorFromAttr import kotlin.math.roundToInt fun View.contains(point: PointF): Boolean { @@ -30,7 +29,7 @@ val View.hitRect: Rect } @ColorInt -fun Context.getAccentColor() = getColorFromAttr(R.attr.colorAccent) +fun Context.getAccentColor() = getColorFromAttr(androidx.appcompat.R.attr.colorAccent) fun View.animateSizeChange(@DimenRes startSizeID: Int, @DimenRes endSizeID: Int, animationDuration: Long = 250) { val startSize = resources.getDimension(startSizeID) diff --git a/gradle.properties b/gradle.properties index 1d7bc62d4..8f87adc61 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ #Mon Jun 26 09:56:43 AEST 2023 android.enableJetifier=true -gradlePluginVersion=7.3.1 +gradlePluginVersion=8.1.0 org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" org.gradle.unsafe.configuration-cache=true @@ -21,7 +21,7 @@ googleServicesVersion=4.3.12 kotlinVersion=1.8.21 android.useAndroidX=true appcompatVersion=1.6.1 -coreVersion=1.8.0 +coreVersion=1.10.1 coroutinesVersion=1.6.4 curve25519Version=0.6.0 daggerVersion=2.46.1 @@ -32,9 +32,20 @@ kotlinxJsonVersion=1.3.3 kovenantVersion=3.3.0 lifecycleVersion=2.5.1 materialVersion=1.8.0 -mockitoKotlinVersion=4.1.0 +mockitoAndroidVersion=5.4.0 +mockitoKotlinVersion=5.0.0 okhttpVersion=3.12.1 pagingVersion=3.0.0 preferenceVersion=1.2.0 protobufVersion=2.5.0 + testCoreVersion=1.5.0 +testEspressoVersion=3.5.1 +extJunitVersion=1.1.5 +testMonitorVersion=1.6.1 +testRunnerVersion=1.5.2 +testRulesVersion=1.5.0 +testServicesVersion=1.4.2 +testOrchestratorVersion=1.4.2 +testExtTruthVersion=1.5.0 +testAnnotationVersion=1.0.1 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index cd825d084..d11ba5c84 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Thu Dec 30 07:09:53 SAST 2021 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/libsession-util/build.gradle b/libsession-util/build.gradle index e4f9ed56f..96d2b9de4 100644 --- a/libsession-util/build.gradle +++ b/libsession-util/build.gradle @@ -30,18 +30,18 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } } dependencies { - testImplementation 'junit:junit:4.13.2' + testImplementation "junit:junit:$junitVersion" implementation(project(":libsignal")) implementation "com.google.protobuf:protobuf-java:$protobufVersion" - androidTestImplementation 'androidx.test.ext:junit:1.1.4' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' } \ No newline at end of file diff --git a/libsession/build.gradle b/libsession/build.gradle index 045648e09..30c356b2a 100644 --- a/libsession/build.gradle +++ b/libsession/build.gradle @@ -4,6 +4,7 @@ plugins { } android { + namespace "org.session.libsession" compileSdkVersion androidCompileSdkVersion defaultConfig { @@ -11,8 +12,8 @@ android { } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } } @@ -28,8 +29,8 @@ dependencies { implementation "com.google.android.material:material:$materialVersion" implementation "com.google.protobuf:protobuf-java:$protobufVersion" implementation "com.google.dagger:hilt-android:$daggerVersion" - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' implementation "com.github.bumptech.glide:glide:$glideVersion" implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1' implementation 'com.annimon:stream:1.1.8' @@ -44,10 +45,10 @@ dependencies { implementation "nl.komponents.kovenant:kovenant:$kovenantVersion" testImplementation "junit:junit:$junitVersion" testImplementation 'org.assertj:assertj-core:3.11.1' - testImplementation "org.mockito:mockito-inline:4.0.0" + testImplementation "org.mockito:mockito-inline:4.10.0" testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion" testImplementation "androidx.test:core:$testCoreVersion" - testImplementation "androidx.arch.core:core-testing:2.1.0" + testImplementation "androidx.arch.core:core-testing:2.2.0" testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion" testImplementation "org.conscrypt:conscrypt-openjdk-uber:2.0.0" implementation 'org.greenrobot:eventbus:3.0.0' diff --git a/libsession/src/main/java/org/session/libsession/utilities/TextSecurePreferences.kt b/libsession/src/main/java/org/session/libsession/utilities/TextSecurePreferences.kt index d6ed96373..bd76b1266 100644 --- a/libsession/src/main/java/org/session/libsession/utilities/TextSecurePreferences.kt +++ b/libsession/src/main/java/org/session/libsession/utilities/TextSecurePreferences.kt @@ -740,7 +740,7 @@ interface TextSecurePreferences { @JvmStatic fun getNotificationLedColor(context: Context): Int { - return getIntegerPreference(context, LED_COLOR_PREF_PRIMARY, ThemeUtil.getThemedColor(context, R.attr.colorAccent)) + return getIntegerPreference(context, LED_COLOR_PREF_PRIMARY, ThemeUtil.getThemedColor(context, androidx.appcompat.R.attr.colorAccent)) } @JvmStatic diff --git a/libsignal/build.gradle b/libsignal/build.gradle index 1ea5f2de0..c0e84ccb3 100644 --- a/libsignal/build.gradle +++ b/libsignal/build.gradle @@ -2,6 +2,7 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { + namespace "org.session.libsignal" compileSdkVersion androidCompileSdkVersion defaultConfig { @@ -9,8 +10,8 @@ android { } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } } From 22fa79fbe295dc59d73ec2ec5419b3d726d81f7f Mon Sep 17 00:00:00 2001 From: 0x330a <92654767+0x330a@users.noreply.github.com> Date: Tue, 8 Aug 2023 12:28:34 +1000 Subject: [PATCH 3/4] fix: build works now --- app/build.gradle | 43 ++++++++----------- .../PrivacySettingsPreferenceFragment.kt | 2 +- gradle.properties | 19 ++++---- libsession-util/build.gradle | 4 +- 4 files changed, 30 insertions(+), 38 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a614c93b7..087cbe330 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -39,7 +39,7 @@ dependencies { kapt("com.google.dagger:hilt-android-compiler:2.44") implementation "androidx.appcompat:appcompat:$appcompatVersion" - implementation 'androidx.recyclerview:recyclerview:1.2.1' + implementation 'androidx.recyclerview:recyclerview:1.3.1' implementation "com.google.android.material:material:$materialVersion" implementation 'com.google.android:flexbox:2.0.1' implementation 'androidx.legacy:legacy-support-v13:1.0.0' @@ -47,7 +47,7 @@ dependencies { implementation "androidx.preference:preference-ktx:$preferenceVersion" implementation 'androidx.legacy:legacy-preference-v14:1.0.0' implementation 'androidx.gridlayout:gridlayout:1.0.0' - implementation 'androidx.exifinterface:exifinterface:1.3.4' + implementation 'androidx.exifinterface:exifinterface:1.3.6' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion" implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion" @@ -55,10 +55,10 @@ dependencies { implementation "androidx.lifecycle:lifecycle-process:$lifecycleVersion" implementation "androidx.lifecycle:lifecycle-extensions:2.2.0" implementation "androidx.paging:paging-runtime-ktx:$pagingVersion" - implementation 'androidx.activity:activity-ktx:1.5.1' - implementation 'androidx.fragment:fragment-ktx:1.5.3' + implementation 'androidx.activity:activity-ktx:1.7.2' + implementation 'androidx.fragment:fragment-ktx:1.6.1' implementation "androidx.core:core-ktx:$coreVersion" - implementation "androidx.work:work-runtime-ktx:2.7.1" + implementation "androidx.work:work-runtime-ktx:2.8.1" implementation ("com.google.firebase:firebase-messaging:18.0.0") { exclude group: 'com.google.firebase', module: 'firebase-core' exclude group: 'com.google.firebase', module: 'firebase-analytics' @@ -132,12 +132,12 @@ dependencies { testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion" androidTestImplementation "org.mockito:mockito-android:$mockitoAndroidVersion" androidTestImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion" -// testImplementation "androidx.test:core:$testCoreVersion" + testImplementation "androidx.test:core:$testCoreVersion" testImplementation "androidx.arch.core:core-testing:2.2.0" testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion" androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion" // Core library - androidTestImplementation "androidx.test:core:$testCoreVersion" + androidTestImplementation("androidx.test:core:$testCoreVersion") androidTestImplementation('com.adevinta.android:barista:4.2.0') { exclude group: 'org.jetbrains.kotlin' @@ -145,21 +145,20 @@ dependencies { // AndroidJUnitRunner and JUnit Rules androidTestImplementation "androidx.test:runner:$testRunnerVersion" - androidTestImplementation 'androidx.test:rules:1.5.0' + androidTestImplementation "androidx.test:rules:$testRulesVersion" // Assertions - androidTestImplementation 'androidx.test.ext:junit:1.1.5' - androidTestImplementation 'androidx.test.ext:truth:1.5.0' - androidTestImplementation 'com.google.truth:truth:1.1.3' + androidTestImplementation "androidx.test.ext:junit:1.1.5" + androidTestImplementation "androidx.test.ext:truth:$testExtTruthVersion" // Espresso dependencies - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' - androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.5.1' - androidTestImplementation 'androidx.test.espresso:espresso-intents:3.5.1' - androidTestImplementation 'androidx.test.espresso:espresso-accessibility:3.5.1' - androidTestImplementation 'androidx.test.espresso:espresso-web:3.5.1' - androidTestImplementation 'androidx.test.espresso.idling:idling-concurrent:3.5.1' - androidTestImplementation 'androidx.test.espresso:espresso-idling-resource:3.5.1' + androidTestImplementation "androidx.test.espresso:espresso-core:$testEspressoVersion" + androidTestImplementation "androidx.test.espresso:espresso-contrib:$testEspressoVersion" + androidTestImplementation "androidx.test.espresso:espresso-intents:$testEspressoVersion" + androidTestImplementation "androidx.test.espresso:espresso-accessibility:$testEspressoVersion" + androidTestImplementation "androidx.test.espresso:espresso-web:$testEspressoVersion" + androidTestImplementation "androidx.test.espresso.idling:idling-concurrent:$testEspressoVersion" + androidTestImplementation "androidx.test.espresso:espresso-idling-resource:$testEspressoVersion" androidTestUtil 'androidx.test:orchestrator:1.4.2' testImplementation 'org.robolectric:robolectric:4.4' @@ -187,7 +186,7 @@ def abiPostFix = ['armeabi-v7a' : 1, 'universal' : 5] android { - compileSdkVersion androidCompileSdkVersion + compileSdk androidCompileSdkVersion namespace 'network.loki.messenger' useLibrary 'org.apache.http.legacy' @@ -338,9 +337,3 @@ def autoResConfig() { kapt { correctErrorTypes = true } - -tasks.register("myConfigs") { - doLast { - configurations.forEach { println(it) } - } -} \ No newline at end of file diff --git a/app/src/main/java/org/thoughtcrime/securesms/preferences/PrivacySettingsPreferenceFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/preferences/PrivacySettingsPreferenceFragment.kt index eaf48f868..e030d970c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/preferences/PrivacySettingsPreferenceFragment.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/preferences/PrivacySettingsPreferenceFragment.kt @@ -50,7 +50,7 @@ class PrivacySettingsPreferenceFragment : ListSummaryPreferenceFragment() { .setData(Uri.parse("package:" + BuildConfig.APPLICATION_ID)) } .apply { addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) } - .takeIf { IntentUtils.isResolvable(requireContext(), it) }.let { + .takeIf { IntentUtils.isResolvable(requireContext(), it) }?.let { startActivity(it) } } diff --git a/gradle.properties b/gradle.properties index 8f87adc61..31a8e5723 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,7 +22,7 @@ kotlinVersion=1.8.21 android.useAndroidX=true appcompatVersion=1.6.1 coreVersion=1.10.1 -coroutinesVersion=1.6.4 +coroutinesVersion=1.7.1 curve25519Version=0.6.0 daggerVersion=2.46.1 glideVersion=4.11.0 @@ -30,22 +30,21 @@ jacksonDatabindVersion=2.9.8 junitVersion=4.13.2 kotlinxJsonVersion=1.3.3 kovenantVersion=3.3.0 -lifecycleVersion=2.5.1 -materialVersion=1.8.0 +lifecycleVersion=2.6.1 +materialVersion=1.9.0 mockitoAndroidVersion=5.4.0 mockitoKotlinVersion=5.0.0 okhttpVersion=3.12.1 -pagingVersion=3.0.0 +pagingVersion=3.2.0 preferenceVersion=1.2.0 protobufVersion=2.5.0 -testCoreVersion=1.5.0 -testEspressoVersion=3.5.1 +testCoreVersion=1.4.0 +testEspressoVersion=3.4.0 extJunitVersion=1.1.5 -testMonitorVersion=1.6.1 -testRunnerVersion=1.5.2 -testRulesVersion=1.5.0 +testRunnerVersion=1.4.0 +testRulesVersion=1.4.0 testServicesVersion=1.4.2 testOrchestratorVersion=1.4.2 -testExtTruthVersion=1.5.0 +testExtTruthVersion=1.4.0 testAnnotationVersion=1.0.1 \ No newline at end of file diff --git a/libsession-util/build.gradle b/libsession-util/build.gradle index 96d2b9de4..cb24bebd7 100644 --- a/libsession-util/build.gradle +++ b/libsession-util/build.gradle @@ -42,6 +42,6 @@ dependencies { testImplementation "junit:junit:$junitVersion" implementation(project(":libsignal")) implementation "com.google.protobuf:protobuf-java:$protobufVersion" - androidTestImplementation 'androidx.test.ext:junit:1.1.5' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' + androidTestImplementation "androidx.test.ext:junit:$extJunitVersion" + androidTestImplementation "androidx.test.espresso:espresso-core:$testEspressoVersion" } \ No newline at end of file From f73ed2942c35f2e119466f2bfb2355edf2c30cb4 Mon Sep 17 00:00:00 2001 From: 0x330a <92654767+0x330a@users.noreply.github.com> Date: Tue, 8 Aug 2023 14:54:08 +1000 Subject: [PATCH 4/4] fix: downgrade to working state again --- app/build.gradle | 19 +++++++++---------- gradle.properties | 10 +++++----- gradle/wrapper/gradle-wrapper.properties | 2 +- libsession-util/build.gradle | 6 +++--- libsession/build.gradle | 13 ++++++------- libsignal/build.gradle | 5 ++--- 6 files changed, 26 insertions(+), 29 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 087cbe330..34e3f5318 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,7 +6,7 @@ buildscript { } dependencies { classpath "com.android.tools.build:gradle:$gradlePluginVersion" -// classpath files('libs/gradle-witness.jar') + classpath files('libs/gradle-witness.jar') classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion" classpath "com.google.gms:google-services:$googleServicesVersion" @@ -39,7 +39,7 @@ dependencies { kapt("com.google.dagger:hilt-android-compiler:2.44") implementation "androidx.appcompat:appcompat:$appcompatVersion" - implementation 'androidx.recyclerview:recyclerview:1.3.1' + implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation "com.google.android.material:material:$materialVersion" implementation 'com.google.android:flexbox:2.0.1' implementation 'androidx.legacy:legacy-support-v13:1.0.0' @@ -47,7 +47,7 @@ dependencies { implementation "androidx.preference:preference-ktx:$preferenceVersion" implementation 'androidx.legacy:legacy-preference-v14:1.0.0' implementation 'androidx.gridlayout:gridlayout:1.0.0' - implementation 'androidx.exifinterface:exifinterface:1.3.6' + implementation 'androidx.exifinterface:exifinterface:1.3.4' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion" implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion" @@ -55,10 +55,10 @@ dependencies { implementation "androidx.lifecycle:lifecycle-process:$lifecycleVersion" implementation "androidx.lifecycle:lifecycle-extensions:2.2.0" implementation "androidx.paging:paging-runtime-ktx:$pagingVersion" - implementation 'androidx.activity:activity-ktx:1.7.2' - implementation 'androidx.fragment:fragment-ktx:1.6.1' + implementation 'androidx.activity:activity-ktx:1.5.1' + implementation 'androidx.fragment:fragment-ktx:1.5.3' implementation "androidx.core:core-ktx:$coreVersion" - implementation "androidx.work:work-runtime-ktx:2.8.1" + implementation "androidx.work:work-runtime-ktx:2.7.1" implementation ("com.google.firebase:firebase-messaging:18.0.0") { exclude group: 'com.google.firebase', module: 'firebase-core' exclude group: 'com.google.firebase', module: 'firebase-analytics' @@ -191,12 +191,12 @@ android { useLibrary 'org.apache.http.legacy' compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { - jvmTarget = '17' + jvmTarget = '1.8' } packagingOptions { @@ -219,7 +219,6 @@ android { } buildFeatures { - buildConfig true compose true } composeOptions { diff --git a/gradle.properties b/gradle.properties index 31a8e5723..0ab528a6b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ #Mon Jun 26 09:56:43 AEST 2023 android.enableJetifier=true -gradlePluginVersion=8.1.0 +gradlePluginVersion=7.3.1 org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" org.gradle.unsafe.configuration-cache=true @@ -21,8 +21,8 @@ googleServicesVersion=4.3.12 kotlinVersion=1.8.21 android.useAndroidX=true appcompatVersion=1.6.1 -coreVersion=1.10.1 -coroutinesVersion=1.7.1 +coreVersion=1.8.0 +coroutinesVersion=1.6.4 curve25519Version=0.6.0 daggerVersion=2.46.1 glideVersion=4.11.0 @@ -32,8 +32,8 @@ kotlinxJsonVersion=1.3.3 kovenantVersion=3.3.0 lifecycleVersion=2.6.1 materialVersion=1.9.0 -mockitoAndroidVersion=5.4.0 -mockitoKotlinVersion=5.0.0 +mockitoAndroidVersion=4.10.0 +mockitoKotlinVersion=4.1.0 okhttpVersion=3.12.1 pagingVersion=3.2.0 preferenceVersion=1.2.0 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d11ba5c84..cd825d084 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Thu Dec 30 07:09:53 SAST 2021 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/libsession-util/build.gradle b/libsession-util/build.gradle index cb24bebd7..fe9f523db 100644 --- a/libsession-util/build.gradle +++ b/libsession-util/build.gradle @@ -30,11 +30,11 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } kotlinOptions { - jvmTarget = '17' + jvmTarget = '1.8' } } diff --git a/libsession/build.gradle b/libsession/build.gradle index 30c356b2a..045648e09 100644 --- a/libsession/build.gradle +++ b/libsession/build.gradle @@ -4,7 +4,6 @@ plugins { } android { - namespace "org.session.libsession" compileSdkVersion androidCompileSdkVersion defaultConfig { @@ -12,8 +11,8 @@ android { } compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } } @@ -29,8 +28,8 @@ dependencies { implementation "com.google.android.material:material:$materialVersion" implementation "com.google.protobuf:protobuf-java:$protobufVersion" implementation "com.google.dagger:hilt-android:$daggerVersion" - androidTestImplementation 'androidx.test.ext:junit:1.1.5' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' implementation "com.github.bumptech.glide:glide:$glideVersion" implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1' implementation 'com.annimon:stream:1.1.8' @@ -45,10 +44,10 @@ dependencies { implementation "nl.komponents.kovenant:kovenant:$kovenantVersion" testImplementation "junit:junit:$junitVersion" testImplementation 'org.assertj:assertj-core:3.11.1' - testImplementation "org.mockito:mockito-inline:4.10.0" + testImplementation "org.mockito:mockito-inline:4.0.0" testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion" testImplementation "androidx.test:core:$testCoreVersion" - testImplementation "androidx.arch.core:core-testing:2.2.0" + testImplementation "androidx.arch.core:core-testing:2.1.0" testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion" testImplementation "org.conscrypt:conscrypt-openjdk-uber:2.0.0" implementation 'org.greenrobot:eventbus:3.0.0' diff --git a/libsignal/build.gradle b/libsignal/build.gradle index c0e84ccb3..1ea5f2de0 100644 --- a/libsignal/build.gradle +++ b/libsignal/build.gradle @@ -2,7 +2,6 @@ apply plugin: 'com.android.library' apply plugin: 'kotlin-android' android { - namespace "org.session.libsignal" compileSdkVersion androidCompileSdkVersion defaultConfig { @@ -10,8 +9,8 @@ android { } compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } }