Skip to content

Commit

Permalink
Merge tag 'v0.4.14'
Browse files Browse the repository at this point in the history
Change-Id: I896138a45041e6943cb46cbef85714e004b3996e

Conflicts:
	app/src/main/kotlin/io/element/android/x/ElementXApplication.kt
	features/call/src/main/kotlin/io/element/android/features/call/ui/ElementCallActivity.kt
	features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesNavigator.kt
	features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesNode.kt
	features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/MessagesView.kt
	features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/actionlist/ActionListView.kt
	features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/TimelineView.kt
	features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/TimelineItemEventRow.kt
	features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/TimelineItemStateEventRow.kt
	features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/customreaction/CustomReactionBottomSheet.kt
	features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/customreaction/EmojiPicker.kt
	features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemEventContentView.kt
	features/messages/impl/src/main/kotlin/io/element/android/features/messages/impl/timeline/components/event/TimelineItemTextView.kt
	features/preferences/impl/src/main/kotlin/io/element/android/features/preferences/impl/root/PreferencesRootNode.kt
	features/rageshake/impl/src/main/kotlin/io/element/android/features/rageshake/impl/reporter/DefaultBugReporter.kt
	gradle/libs.versions.toml
	libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/RustMatrixClient.kt
	libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/RoomGroupMessageCreator.kt
	libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/notifications/factories/NotificationCreator.kt
	libraries/push/impl/src/main/kotlin/io/element/android/libraries/push/impl/push/DefaultPushHandler.kt
	libraries/pushproviders/unifiedpush/src/main/kotlin/io/element/android/libraries/pushproviders/unifiedpush/UnifiedPushNewGatewayHandler.kt
	settings.gradle.kts
	upstream_infra/fastlane/metadata/android/en-US/changelogs/40004140.txt
  • Loading branch information
SpiritCroc committed Jun 7, 2024
2 parents b047601 + 2f27ba7 commit 00c77e5
Show file tree
Hide file tree
Showing 2,911 changed files with 21,861 additions and 11,624 deletions.
2 changes: 2 additions & 0 deletions .idea/dictionaries/shared.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .maestro/tests/account/login.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
appId: ${MAESTRO_APP_ID}
---
- tapOn: "Continue"
- tapOn: "Sign in manually"
- runFlow: ../assertions/assertLoginDisplayed.yaml
- takeScreenshot: build/maestro/100-SignIn
- runFlow: changeServer.yaml
Expand Down
2 changes: 1 addition & 1 deletion .maestro/tests/account/verifySession.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ appId: ${MAESTRO_APP_ID}
- tapOn: "Continue"
- extendedWaitUntil:
visible: "Device verified"
timeout: 10000
timeout: 30000
- tapOn: "Continue"
24 changes: 24 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,30 @@
</intent-filter>
</activity>

<!-- Using an activity-alias for incoming share intent, in order
to be able to disable the feature programmatically -->
<activity-alias
android:name=".ShareActivity"
android:exported="true"
android:targetActivity=".MainActivity">
<!-- Incoming share simple -->
<intent-filter>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="*/*" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.OPENABLE" />
</intent-filter>
<!-- Incoming share multiple -->
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<data android:mimeType="*/*" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.OPENABLE" />
</intent-filter>
</activity-alias>

