Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:vector-im/element-x-android into…
Browse files Browse the repository at this point in the history
… jonny/vm-analytics
  • Loading branch information
jonnyandrew committed Nov 1, 2023
2 parents 8fcb9a5 + a73cd8a commit d1898de
Show file tree
Hide file tree
Showing 191 changed files with 2,053 additions and 316 deletions.
25 changes: 25 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
Changes in Element X v0.3.0 (2023-10-31)
========================================

Features ✨
----------
- Element Call: change the 'join call' button in a chat room when there's an active call. ([#1158](https://github.com/vector-im/element-x-android/issues/1158))
- Mentions: add mentions suggestion view in RTE ([#1452](https://github.com/vector-im/element-x-android/issues/1452))
- Record and send voice messages ([#1596](https://github.com/vector-im/element-x-android/issues/1596))
- Enable voice messages for all users ([#1669](https://github.com/vector-im/element-x-android/issues/1669))
- Receive and play a voice message ([#2084](https://github.com/vector-im/element-x-android/issues/2084))
- Enable Element Call integration in rooms by default, fix several issues when creating or joining calls.

Bugfixes 🐛
----------
- Group fallback notification to avoid having plenty of them displayed. ([#994](https://github.com/vector-im/element-x-android/issues/994))
- Hide keyboard when exiting the chat room screen. ([#1375](https://github.com/vector-im/element-x-android/issues/1375))
- Always register the pusher when application starts ([#1481](https://github.com/vector-im/element-x-android/issues/1481))
- Ensure screen does not turn off when playing a video ([#1519](https://github.com/vector-im/element-x-android/issues/1519))
- Fix issue where text is cleared when cancelling a reply ([#1617](https://github.com/vector-im/element-x-android/issues/1617))

Other changes
-------------
- Remove usage of blocking methods. ([#1563](https://github.com/vector-im/element-x-android/issues/1563))


Changes in Element X v0.2.4 (2023-10-12)
========================================

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/kotlin/io/element/android/x/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import androidx.compose.ui.platform.LocalUriHandler
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.WindowCompat
import com.bumble.appyx.core.integration.NodeHost
import com.bumble.appyx.core.integrationpoint.NodeComponentActivity
import com.bumble.appyx.core.integrationpoint.NodeActivity
import com.bumble.appyx.core.plugin.NodeReadyObserver
import io.element.android.libraries.architecture.bindings
import io.element.android.libraries.core.log.logger.LoggerTag
Expand All @@ -42,7 +42,7 @@ import timber.log.Timber

private val loggerTag = LoggerTag("MainActivity")

class MainActivity : NodeComponentActivity() {
class MainActivity : NodeActivity() {

private lateinit var mainNode: MainNode

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
<item name="postSplashScreenTheme">@style/Theme.ElementX</item>
</style>

<style name="Theme.ElementX" parent="Theme.Material3.Dark" />
<style name="Theme.ElementX" parent="Theme.Material3.Dark.NoActionBar" />
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
<item name="windowSplashScreenAnimatedIcon">@drawable/transparent</item>
<item name="postSplashScreenTheme">@style/Theme.ElementX</item>
</style>
<style name="Theme.ElementX" parent="Theme.Material3.Light" />
<style name="Theme.ElementX" parent="Theme.Material3.Light.NoActionBar" />
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import com.squareup.anvil.annotations.ContributesTo
import dagger.Module
import dagger.Provides
import io.element.android.libraries.di.AppScope
import kotlin.time.Duration
import kotlin.time.Duration.Companion.seconds

/**
* Configuration for the lock screen feature.
Expand Down Expand Up @@ -48,7 +50,16 @@ data class LockScreenConfig(
/**
* Time period before locking the app once backgrounded.
*/
val gracePeriodInMillis: Long
val gracePeriod: Duration,

/**
* Authentication with strong methods (fingerprint, some face/iris unlock implementations) is supported.
*/
val isStrongBiometricsEnabled: Boolean,
/**
* Authentication with weak methods (most face/iris unlock implementations) is supported.
*/
val isWeakBiometricsEnabled: Boolean,
)

@ContributesTo(AppScope::class)
Expand All @@ -61,6 +72,8 @@ object LockScreenConfigModule {
pinBlacklist = setOf("0000", "1234"),
pinSize = 4,
maxPinCodeAttemptsBeforeLogout = 3,
gracePeriodInMillis = 90_000L
gracePeriod = 90.seconds,
isStrongBiometricsEnabled = true,
isWeakBiometricsEnabled = true,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class MatrixClientsHolder @Inject constructor(private val authenticationService:
sessionIdsToMatrixClient.remove(sessionId)
}

fun getOrNull(sessionId: SessionId): MatrixClient? {
override fun getOrNull(sessionId: SessionId): MatrixClient? {
return sessionIdsToMatrixClient[sessionId]
}

Expand Down
1 change: 0 additions & 1 deletion changelog.d/+enable-element-call.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/1158.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/1375.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/1452.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/1481.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/1519.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/1563.misc

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/1596.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/1617.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/1669.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/2084.feature

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/994.bugfix

This file was deleted.

2 changes: 2 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/40003000.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Main changes in this version: TODO.
Full changelog: https://github.com/vector-im/element-x-android/releases
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package io.element.android.features.call.ui

import io.element.android.features.call.utils.WidgetMessageInterceptor

sealed interface CallScreeEvents {
data object Hangup : CallScreeEvents
data class SetupMessageChannels(val widgetMessageInterceptor: WidgetMessageInterceptor) : CallScreeEvents
sealed interface CallScreenEvents {
data object Hangup : CallScreenEvents
data class SetupMessageChannels(val widgetMessageInterceptor: WidgetMessageInterceptor) : CallScreenEvents
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package io.element.android.features.call.ui

import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.getValue
Expand All @@ -37,10 +38,13 @@ import io.element.android.libraries.architecture.Async
import io.element.android.libraries.architecture.Presenter
import io.element.android.libraries.architecture.runCatchingUpdatingState
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
import io.element.android.libraries.matrix.api.MatrixClientProvider
import io.element.android.libraries.matrix.api.sync.SyncState
import io.element.android.libraries.matrix.api.widget.MatrixWidgetDriver
import io.element.android.libraries.network.useragent.UserAgentProvider
import io.element.android.services.toolbox.api.systemclock.SystemClock
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
Expand All @@ -53,9 +57,11 @@ class CallScreenPresenter @AssistedInject constructor(
@Assisted private val callType: CallType,
@Assisted private val navigator: CallScreenNavigator,
private val callWidgetProvider: CallWidgetProvider,
private val userAgentProvider: UserAgentProvider,
userAgentProvider: UserAgentProvider,
private val clock: SystemClock,
private val dispatchers: CoroutineDispatchers,
private val matrixClientsProvider: MatrixClientProvider,
private val appCoroutineScope: CoroutineScope,
) : Presenter<CallScreenState> {

@AssistedFactory
Expand All @@ -78,6 +84,8 @@ class CallScreenPresenter @AssistedInject constructor(
loadUrl(callType, urlState, callWidgetDriver)
}

HandleMatrixClientSyncState()

callWidgetDriver.value?.let { driver ->
LaunchedEffect(Unit) {
driver.incomingMessages
Expand Down Expand Up @@ -115,21 +123,22 @@ class CallScreenPresenter @AssistedInject constructor(
}
}

fun handleEvents(event: CallScreeEvents) {
fun handleEvents(event: CallScreenEvents) {
when (event) {
is CallScreeEvents.Hangup -> {
is CallScreenEvents.Hangup -> {
val widgetId = callWidgetDriver.value?.id
val interceptor = messageInterceptor.value
if (widgetId != null && interceptor != null && isJoinedCall) {
// If the call was joined, we need to hang up first. Then the UI will be dismissed automatically.
sendHangupMessage(widgetId, interceptor)
isJoinedCall = false
} else {
coroutineScope.launch {
close(callWidgetDriver.value, navigator)
}
}
}
is CallScreeEvents.SetupMessageChannels -> {
is CallScreenEvents.SetupMessageChannels -> {
messageInterceptor.value = event.widgetMessageInterceptor
}
}
Expand Down Expand Up @@ -166,6 +175,36 @@ class CallScreenPresenter @AssistedInject constructor(
}
}

@Composable
private fun HandleMatrixClientSyncState() {
val coroutineScope = rememberCoroutineScope()
DisposableEffect(Unit) {
val client = (callType as? CallType.RoomCall)?.sessionId?.let {
matrixClientsProvider.getOrNull(it)
} ?: return@DisposableEffect onDispose { }

coroutineScope.launch {
client.syncService().syncState
.onEach { state ->
if (state != SyncState.Running) {
client.syncService().startSync()
}
}
.collect()
}
onDispose {
// We can't use the local coroutine scope here because it will be disposed before this effect
appCoroutineScope.launch {
client.syncService().run {
if (syncState.value == SyncState.Running) {
stopSync()
}
}
}
}
}
}

private fun parseMessage(message: String): WidgetMessage? {
return WidgetMessageSerializer.deserialize(message).getOrNull()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ data class CallScreenState(
val urlState: Async<String>,
val userAgent: String,
val isInWidgetMode: Boolean,
val eventSink: (CallScreeEvents) -> Unit,
val eventSink: (CallScreenEvents) -> Unit,
)
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ internal fun CallScreenView(
navigationIcon = {
BackButton(
resourceId = CommonDrawables.ic_compound_close,
onClick = { state.eventSink(CallScreeEvents.Hangup) }
onClick = { state.eventSink(CallScreenEvents.Hangup) }
)
}
)
}
) { padding ->
BackHandler {
state.eventSink(CallScreeEvents.Hangup)
state.eventSink(CallScreenEvents.Hangup)
}
CallWebView(
modifier = Modifier
Expand All @@ -88,7 +88,7 @@ internal fun CallScreenView(
},
onWebViewCreated = { webView ->
val interceptor = WebViewWidgetMessageInterceptor(webView)
state.eventSink(CallScreeEvents.SetupMessageChannels(interceptor))
state.eventSink(CallScreenEvents.SetupMessageChannels(interceptor))
}
)
}
Expand Down
Loading

0 comments on commit d1898de

Please sign in to comment.