Skip to content

Commit 012e01b

Browse files
authored
Merge branch 'develop' into chore/prep-kmp-deps
2 parents 561bdfd + bbe7ef0 commit 012e01b

File tree

281 files changed

+2103
-1286
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

281 files changed

+2103
-1286
lines changed

app/build.gradle.kts

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,12 @@ android {
8686
val domainKeysJson: String? = System.getenv(domainRemovalKeysForRepair) ?: project.getLocalProperty(domainRemovalKeysForRepair, null)
8787
val domainKeysHashMap = if (domainKeysJson != null) {
8888
try {
89-
val jsonMap = groovy.json.JsonSlurper().parseText(domainKeysJson) as Map<String, List<String>>
89+
val parsed = groovy.json.JsonSlurper().parseText(domainKeysJson)
90+
val jsonMap = (parsed as? Map<*, *>)?.mapNotNull { (domain, keys) ->
91+
val domainName = domain as? String ?: return@mapNotNull null
92+
val domainKeys = (keys as? List<*>)?.mapNotNull { it as? String } ?: return@mapNotNull null
93+
domainName to domainKeys
94+
}?.toMap().orEmpty()
9095
val javaMapEntries = jsonMap.entries.joinToString("; ") { (domain, keys) ->
9196
val keysList = keys.joinToString("\", \"", "\"", "\"")
9297
"put(\"$domain\", java.util.Arrays.asList($keysList))"
@@ -117,7 +122,9 @@ android {
117122
resources.pickFirsts.add("google/protobuf/*.proto")
118123
jniLibs.pickFirsts.add("**/libsodium.so")
119124
}
120-
android.buildFeatures.buildConfig = true
125+
buildFeatures {
126+
buildConfig = true
127+
}
121128
experimentalProperties["android.experimental.enableScreenshotTest"] = true
122129

123130
testOptions {
@@ -130,29 +137,30 @@ android {
130137
allFlavors.forEach { flavor ->
131138
getByName(flavor) {
132139
if (flavor in internalFlavors) {
133-
java.srcDirs("src/private/kotlin")
140+
kotlin.directories.add("src/private/kotlin")
134141
println("Adding external datadog logger internal sourceSets to '$flavor' flavor")
135142
} else {
136-
java.srcDirs("src/public/kotlin")
143+
kotlin.directories.add("src/public/kotlin")
137144
println("Adding external datadog logger sourceSets to '$flavor' flavor")
138145
}
139146

140147
if (flavor in fossFlavors) {
141-
java.srcDirs("src/foss/kotlin", "src/prod/kotlin")
142-
res.srcDirs("src/prod/res")
148+
kotlin.directories.add("src/foss/kotlin")
149+
kotlin.directories.add("src/prod/kotlin")
150+
res.directories.add("src/prod/res")
143151
println("Adding FOSS sourceSets to '$flavor' flavor")
144152
} else {
145-
java.srcDirs("src/nonfree/kotlin")
153+
kotlin.directories.add("src/nonfree/kotlin")
146154
println("Adding non-free sourceSets to '$flavor' flavor")
147155
}
148156
}
149157
}
150158
getByName("androidTest") {
151-
java.srcDirs("src/androidTest/kotlin")
159+
kotlin.directories.add("src/androidTest/kotlin")
152160
}
153161
create("screenshotTest") {
154-
java.srcDirs("src/screenshotTest/kotlin")
155-
res.srcDirs("src/main/res")
162+
kotlin.directories.add("src/screenshotTest/kotlin")
163+
res.directories.add("src/main/res")
156164
}
157165
}
158166

@@ -161,10 +169,13 @@ android {
161169
}
162170
}
163171

172+
ksp {
173+
arg("compose-destinations.moduleName", "app")
174+
}
175+
164176
// Skip AboutLibraries configuration when running lint to reduce memory usage
165177
if (!project.hasProperty("skip.aboutlibraries")) {
166178
aboutLibraries {
167-
android.registerAndroidTasks = true
168179
export.excludeFields.add("generated")
169180
}
170181
}
@@ -178,7 +189,6 @@ dependencies {
178189

179190
fun implementationWithCoverage(dependency: ProjectDependency) {
180191
implementation(dependency)
181-
kover(dependency)
182192
}
183193
implementationWithCoverage(projects.core.uiCommon)
184194
implementationWithCoverage(projects.core.di)
@@ -196,14 +206,12 @@ dependencies {
196206
if (configs["analytics_enabled"] as? Boolean == true && !isCustomBuild) {
197207
println(">> Dependency Anonymous Analytics is enabled for [$key] flavor")
198208
add("${key}Implementation", project(":core:analytics-enabled"))
199-
add("test${key.capitalize()}Implementation", project(":core:analytics-disabled"))
209+
add("test${key.replaceFirstChar(Char::titlecase)}Implementation", project(":core:analytics-disabled"))
200210
} else {
201211
println(">> Dependency Anonymous Analytics is disabled for [$key] flavor")
202212
add("${key}Implementation", project(":core:analytics-disabled"))
203213
}
204214
}
205-
// Analytics may not be added to the app build, but we always want the merged coverage report
206-
kover(projects.core.analyticsEnabled)
207215

208216
// Application dependencies
209217
implementation(libs.androidx.appcompat)
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
* Wire
3+
* Copyright (C) 2024 Wire Swiss GmbH
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see http://www.gnu.org/licenses/.
17+
*/
18+
package com.wire.android.ui.home.messagecomposer
19+
20+
import androidx.activity.ComponentActivity
21+
import androidx.activity.compose.BackHandler
22+
import androidx.compose.foundation.text.input.TextFieldState
23+
import androidx.compose.material3.Text
24+
import androidx.compose.runtime.LaunchedEffect
25+
import androidx.compose.runtime.remember
26+
import androidx.compose.ui.Modifier
27+
import androidx.compose.ui.focus.FocusRequester
28+
import androidx.compose.ui.platform.LocalFocusManager
29+
import androidx.compose.ui.platform.testTag
30+
import androidx.compose.ui.test.assertTextEquals
31+
import androidx.compose.ui.test.junit4.createAndroidComposeRule
32+
import androidx.compose.ui.test.onNodeWithTag
33+
import androidx.test.espresso.Espresso.pressBack
34+
import com.wire.android.ui.home.messagecomposer.state.AdditionalOptionSubMenuState
35+
import com.wire.android.ui.home.messagecomposer.state.MessageCompositionInputStateHolder
36+
import org.junit.Rule
37+
import org.junit.Test
38+
39+
class MessageComposerBackHandlerTest {
40+
41+
@get:Rule
42+
val composeTestRule = createAndroidComposeRule<ComponentActivity>()
43+
44+
@Test
45+
fun givenExpandedComposer_whenPressingSystemBack_thenComposerCollapses() {
46+
composeTestRule.setContent {
47+
val focusManager = LocalFocusManager.current
48+
val focusRequester = remember { FocusRequester() }
49+
val stateHolder = remember(focusManager) {
50+
MessageCompositionInputStateHolder(
51+
messageTextState = TextFieldState(),
52+
keyboardController = null,
53+
focusManager = focusManager,
54+
focusRequester = focusRequester
55+
)
56+
}
57+
58+
LaunchedEffect(stateHolder) {
59+
stateHolder.inputFocused = true
60+
stateHolder.toggleInputSize()
61+
}
62+
63+
BackHandler(stateHolder.inputFocused) {
64+
stateHolder.collapseComposer(AdditionalOptionSubMenuState.Default)
65+
}
66+
67+
Text(
68+
text = if (stateHolder.isTextExpanded) "expanded" else "collapsed",
69+
modifier = Modifier.testTag(COMPOSER_BACK_STATE_TAG)
70+
)
71+
}
72+
73+
composeTestRule.onNodeWithTag(COMPOSER_BACK_STATE_TAG).assertTextEquals("expanded")
74+
pressBack()
75+
composeTestRule.waitForIdle()
76+
composeTestRule.onNodeWithTag(COMPOSER_BACK_STATE_TAG).assertTextEquals("collapsed")
77+
}
78+
}
79+
80+
private const val COMPOSER_BACK_STATE_TAG = "composer_back_state"

app/src/debug/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:tools="http://schemas.android.com/tools"
4-
package="com.wire.android">
3+
xmlns:tools="http://schemas.android.com/tools">
54

65
<application android:name=".WireApplication">
76
<activity android:name=".ui.WireActivity">

app/src/fdroid/AndroidManifest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
-->
2020
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2121
xmlns:tools="http://schemas.android.com/tools"
22-
package="com.wire.android"
2322
android:sharedUserId="${sharedUserId}">
2423
<application>
2524
<provider

app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2020
xmlns:tools="http://schemas.android.com/tools"
21-
package="com.wire.android"
2221
android:installLocation="internalOnly"
2322
android:sharedUserId="${sharedUserId}">
2423

@@ -74,7 +73,6 @@
7473
android:hardwareAccelerated="true"
7574
android:icon="@mipmap/ic_launcher"
7675
android:label="@string/app_name"
77-
android:requestLegacyExternalStorage="true"
7876
android:roundIcon="@mipmap/ic_launcher_round"
7977
android:supportsRtl="false"
8078
android:theme="@style/AppTheme.SplashScreen"

app/src/main/kotlin/com/wire/android/di/KaliumConfigsModule.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ class KaliumConfigsModule {
6161
isMlsResetEnabled = BuildConfig.IS_MLS_RESET_ENABLED,
6262
collaboraIntegration = BuildConfig.COLLABORA_INTEGRATION_ENABLED,
6363
dbInvalidationControlEnabled = BuildConfig.DB_INVALIDATION_CONTROL_ENABLED,
64-
domainWithFaultyKeysMap = BuildConfig.DOMAIN_REMOVAL_KEYS_FOR_REPAIR
64+
domainWithFaultyKeysMap = BuildConfig.DOMAIN_REMOVAL_KEYS_FOR_REPAIR,
65+
isDebug = BuildConfig.DEBUG
6566
)
6667
}
6768
}

app/src/main/kotlin/com/wire/android/feature/AccountSwitchUseCase.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import com.wire.android.appLogger
2222
import com.wire.android.di.ApplicationScope
2323
import com.wire.android.navigation.BackStackMode
2424
import com.wire.android.navigation.NavigationCommand
25-
import com.wire.android.ui.destinations.HomeScreenDestination
26-
import com.wire.android.ui.destinations.NewLoginScreenDestination
27-
import com.wire.android.ui.destinations.WelcomeScreenDestination
25+
import com.ramcosta.composedestinations.generated.app.destinations.HomeScreenDestination
26+
import com.ramcosta.composedestinations.generated.app.destinations.NewLoginScreenDestination
27+
import com.ramcosta.composedestinations.generated.app.destinations.WelcomeScreenDestination
2828
import com.wire.kalium.logic.data.auth.AccountInfo
2929
import com.wire.kalium.logic.data.logout.LogoutReason
3030
import com.wire.kalium.logic.data.user.UserId

app/src/main/kotlin/com/wire/android/navigation/HomeDestination.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ import androidx.annotation.DrawableRes
2222
import androidx.annotation.StringRes
2323
import com.ramcosta.composedestinations.spec.Direction
2424
import com.wire.android.R
25-
import com.wire.android.ui.destinations.AllConversationsScreenDestination
26-
import com.wire.android.ui.destinations.ArchiveScreenDestination
27-
import com.wire.android.ui.destinations.GlobalCellsScreenDestination
28-
import com.wire.android.ui.destinations.MeetingsScreenDestination
29-
import com.wire.android.ui.destinations.SettingsScreenDestination
30-
import com.wire.android.ui.destinations.VaultScreenDestination
31-
import com.wire.android.ui.destinations.WhatsNewScreenDestination
25+
import com.ramcosta.composedestinations.generated.app.destinations.AllConversationsScreenDestination
26+
import com.ramcosta.composedestinations.generated.app.destinations.ArchiveScreenDestination
27+
import com.ramcosta.composedestinations.generated.app.destinations.GlobalCellsScreenDestination
28+
import com.ramcosta.composedestinations.generated.app.destinations.MeetingsScreenDestination
29+
import com.ramcosta.composedestinations.generated.app.destinations.SettingsScreenDestination
30+
import com.ramcosta.composedestinations.generated.app.destinations.VaultScreenDestination
31+
import com.ramcosta.composedestinations.generated.app.destinations.WhatsNewScreenDestination
3232
import com.wire.android.util.ui.UIText
3333

3434
@Suppress("LongParameterList")
@@ -145,7 +145,7 @@ sealed class HomeDestination(
145145
private const val ITEM_NAME_PREFIX = "HomeNavigationItem."
146146

147147
fun fromRoute(fullRoute: String): HomeDestination? =
148-
values().find { it.direction.route.getBaseRoute() == fullRoute.getBaseRoute() }
148+
values().find { it.direction.baseRoute == fullRoute.getBaseRoute() }
149149

150150
fun values(): Array<HomeDestination> =
151151
arrayOf(Conversations, Settings, Vault, Archive, Support, TeamManagement, WhatsNew, Cells, Meetings)

0 commit comments

Comments
 (0)