<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ class ElementXApplication : Application(), DaggerComponentOwner {
initializeComponent(TracingInitializer::class.java)
initializeComponent(CacheCleanerInitializer::class.java)
}
logApplicationInfo()
// SC
EmojiCompat.init(BundledEmojiCompatConfig(this))
EmojiCompat.init(BundledEmojiCompatConfig(this)) // SC
logApplicationInfo(this)
}
}
7 changes: 3 additions & 4 deletions app/src/main/kotlin/io/element/android/x/di/AppModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ import dagger.Provides
import io.element.android.appconfig.ApplicationConfig
import io.element.android.features.messages.impl.timeline.components.customreaction.DefaultEmojibaseProvider
import io.element.android.features.messages.impl.timeline.components.customreaction.EmojibaseProvider
import io.element.android.libraries.androidutils.system.getVersionCodeFromManifest
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
import io.element.android.libraries.core.meta.BuildMeta
import io.element.android.libraries.core.meta.BuildType
import io.element.android.libraries.designsystem.utils.snackbar.SnackbarDispatcher
import io.element.android.libraries.di.AppScope
import io.element.android.libraries.di.ApplicationContext
import io.element.android.libraries.di.CacheDirectory
import io.element.android.libraries.di.DefaultPreferences
import io.element.android.libraries.di.SingleIn
import io.element.android.x.BuildConfig
import io.element.android.x.R
Expand Down Expand Up @@ -92,7 +92,7 @@ object AppModule {
// TODO EAx Config.LOW_PRIVACY_LOG_ENABLE,
lowPrivacyLoggingEnabled = false,
versionName = BuildConfig.VERSION_NAME,
versionCode = BuildConfig.VERSION_CODE,
versionCode = context.getVersionCodeFromManifest(),
gitRevision = BuildConfig.GIT_REVISION,
gitBranchName = BuildConfig.GIT_BRANCH_NAME,
flavorDescription = BuildConfig.FLAVOR_DESCRIPTION,
Expand All @@ -101,8 +101,7 @@ object AppModule {

@Provides
@SingleIn(AppScope::class)
@DefaultPreferences
fun providesDefaultSharedPreferences(@ApplicationContext context: Context): SharedPreferences {
fun providesSharedPreferences(@ApplicationContext context: Context): SharedPreferences {
return PreferenceManager.getDefaultSharedPreferences(context)
}

Expand Down
6 changes: 4 additions & 2 deletions app/src/main/kotlin/io/element/android/x/info/Logs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@

package io.element.android.x.info

import android.content.Context
import io.element.android.libraries.androidutils.system.getVersionCodeFromManifest
import io.element.android.x.BuildConfig
import timber.log.Timber
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale

fun logApplicationInfo() {
fun logApplicationInfo(context: Context) {
val appVersion = buildString {
append(BuildConfig.VERSION_NAME)
append(" (")
append(BuildConfig.VERSION_CODE)
append(context.getVersionCodeFromManifest())
append(") - ")
append(BuildConfig.BUILD_TYPE)
append(" / ")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import android.content.Context
import android.system.Os
import androidx.preference.PreferenceManager
import androidx.startup.Initializer
import io.element.android.features.preferences.impl.developer.tracing.SharedPrefTracingConfigurationStore
import io.element.android.features.preferences.impl.developer.tracing.SharedPreferencesTracingConfigurationStore
import io.element.android.features.preferences.impl.developer.tracing.TargetLogLevelMapBuilder
import io.element.android.libraries.architecture.bindings
import io.element.android.libraries.matrix.api.tracing.TracingConfiguration
Expand All @@ -38,7 +38,7 @@ class TracingInitializer : Initializer<Unit> {
Timber.plant(tracingService.createTimberTree())
val tracingConfiguration = if (BuildConfig.DEBUG) {
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
val store = SharedPrefTracingConfigurationStore(prefs)
val store = SharedPreferencesTracingConfigurationStore(prefs)
val builder = TargetLogLevelMapBuilder(store)
TracingConfiguration(
filterConfiguration = TracingFilterConfigurations.custom(builder.getCurrentMap()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import io.element.android.x.MainActivity
import javax.inject.Inject

@ContributesBinding(AppScope::class)
class IntentProviderImpl @Inject constructor(
class DefaultIntentProvider @Inject constructor(
@ApplicationContext private val context: Context,
private val deepLinkCreator: DeepLinkCreator,
) : IntentProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ import org.robolectric.RobolectricTestRunner
import org.robolectric.RuntimeEnvironment

@RunWith(RobolectricTestRunner::class)
class IntentProviderImplTest {
class DefaultIntentProviderTest {
@Test
fun `test getViewRoomIntent with Session`() {
val sut = createIntentProviderImpl()
val sut = createDefaultIntentProvider()
val result = sut.getViewRoomIntent(
sessionId = A_SESSION_ID,
roomId = null,
Expand All @@ -45,7 +45,7 @@ class IntentProviderImplTest {

@Test
fun `test getViewRoomIntent with Session and Room`() {
val sut = createIntentProviderImpl()
val sut = createDefaultIntentProvider()
val result = sut.getViewRoomIntent(
sessionId = A_SESSION_ID,
roomId = A_ROOM_ID,
Expand All @@ -57,7 +57,7 @@ class IntentProviderImplTest {

@Test
fun `test getViewRoomIntent with Session, Room and Thread`() {
val sut = createIntentProviderImpl()
val sut = createDefaultIntentProvider()
val result = sut.getViewRoomIntent(
sessionId = A_SESSION_ID,
roomId = A_ROOM_ID,
Expand All @@ -67,8 +67,8 @@ class IntentProviderImplTest {
assertThat(result.data.toString()).isEqualTo("elementx://open/@alice:server.org/!aRoomId:domain/\$aThreadId")
}

private fun createIntentProviderImpl(): IntentProviderImpl {
return IntentProviderImpl(
private fun createDefaultIntentProvider(): DefaultIntentProvider {
return DefaultIntentProvider(
context = RuntimeEnvironment.getApplication() as Context,
deepLinkCreator = DeepLinkCreator(),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ object NotificationConfig {
// TODO EAx Implement and set to true at some point
const val SUPPORT_MARK_AS_READ_ACTION = false

// TODO EAx Implement and set to true at some point
const val SUPPORT_JOIN_DECLINE_INVITE = false

// TODO EAx Implement and set to true at some point
const val SUPPORT_QUICK_REPLY_ACTION = false
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 New Vector Ltd
* Copyright (c) 2024 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -14,9 +14,12 @@
* limitations under the License.
*/

package io.element.android.features.onboarding.impl
package io.element.android.appconfig

object OnBoardingConfig {
/** Whether the user can use QR code login. */
const val CAN_LOGIN_WITH_QR_CODE = false

/** Whether the user can create an account using the app. */
const val CAN_CREATE_ACCOUNT = false
}
2 changes: 2 additions & 0 deletions appnav/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ dependencies {
implementation(libs.coil)

implementation(projects.features.ftue.api)
implementation(projects.features.share.api)
implementation(projects.features.viewfolder.api)

implementation(projects.services.apperror.impl)
Expand All @@ -71,6 +72,7 @@ dependencies {
testImplementation(projects.tests.testutils)
testImplementation(projects.features.rageshake.test)
testImplementation(projects.features.rageshake.impl)
testImplementation(projects.features.share.test)
testImplementation(projects.services.appnavstate.test)
testImplementation(projects.services.analytics.test)
testImplementation(libs.test.appyx.junit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.element.android.appnav

import android.content.Intent
import android.os.Parcelable
import androidx.compose.foundation.layout.Box
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -54,6 +55,7 @@ import io.element.android.features.roomdirectory.api.RoomDescription
import io.element.android.features.roomdirectory.api.RoomDirectoryEntryPoint
import io.element.android.features.roomlist.api.RoomListEntryPoint
import io.element.android.features.securebackup.api.SecureBackupEntryPoint
import io.element.android.features.share.api.ShareEntryPoint
import io.element.android.features.userprofile.api.UserProfileEntryPoint
import io.element.android.libraries.architecture.BackstackView
import io.element.android.libraries.architecture.BaseFlowNode
Expand Down Expand Up @@ -98,6 +100,7 @@ class LoggedInFlowNode @AssistedInject constructor(
private val networkMonitor: NetworkMonitor,
private val ftueService: FtueService,
private val roomDirectoryEntryPoint: RoomDirectoryEntryPoint,
private val shareEntryPoint: ShareEntryPoint,
private val matrixClient: MatrixClient,
snackbarDispatcher: SnackbarDispatcher,
) : BaseFlowNode<LoggedInFlowNode.NavTarget>(
Expand Down Expand Up @@ -219,6 +222,9 @@ class LoggedInFlowNode @AssistedInject constructor(

@Parcelize
data object RoomDirectorySearch : NavTarget

@Parcelize
data class IncomingShare(val intent: Intent) : NavTarget
}

override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node {
Expand All @@ -229,31 +235,31 @@ class LoggedInFlowNode @AssistedInject constructor(
}
NavTarget.RoomList -> {
val callback = object : RoomListEntryPoint.Callback {
override fun onRoomClicked(roomId: RoomId) {
override fun onRoomClick(roomId: RoomId) {
backstack.push(NavTarget.Room(roomId.toRoomIdOrAlias()))
}

override fun onSettingsClicked() {
override fun onSettingsClick() {
backstack.push(NavTarget.Settings())
}

override fun onCreateRoomClicked() {
override fun onCreateRoomClick() {
backstack.push(NavTarget.CreateRoom)
}

override fun onSessionConfirmRecoveryKeyClicked() {
override fun onSessionConfirmRecoveryKeyClick() {
backstack.push(NavTarget.SecureBackup(initialElement = SecureBackupEntryPoint.InitialTarget.EnterRecoveryKey))
}

override fun onRoomSettingsClicked(roomId: RoomId) {
override fun onRoomSettingsClick(roomId: RoomId) {
backstack.push(NavTarget.Room(roomId.toRoomIdOrAlias(), initialElement = RoomNavigationTarget.Details))
}

override fun onReportBugClicked() {
override fun onReportBugClick() {
plugins<Callback>().forEach { it.onOpenBugReport() }
}

override fun onRoomDirectorySearchClicked() {
override fun onRoomDirectorySearchClick() {
backstack.push(NavTarget.RoomDirectorySearch)
}
}
Expand All @@ -272,7 +278,7 @@ class LoggedInFlowNode @AssistedInject constructor(
coroutineScope.launch { attachRoom(roomId.toRoomIdOrAlias()) }
}

override fun onPermalinkClicked(data: PermalinkData) {
override fun onPermalinkClick(data: PermalinkData) {
when (data) {
is PermalinkData.UserLink -> {
// Should not happen (handled by MessagesNode)
Expand Down Expand Up @@ -325,7 +331,7 @@ class LoggedInFlowNode @AssistedInject constructor(
plugins<Callback>().forEach { it.onOpenBugReport() }
}

override fun onSecureBackupClicked() {
override fun onSecureBackupClick() {
backstack.push(NavTarget.SecureBackup())
}

Expand Down Expand Up @@ -363,7 +369,7 @@ class LoggedInFlowNode @AssistedInject constructor(
NavTarget.RoomDirectorySearch -> {
roomDirectoryEntryPoint.nodeBuilder(this, buildContext)
.callback(object : RoomDirectoryEntryPoint.Callback {
override fun onResultClicked(roomDescription: RoomDescription) {
override fun onResultClick(roomDescription: RoomDescription) {
backstack.push(
NavTarget.Room(
roomIdOrAlias = roomDescription.roomId.toRoomIdOrAlias(),
Expand All @@ -375,6 +381,20 @@ class LoggedInFlowNode @AssistedInject constructor(
})
.build()
}
is NavTarget.IncomingShare -> {
shareEntryPoint.nodeBuilder(this, buildContext)
.callback(object : ShareEntryPoint.Callback {
override fun onDone(roomIds: List<RoomId>) {
navigateUp()
if (roomIds.size == 1) {
val targetRoomId = roomIds.first()
backstack.push(NavTarget.Room(targetRoomId.toRoomIdOrAlias()))
}
}
})
.params(ShareEntryPoint.Params(intent = navTarget.intent))
.build()
}
}
}

Expand Down Expand Up @@ -414,6 +434,17 @@ class LoggedInFlowNode @AssistedInject constructor(
}
}

internal suspend fun attachIncomingShare(intent: Intent) {
waitForNavTargetAttached { navTarget ->
navTarget is NavTarget.RoomList
}
attachChild<Node> {
backstack.push(
NavTarget.IncomingShare(intent)
)
}
}

@Composable
override fun View(modifier: Modifier) {
Box(modifier = modifier) {
Expand Down
Loading

0 comments on commit 00c77e5

Please sign in to comment.