Merge remote-tracking branch 'upstream/dev' into closed_groups

# Conflicts:
#	app/src/main/java/org/thoughtcrime/securesms/ApplicationContext.java
#	app/src/main/java/org/thoughtcrime/securesms/MediaGalleryAdapter.java
#	app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt
#	app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VisibleMessageContentView.kt
#	app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/VisibleMessageView.kt
#	app/src/main/java/org/thoughtcrime/securesms/database/SessionContactDatabase.kt
#	app/src/main/java/org/thoughtcrime/securesms/database/helpers/SQLCipherOpenHelper.java
#	app/src/main/res/values/strings.xml
#	libsignal/src/main/java/org/session/libsignal/protos/SignalServiceProtos.java
This commit is contained in:
0x330a
2023-01-25 14:17:22 +11:00
200 changed files with 5228 additions and 7559 deletions

View File

@@ -15,16 +15,16 @@ android {
}
dependencies {
implementation "androidx.annotation:annotation:1.2.0"
implementation "androidx.annotation:annotation:1.5.0"
implementation "com.google.protobuf:protobuf-java:$protobufVersion"
implementation "com.fasterxml.jackson.core:jackson-databind:$jacksonDatabindVersion"
implementation "com.github.oxen-io.session-android-curve-25519:curve25519-java:$curve25519Version"
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
implementation "nl.komponents.kovenant:kovenant:$kovenantVersion"
testImplementation "junit:junit:3.8.2"
testImplementation "junit:junit:$junitVersion"
testImplementation "org.assertj:assertj-core:1.7.1"
testImplementation "org.conscrypt:conscrypt-openjdk-uber:2.0.0"
}

View File

@@ -287,7 +287,9 @@ message ConfigurationMessage {
message MessageRequestResponse {
// @required
required bool isApproved = 1; // Whether the request was approved
required bool isApproved = 1;
optional bytes profileKey = 2;
optional DataMessage.LokiProfile profile = 3;
}
message ReceiptMessage {

View File

@@ -16,8 +16,10 @@ interface LokiAPIDatabaseProtocol {
fun setSwarm(publicKey: String, newValue: Set<Snode>)
fun getLastMessageHashValue(snode: Snode, publicKey: String, namespace: Int): String?
fun setLastMessageHashValue(snode: Snode, publicKey: String, newValue: String, namespace: Int)
fun clearAllLastMessageHashes()
fun getReceivedMessageHashValues(publicKey: String, namespace: Int): Set<String>?
fun setReceivedMessageHashValues(publicKey: String, newValue: Set<String>, namespace: Int)
fun clearReceivedMessageHashValues()
fun getAuthToken(server: String): String?
fun setAuthToken(server: String, newValue: String?)
fun setUserCount(room: String, server: String, newValue: Int)

View File

@@ -12,6 +12,7 @@ import javax.net.ssl.SSLContext
import javax.net.ssl.X509TrustManager
object HTTP {
var isConnectedToNetwork: (() -> Boolean) = { false }
private val seedNodeConnection by lazy {
OkHttpClient().newBuilder()
@@ -64,8 +65,12 @@ object HTTP {
private const val timeout: Long = 120
class HTTPRequestFailedException(val statusCode: Int, val json: Map<*, *>?)
: kotlin.Exception("HTTP request failed with status code $statusCode.")
open class HTTPRequestFailedException(
val statusCode: Int,
val json: Map<*, *>?,
message: String = "HTTP request failed with status code $statusCode"
) : kotlin.Exception(message)
class HTTPNoNetworkException : HTTPRequestFailedException(0, null, "No network connection")
enum class Verb(val rawValue: String) {
GET("GET"), PUT("PUT"), POST("POST"), DELETE("DELETE")
@@ -120,8 +125,11 @@ object HTTP {
response = connection.newCall(request.build()).execute()
} catch (exception: Exception) {
Log.d("Loki", "${verb.rawValue} request to $url failed due to error: ${exception.localizedMessage}.")
if (!isConnectedToNetwork()) { throw HTTPNoNetworkException() }
// Override the actual error so that we can correctly catch failed requests in OnionRequestAPI
throw HTTPRequestFailedException(0, null)
throw HTTPRequestFailedException(0, null, "HTTP request failed due to: ${exception.message}")
}
return when (val statusCode = response.code()) {
200 -> {