Skip to content

Commit

Permalink
Merge branch 'release/1.5.4' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarty committed Oct 25, 2022
2 parents c035dae + cc9b87d commit 9009a45
Show file tree
Hide file tree
Showing 81 changed files with 1,473 additions and 232 deletions.
22 changes: 22 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
Please also refer to the Changelog of Element Android: https://github.com/vector-im/element-android/blob/main/CHANGES.md

Changes in Matrix-SDK v1.5.4 (2022-10-25)
=======================================

Imported from Element 1.5.4. (https://github.com/vector-im/element-android/releases/tag/v1.5.4)

Target API 33.

SDK API changes ⚠️
------------------
- Stop using `original_event` field from `/relations` endpoint ([#7282](https://github.com/vector-im/element-android/issues/7282))
- Add `formattedText` or similar optional parameters in several methods:
* RelationService:
* editTextMessage
* editReply
* replyToMessage
* SendService:
* sendQuotedTextMessage
This allows us to send any HTML formatted text message without needing to rely on automatic Markdown > HTML translation. All these new parameters have a `null` value by default, so previous calls to these API methods remain compatible. ([#7288](https://github.com/vector-im/element-android/issues/7288))
- Add support for `m.login.token` auth during QR code based sign in ([#7358](https://github.com/vector-im/element-android/issues/7358))
- Allow getting the formatted or plain text body of a message for the fun `TimelineEvent.getTextEditableContent()`. ([#7359](https://github.com/vector-im/element-android/issues/7359))


Changes in Matrix-SDK v1.5.2 (2022-10-05)
=======================================

Expand Down
30 changes: 13 additions & 17 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
ext.versions = [

'minSdk' : 21,
'compileSdk' : 32,
'targetSdk' : 32,
'compileSdk' : 33,
'targetSdk' : 33,
'sourceCompat' : JavaVersion.VERSION_11,
'targetCompat' : JavaVersion.VERSION_11,
]

def gradle = "7.2.2"
def gradle = "7.3.1"
// Ref: https://kotlinlang.org/releases.html
def kotlin = "1.7.20"
def kotlinCoroutines = "1.6.4"
def dagger = "2.44"
def appDistribution = "16.0.0-beta04"
def retrofit = "2.9.0"
def arrow = "0.8.2"
def markwon = "4.6.2"
def moshi = "1.14.0"
def lifecycle = "2.5.1"
def flowBinding = "1.2.0"
def flipper = "0.164.0"
def epoxy = "4.6.2"
def mavericks = "2.7.0"
def glide = "4.14.1"
def flipper = "0.171.1"
def epoxy = "5.0.0"
def mavericks = "3.0.1"
def glide = "4.14.2"
def bigImageViewer = "1.8.1"
def jjwt = "0.11.5"
// Temporary version to unblock #6929. Once 0.16.0 is released we should use it, and revert
// the whole commit which set version 0.16.0-SNAPSHOT
def vanniktechEmoji = "0.16.0-SNAPSHOT"

def sentry = "6.4.1"
def sentry = "6.4.3"

def fragment = "1.5.3"

Expand All @@ -51,12 +50,12 @@ ext.libs = [
'coroutinesTest' : "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinCoroutines"
],
androidx : [
'activity' : "androidx.activity:activity:1.5.1",
'activity' : "androidx.activity:activity-ktx:1.6.0",
'appCompat' : "androidx.appcompat:appcompat:1.5.1",
'biometric' : "androidx.biometric:biometric:1.1.0",
'core' : "androidx.core:core-ktx:1.8.0",
'core' : "androidx.core:core-ktx:1.9.0",
'recyclerview' : "androidx.recyclerview:recyclerview:1.2.1",
'exifinterface' : "androidx.exifinterface:exifinterface:1.3.3",
'exifinterface' : "androidx.exifinterface:exifinterface:1.3.4",
'fragmentKtx' : "androidx.fragment:fragment-ktx:$fragment",
'fragmentTesting' : "androidx.fragment:fragment-testing:$fragment",
'constraintLayout' : "androidx.constraintlayout:constraintlayout:2.1.4",
Expand Down Expand Up @@ -87,7 +86,7 @@ ext.libs = [
'appdistributionApi' : "com.google.firebase:firebase-appdistribution-api-ktx:$appDistribution",
'appdistribution' : "com.google.firebase:firebase-appdistribution:$appDistribution",
// Phone number https://github.com/google/libphonenumber
'phonenumber' : "com.googlecode.libphonenumber:libphonenumber:8.12.56"
'phonenumber' : "com.googlecode.libphonenumber:libphonenumber:8.12.57"
],
dagger : [
'dagger' : "com.google.dagger:dagger:$dagger",
Expand All @@ -102,6 +101,7 @@ ext.libs = [
],
element : [
'opusencoder' : "io.element.android:opusencoder:1.1.0",
'wysiwyg' : "io.element.android:wysiwyg:0.2.1"
],
squareup : [
'moshi' : "com.squareup.moshi:moshi:$moshi",
Expand All @@ -114,10 +114,6 @@ ext.libs = [
rx : [
'rxKotlin' : "io.reactivex.rxjava2:rxkotlin:2.4.0"
],
arrow : [
'core' : "io.arrow-kt:arrow-core:$arrow",
'instances' : "io.arrow-kt:arrow-instances-core:$arrow"
],
markwon : [
'core' : "io.noties.markwon:core:$markwon",
'extLatex' : "io.noties.markwon:ext-latex:$markwon",
Expand Down
5 changes: 4 additions & 1 deletion dependencies_groups.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ ext.groups = [
'com.google',
'com.google.android',
'com.google.api.grpc',
'com.google.auto',
'com.google.auto.service',
'com.google.auto.value',
'com.google.code.findbugs',
Expand All @@ -101,6 +102,7 @@ ext.groups = [
'com.googlecode.json-simple',
'com.googlecode.libphonenumber',
'com.ibm.icu',
'com.intellij',
'com.jakewharton.android.repackaged',
'com.jakewharton.timber',
'com.kgurgul.flipper',
Expand Down Expand Up @@ -132,7 +134,6 @@ ext.groups = [
'commons-io',
'commons-logging',
'info.picocli',
'io.arrow-kt',
'io.element.android',
'io.github.davidburstrom.contester',
'io.github.detekt.sarif4k',
Expand All @@ -146,6 +147,7 @@ ext.groups = [
'io.netty',
'io.noties.markwon',
'io.opencensus',
'io.perfmark',
'io.reactivex.rxjava2',
'io.realm',
'io.sentry',
Expand Down Expand Up @@ -176,6 +178,7 @@ ext.groups = [
'org.apache.httpcomponents',
'org.apache.sanselan',
'org.bouncycastle',
'org.ccil.cowan.tagsoup',
'org.checkerframework',
'org.codehaus',
'org.codehaus.groovy',
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ vector.httpLogLevel=NONE
# Ref: https://github.com/vanniktech/gradle-maven-publish-plugin
GROUP=org.matrix.android
POM_ARTIFACT_ID=matrix-android-sdk2
VERSION_NAME=1.5.2
VERSION_NAME=1.5.4

POM_PACKAGING=aar

Expand Down
2 changes: 2 additions & 0 deletions matrix-sdk-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ dokkaHtml {
}

android {
namespace "org.matrix.android.sdk"

testOptions.unitTests.includeAndroidResources = true

compileSdk versions.compileSdk
Expand Down
3 changes: 1 addition & 2 deletions matrix-sdk-android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.matrix.android.sdk">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 2022 The Matrix.org Foundation C.I.C.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.matrix.android.sdk.api.account

import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

@JsonClass(generateAdapter = true)
data class LocalNotificationSettingsContent(
@Json(name = "is_silenced") val isSilenced: Boolean = false
)
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,24 @@ interface AuthenticationService {
initialDeviceName: String,
deviceId: String? = null
): Session

/**
* @param homeServerConnectionConfig the information about the homeserver and other configuration
* Return true if qr code login is supported by the server, false otherwise.
*/
suspend fun isQrLoginSupported(homeServerConnectionConfig: HomeServerConnectionConfig): Boolean

/**
* Authenticate using m.login.token method during sign in with QR code.
* @param homeServerConnectionConfig the information about the homeserver and other configuration
* @param loginToken the m.login.token
* @param initialDeviceName the initial device name
* @param deviceId the device id, optional. If not provided or null, the server will generate one.
*/
suspend fun loginUsingQrLoginToken(
homeServerConnectionConfig: HomeServerConnectionConfig,
loginToken: String,
initialDeviceName: String? = null,
deviceId: String? = null
): Session
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ enum class LoginType {
UNSUPPORTED,
CUSTOM,
DIRECT,
UNKNOWN;
UNKNOWN,
QR;

companion object {

Expand All @@ -32,6 +33,7 @@ enum class LoginType {
UNSUPPORTED.name -> UNSUPPORTED
CUSTOM.name -> CUSTOM
DIRECT.name -> DIRECT
QR.name -> QR
else -> UNKNOWN
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ object UserAccountDataTypes {
const val TYPE_IDENTITY_SERVER = "m.identity_server"
const val TYPE_ACCEPTED_TERMS = "m.accepted_terms"
const val TYPE_OVERRIDE_COLORS = "im.vector.setting.override_colors"
const val TYPE_LOCAL_NOTIFICATION_SETTINGS = "org.matrix.msc3890.local_notification_settings."
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import org.matrix.android.sdk.api.session.room.model.message.MessageContent
import org.matrix.android.sdk.api.session.room.model.message.MessagePollContent
import org.matrix.android.sdk.api.session.room.model.message.MessageStickerContent
import org.matrix.android.sdk.api.session.room.model.message.MessageType
import org.matrix.android.sdk.api.session.room.model.message.asMessageAudioEvent
import org.matrix.android.sdk.api.session.room.model.relation.RelationDefaultContent
import org.matrix.android.sdk.api.session.room.model.relation.shouldRenderInThread
import org.matrix.android.sdk.api.session.room.send.SendState
Expand Down Expand Up @@ -357,6 +358,10 @@ fun Event.isAudioMessage(): Boolean {
}
}

fun Event.isVoiceMessage(): Boolean {
return this.asMessageAudioEvent()?.content?.voiceMessageIndicator != null
}

fun Event.isFileMessage(): Boolean {
return when (getMsgType()) {
MessageType.MSGTYPE_FILE -> true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ data class HomeServerCapabilities(
/**
* True if the home server supports controlling the logout of all devices when changing password.
*/
val canControlLogoutDevices: Boolean = false
val canControlLogoutDevices: Boolean = false,

/**
* True if the home server supports login via qr code, false otherwise.
*/
val canLoginWithQrCode: Boolean = false,
) {

enum class RoomCapabilitySupport {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ data class HttpPusher(
*/
val url: String,

/**
* Whether the pusher should actively create push notifications.
*/
val enabled: Boolean,

/**
* The device ID of the session that registered the pusher.
*/
val deviceId: String,

/**
* If true, the homeserver should add another pusher with the given pushkey and App ID in addition
* to any others with different user IDs. Otherwise, the homeserver must remove any other pushers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ data class Pusher(
val profileTag: String? = null,
val lang: String?,
val data: PusherData,

val state: PusherState
val enabled: Boolean,
val deviceId: String?,
val state: PusherState,
) {
companion object {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ interface PushersService {
append: Boolean = true
)

/**
* Enables or disables a registered pusher.
*
* @param pusher The pusher being toggled
* @param enable Whether the pusher should be enabled or disabled
*/
suspend fun togglePusher(pusher: Pusher, enable: Boolean)

/**
* Directly ask the push gateway to send a push to this device.
* If successful, the push gateway has accepted the request. In this case, the app should receive a Push with the provided eventId.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright 2022 The Matrix.org Foundation C.I.C.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.matrix.android.sdk.api.session.room.model.message

import org.matrix.android.sdk.api.extensions.tryOrNull
import org.matrix.android.sdk.api.session.events.model.Event
import org.matrix.android.sdk.api.session.events.model.EventType
import org.matrix.android.sdk.api.session.events.model.toModel

/**
* [Event] wrapper for [EventType.MESSAGE] event type.
* Provides additional fields and functions related to this event type.
*/
@JvmInline
value class MessageAudioEvent(val root: Event) {

/**
* The mapped [MessageAudioContent] model of the event content.
*/
val content: MessageAudioContent
get() = root.getClearContent().toModel<MessageContent>() as MessageAudioContent

init {
require(tryOrNull { content } != null)
}
}

/**
* Map a [EventType.MESSAGE] event to a [MessageAudioEvent].
*/
fun Event.asMessageAudioEvent() = if (getClearType() == EventType.MESSAGE) {
tryOrNull { MessageAudioEvent(this) }
} else null
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,7 @@ object MessageType {
// Fake message types for live location events to be able to inherit them from MessageContent
const val MSGTYPE_BEACON_INFO = "org.matrix.android.sdk.beacon.info"
const val MSGTYPE_BEACON_LOCATION_DATA = "org.matrix.android.sdk.beacon.location.data"

// Fake message types for voice broadcast events to be able to inherit them from MessageContent
const val MSGTYPE_VOICE_BROADCAST_INFO = "io.element.voicebroadcast.info"
}
Loading

0 comments on commit 9009a45

Please sign in to comment.