diff --git a/app/build.gradle b/app/build.gradle index 40ef1e7ef..56f2a4ce1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -31,8 +31,8 @@ configurations.all { exclude module: "commons-logging" } -def canonicalVersionCode = 355 -def canonicalVersionName = "1.17.1" +def canonicalVersionCode = 359 +def canonicalVersionName = "1.17.4" def postFixSize = 10 def abiPostFix = ['armeabi-v7a' : 1, @@ -284,7 +284,7 @@ dependencies { implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinxJsonVersion" implementation "com.github.oxen-io.session-android-curve-25519:curve25519-java:$curve25519Version" implementation project(":liblazysodium") - implementation "net.java.dev.jna:jna:5.8.0@aar" + implementation "net.java.dev.jna:jna:5.12.1@aar" implementation "com.google.protobuf:protobuf-java:$protobufVersion" implementation "com.fasterxml.jackson.core:jackson-databind:$jacksonDatabindVersion" implementation "com.squareup.okhttp3:okhttp:$okhttpVersion" @@ -336,14 +336,14 @@ dependencies { testImplementation 'org.robolectric:shadows-multidex:4.4' implementation 'com.github.bumptech.glide:compose:1.0.0-alpha.5' - implementation 'androidx.compose.ui:ui:1.5.1' - implementation 'androidx.compose.ui:ui-tooling:1.5.1' + implementation 'androidx.compose.ui:ui:1.5.2' + implementation 'androidx.compose.ui:ui-tooling:1.5.2' implementation "com.google.accompanist:accompanist-themeadapter-appcompat:0.33.1-alpha" implementation "com.google.accompanist:accompanist-pager-indicators:0.33.1-alpha" - implementation "androidx.compose.runtime:runtime-livedata:1.5.1" + implementation "androidx.compose.runtime:runtime-livedata:1.5.2" - implementation 'androidx.compose.foundation:foundation-layout:1.6.0-alpha06' - implementation 'androidx.compose.material:material:1.6.0-alpha06' + implementation 'androidx.compose.foundation:foundation-layout:1.5.2' + implementation 'androidx.compose.material:material:1.5.2' } static def getLastCommitTimestamp() { diff --git a/app/src/androidTest/java/network/loki/messenger/HomeActivityTests.kt b/app/src/androidTest/java/network/loki/messenger/HomeActivityTests.kt index eabe06f7d..a20a3a2a6 100644 --- a/app/src/androidTest/java/network/loki/messenger/HomeActivityTests.kt +++ b/app/src/androidTest/java/network/loki/messenger/HomeActivityTests.kt @@ -158,6 +158,7 @@ class HomeActivityTests { val dialogPromptText = InstrumentationRegistry.getInstrumentation().targetContext.getString(R.string.dialog_open_url_explanation, amazonPuny) + onView(isRoot()).perform(waitFor(1000)) // no other way for this to work apparently onView(withText(dialogPromptText)).check(matches(isDisplayed())) } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c8eacf463..608069604 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -34,6 +34,8 @@ + + @@ -314,11 +316,15 @@ android:value="org.thoughtcrime.securesms.home.HomeActivity" /> + android:exported="false" android:foregroundServiceType="specialUse"> + + + = 0 ? restartItem : data.second; - mediaPager.setCurrentItem(item); + if (restartItem >= 0 || data.second >= 0) { + int item = restartItem >= 0 ? restartItem : data.second; + mediaPager.setCurrentItem(item); - if (item == 0) { - viewPagerListener.onPageSelected(0); + if (item == 0) { + viewPagerListener.onPageSelected(0); + } + } else { + Log.w(TAG, "one of restartItem "+restartItem+" and data.second "+data.second+" would cause OOB exception"); } } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/PassphraseRequiredActionBarActivity.java b/app/src/main/java/org/thoughtcrime/securesms/PassphraseRequiredActionBarActivity.java index a791d77a5..bf2aba63f 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/PassphraseRequiredActionBarActivity.java +++ b/app/src/main/java/org/thoughtcrime/securesms/PassphraseRequiredActionBarActivity.java @@ -9,13 +9,14 @@ import android.os.Bundle; import androidx.annotation.IdRes; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; +import org.session.libsession.utilities.TextSecurePreferences; import org.session.libsignal.utilities.Log; import org.thoughtcrime.securesms.home.HomeActivity; import org.thoughtcrime.securesms.onboarding.LandingActivity; import org.thoughtcrime.securesms.service.KeyCachingService; -import org.session.libsession.utilities.TextSecurePreferences; import java.util.Locale; @@ -168,7 +169,13 @@ public abstract class PassphraseRequiredActionBarActivity extends BaseActionBarA }; IntentFilter filter = new IntentFilter(KeyCachingService.CLEAR_KEY_EVENT); - registerReceiver(clearKeyReceiver, filter, KeyCachingService.KEY_PERMISSION, null); + ContextCompat.registerReceiver( + this, + clearKeyReceiver, filter, + KeyCachingService.KEY_PERMISSION, + null, + ContextCompat.RECEIVER_NOT_EXPORTED + ); } private void removeClearKeyReceiver(Context context) { diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/SessionJobDatabase.kt b/app/src/main/java/org/thoughtcrime/securesms/database/SessionJobDatabase.kt index 6221446aa..591755b88 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/SessionJobDatabase.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/database/SessionJobDatabase.kt @@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.database import android.content.ContentValues import android.content.Context import android.database.Cursor +import org.session.libsession.messaging.jobs.AttachmentDownloadJob import org.session.libsession.messaging.jobs.AttachmentUploadJob import org.session.libsession.messaging.jobs.BackgroundGroupAddJob import org.session.libsession.messaging.jobs.GroupAvatarDownloadJob @@ -26,6 +27,9 @@ class SessionJobDatabase(context: Context, helper: SQLCipherOpenHelper) : Databa const val serializedData = "serialized_data" @JvmStatic val createSessionJobTableCommand = "CREATE TABLE $sessionJobTable ($jobID INTEGER PRIMARY KEY, $jobType STRING, $failureCount INTEGER DEFAULT 0, $serializedData TEXT);" + + const val dropAttachmentDownloadJobs = + "DELETE FROM $sessionJobTable WHERE $jobType = '${AttachmentDownloadJob.KEY}';" } fun persistJob(job: Job) { 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 0928fc598..17fed47aa 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 @@ -90,9 +90,10 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper { private static final int lokiV42 = 63; private static final int lokiV43 = 64; private static final int lokiV44 = 65; + private static final int lokiV45 = 66; // Loki - onUpgrade(...) must be updated to use Loki version numbers if Signal makes any database changes - private static final int DATABASE_VERSION = lokiV44; + private static final int DATABASE_VERSION = lokiV45; private static final int MIN_DATABASE_VERSION = lokiV7; private static final String CIPHER3_DATABASE_NAME = "signal.db"; public static final String DATABASE_NAME = "signal_v4.db"; @@ -609,6 +610,10 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper { } if (oldVersion < lokiV44) { + db.execSQL(SessionJobDatabase.dropAttachmentDownloadJobs); + } + + if (oldVersion < lokiV45) { db.execSQL(RecipientDatabase.getCreateAutoDownloadCommand()); db.execSQL(RecipientDatabase.getUpdateAutoDownloadValuesCommand()); } diff --git a/app/src/main/java/org/thoughtcrime/securesms/service/KeyCachingService.java b/app/src/main/java/org/thoughtcrime/securesms/service/KeyCachingService.java index 402c0f652..f919af7ad 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/service/KeyCachingService.java +++ b/app/src/main/java/org/thoughtcrime/securesms/service/KeyCachingService.java @@ -25,8 +25,10 @@ import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; +import android.content.pm.ServiceInfo; import android.os.AsyncTask; import android.os.Binder; +import android.os.Build; import android.os.IBinder; import android.os.SystemClock; @@ -250,7 +252,11 @@ public class KeyCachingService extends Service { builder.setContentIntent(buildLaunchIntent()); stopForeground(true); - startForeground(SERVICE_RUNNING_ID, builder.build()); + if (Build.VERSION.SDK_INT >= 34) { + startForeground(SERVICE_RUNNING_ID, builder.build(), ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE); + } else { + startForeground(SERVICE_RUNNING_ID, builder.build()); + } } private PendingIntent buildLockIntent() { diff --git a/build.gradle b/build.gradle index 46c7d0664..9ac76c9d0 100644 --- a/build.gradle +++ b/build.gradle @@ -53,12 +53,6 @@ allprojects { includeGroupByRegex "org\\.signal.*" } } - maven { - url "https://repo1.maven.org/maven2/com/goterl/lazysodium-android" - content { - includeGroupByRegex "com\\.goterl.*" - } - } jcenter() maven { url "https://jitpack.io" } if (project.hasProperty('huawei')) maven { diff --git a/liblazysodium/build.gradle b/liblazysodium/build.gradle index 10f52943d..e53c7ca01 100644 --- a/liblazysodium/build.gradle +++ b/liblazysodium/build.gradle @@ -1,2 +1,2 @@ configurations.maybeCreate("default") -artifacts.add("default", file('lazysodium.aar')) \ No newline at end of file +artifacts.add("default", file('session-lazysodium-android.aar')) \ No newline at end of file diff --git a/liblazysodium/lazysodium.aar b/liblazysodium/lazysodium.aar deleted file mode 100644 index 4227d956e..000000000 Binary files a/liblazysodium/lazysodium.aar and /dev/null differ diff --git a/liblazysodium/session-lazysodium-android.aar b/liblazysodium/session-lazysodium-android.aar new file mode 100644 index 000000000..aadcac7aa Binary files /dev/null and b/liblazysodium/session-lazysodium-android.aar differ diff --git a/libsession-util/build.gradle b/libsession-util/build.gradle index e4f9ed56f..935227185 100644 --- a/libsession-util/build.gradle +++ b/libsession-util/build.gradle @@ -42,6 +42,6 @@ dependencies { testImplementation 'junit:junit:4.13.2' 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 3cfb66cd3..44ed7533e 100644 --- a/libsession/build.gradle +++ b/libsession/build.gradle @@ -21,7 +21,7 @@ dependencies { implementation project(":libsignal") implementation project(":libsession-util") implementation project(":liblazysodium") - implementation "net.java.dev.jna:jna:5.8.0@aar" + implementation "net.java.dev.jna:jna:5.12.1@aar" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion" implementation "androidx.core:core-ktx:$coreVersion" implementation "androidx.appcompat:appcompat:$appcompatVersion" @@ -29,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' diff --git a/libsession/src/main/java/org/session/libsession/messaging/jobs/AttachmentDownloadJob.kt b/libsession/src/main/java/org/session/libsession/messaging/jobs/AttachmentDownloadJob.kt index d3c956ce9..6aae0c6c9 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/jobs/AttachmentDownloadJob.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/jobs/AttachmentDownloadJob.kt @@ -35,7 +35,7 @@ class AttachmentDownloadJob(val attachmentID: Long, val databaseMessageID: Long) override val maxFailureCount: Int = 2 companion object { - val KEY: String = "AttachmentDownloadJob" + const val KEY: String = "AttachmentDownloadJob" // Keys used for database storage private val ATTACHMENT_ID_KEY = "attachment_id" @@ -100,10 +100,10 @@ class AttachmentDownloadJob(val attachmentID: Long, val databaseMessageID: Long) handleFailure(Error.NoSender, null) return } - - if (!storage.shouldAutoDownloadAttachments(threadRecipient)) { + if (!threadRecipient.isGroupRecipient && contact?.isTrusted != true && storage.getUserPublicKey() != sender) { // if we aren't receiving a group message, a message from ourselves (self-send) and the contact sending is not trusted: // do not continue, but do not fail + handleFailure(Error.NoSender, null) return } diff --git a/libsignal/build.gradle b/libsignal/build.gradle index 1ea5f2de0..5ac0d0b4f 100644 --- a/libsignal/build.gradle +++ b/libsignal/build.gradle @@ -25,6 +25,6 @@ dependencies { implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion" implementation "nl.komponents.kovenant:kovenant:$kovenantVersion" testImplementation "junit:junit:$junitVersion" - testImplementation "org.assertj:assertj-core:1.7.1" + testImplementation "org.assertj:assertj-core:3.11.1" testImplementation "org.conscrypt:conscrypt-openjdk-uber:2.0.0" }