Skip to content

Commit 3b11124

Browse files
committed
Merge branch 'release/0.2.4' into main
2 parents 43ff5a9 + 8292197 commit 3b11124

File tree

518 files changed

+6060
-2308
lines changed

Some content is hidden

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

518 files changed

+6060
-2308
lines changed

.github/workflows/build.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
distribution: 'temurin' # See 'Supported distributions' for available options
3939
java-version: '17'
4040
- name: Configure gradle
41-
uses: gradle/gradle-build-action@v2.8.1
41+
uses: gradle/gradle-build-action@v2.9.0
4242
with:
4343
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
4444
- name: Assemble debug APK
@@ -55,7 +55,7 @@ jobs:
5555
name: elementx-debug
5656
path: |
5757
app/build/outputs/apk/debug/*.apk
58-
- uses: rnkdsh/[email protected].2
58+
- uses: rnkdsh/[email protected].3
5959
id: diawi
6060
# Do not fail the whole build if Diawi upload fails
6161
continue-on-error: true

.github/workflows/maestro.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
ELEMENT_ANDROID_MAPTILER_API_KEY: ${{ secrets.MAPTILER_KEY }}
4141
ELEMENT_ANDROID_MAPTILER_LIGHT_MAP_ID: ${{ secrets.MAPTILER_LIGHT_MAP_ID }}
4242
ELEMENT_ANDROID_MAPTILER_DARK_MAP_ID: ${{ secrets.MAPTILER_DARK_MAP_ID }}
43-
- uses: mobile-dev-inc/action-maestro-cloud@v1.5.0
43+
- uses: mobile-dev-inc/action-maestro-cloud@v1.6.0
4444
with:
4545
api-key: ${{ secrets.MAESTRO_CLOUD_API_KEY }}
4646
# Doc says (https://github.com/mobile-dev-inc/action-maestro-cloud#android):

.github/workflows/nightlyReports.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
distribution: 'temurin' # See 'Supported distributions' for available options
6363
java-version: '17'
6464
- name: Configure gradle
65-
uses: gradle/gradle-build-action@v2.8.1
65+
uses: gradle/gradle-build-action@v2.9.0
6666
with:
6767
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
6868
- name: Dependency analysis

.github/workflows/quality.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
distribution: 'temurin' # See 'Supported distributions' for available options
4141
java-version: '17'
4242
- name: Configure gradle
43-
uses: gradle/gradle-build-action@v2.8.1
43+
uses: gradle/gradle-build-action@v2.9.0
4444
with:
4545
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
4646
- name: Run code quality check suite

.github/workflows/recordScreenshots.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
java-version: '17'
2525
# Add gradle cache, this should speed up the process
2626
- name: Configure gradle
27-
uses: gradle/gradle-build-action@v2.8.1
27+
uses: gradle/gradle-build-action@v2.9.0
2828
with:
2929
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
3030
- name: Record screenshots

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
distribution: 'temurin' # See 'Supported distributions' for available options
2626
java-version: '17'
2727
- name: Configure gradle
28-
uses: gradle/gradle-build-action@v2.8.1
28+
uses: gradle/gradle-build-action@v2.9.0
2929
- name: Create app bundle
3030
env:
3131
ELEMENT_ANDROID_MAPTILER_API_KEY: ${{ secrets.MAPTILER_KEY }}

.github/workflows/sonar.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
distribution: 'temurin' # See 'Supported distributions' for available options
3333
java-version: '17'
3434
- name: Configure gradle
35-
uses: gradle/gradle-build-action@v2.8.1
35+
uses: gradle/gradle-build-action@v2.9.0
3636
with:
3737
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
3838
- name: 🔊 Publish results to Sonar

.github/workflows/tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
distribution: 'temurin' # See 'Supported distributions' for available options
4545
java-version: '17'
4646
- name: Configure gradle
47-
uses: gradle/gradle-build-action@v2.8.1
47+
uses: gradle/gradle-build-action@v2.9.0
4848
with:
4949
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
5050

.idea/dictionaries/shared.xml

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.maestro/tests/account/changeServer.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ appId: ${APP_ID}
1010
- tapOn:
1111
id: "change_server-server"
1212
# Test server that does not support sliding sync.
13-
- inputText: "gnuradio"
13+
- inputText: "https://kieranml.ems-support.element.dev"
1414
- hideKeyboard
15-
- tapOn: "gnuradio.org"
15+
- tapOn: "kieranml.ems-support.element.dev"
1616
- extendedWaitUntil:
1717
visible: "This server currently doesn’t support sliding sync."
1818
timeout: 10000

CHANGES.md

+21
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
Changes in Element X v0.2.4 (2023-10-12)
2+
========================================
3+
4+
Features ✨
5+
----------
6+
- [Rich text editor] Add full screen mode ([#1447](https://github.com/vector-im/element-x-android/issues/1447))
7+
- Improve rendering of m.emote. ([#1497](https://github.com/vector-im/element-x-android/issues/1497))
8+
- Improve deleted session behavior. ([#1520](https://github.com/vector-im/element-x-android/issues/1520))
9+
10+
Bugfixes 🐛
11+
----------
12+
- WebP images can't be sent as media. ([#1483](https://github.com/vector-im/element-x-android/issues/1483))
13+
- Fix back button not working in bottom sheets. ([#1517](https://github.com/vector-im/element-x-android/issues/1517))
14+
- Render body of unknown msgtype in the timeline and in the room list ([#1539](https://github.com/vector-im/element-x-android/issues/1539))
15+
16+
Other changes
17+
-------------
18+
- Room : makes subscribeToSync/unsubscribeFromSync suspendable. ([#1457](https://github.com/vector-im/element-x-android/issues/1457))
19+
- Add some Konsist tests. ([#1526](https://github.com/vector-im/element-x-android/issues/1526))
20+
21+
122
Changes in Element X v0.2.3 (2023-09-27)
223
========================================
324

CONTRIBUTING.md

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* [knit](#knit)
1919
* [lint](#lint)
2020
* [Unit tests](#unit-tests)
21+
* [konsist](#konsist)
2122
* [Tests](#tests)
2223
* [Accessibility](#accessibility)
2324
* [Jetpack Compose](#jetpack-compose)
@@ -156,6 +157,10 @@ Make sure the following commands execute without any error:
156157
./gradlew test
157158
</pre>
158159

160+
#### konsist
161+
162+
[konsist](https://github.com/LemonAppDev/konsist) is setup in the project to check that the architecture and the naming rules are followed. Konsist tests are classical Unit tests.
163+
159164
### Tests
160165

161166
Element X is currently supported on Android Marshmallow (API 23+): please test your change on an Android device (or Android emulator) running with API 23. Many issues can happen (including crashes) on older devices.

app/build.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ dependencies {
230230
testImplementation(libs.test.truth)
231231
testImplementation(libs.test.turbine)
232232
testImplementation(projects.libraries.matrix.test)
233+
testImplementation(libs.test.konsist)
233234

234235
ksp(libs.showkase.processor)
235236
}

app/src/main/AndroidManifest.xml

+8-5
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@
2020
<!-- To be able to install APK from the application -->
2121
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
2222

23+
<!-- Do not enable enableOnBackInvokedCallback until https://issuetracker.google.com/issues/271303558 is fixed -->
2324
<application
2425
android:name=".ElementXApplication"
2526
android:allowBackup="false"
2627
android:dataExtractionRules="@xml/data_extraction_rules"
27-
android:enableOnBackInvokedCallback="true"
28+
android:enableOnBackInvokedCallback="false"
2829
android:fullBackupContent="@xml/backup_rules"
2930
android:icon="@mipmap/ic_launcher"
3031
android:label="@string/app_name"
32+
android:networkSecurityConfig="@xml/network_security_config"
3133
android:roundIcon="@mipmap/ic_launcher_round"
3234
android:supportsRtl="true"
3335
android:theme="@style/Theme.ElementX"
@@ -81,11 +83,12 @@
8183
tools:node="remove" />
8284

8385
<provider
84-
android:authorities="${applicationId}.fileprovider"
8586
android:name="androidx.core.content.FileProvider"
86-
android:grantUriPermissions="true"
87-
android:exported="false">
88-
<meta-data android:name="android.support.FILE_PROVIDER_PATHS"
87+
android:authorities="${applicationId}.fileprovider"
88+
android:exported="false"
89+
android:grantUriPermissions="true">
90+
<meta-data
91+
android:name="android.support.FILE_PROVIDER_PATHS"
8992
android:resource="@xml/file_providers" />
9093
</provider>
9194

3.26 KB
Loading

app/src/main/kotlin/io/element/android/x/MainActivity.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import com.bumble.appyx.core.integrationpoint.NodeComponentActivity
3434
import com.bumble.appyx.core.plugin.NodeReadyObserver
3535
import io.element.android.libraries.architecture.bindings
3636
import io.element.android.libraries.core.log.logger.LoggerTag
37-
import io.element.android.libraries.designsystem.utils.LocalSnackbarDispatcher
37+
import io.element.android.libraries.designsystem.utils.snackbar.LocalSnackbarDispatcher
3838
import io.element.android.libraries.theme.ElementTheme
3939
import io.element.android.x.di.AppBindings
4040
import io.element.android.x.intent.SafeUriHandler

app/src/main/kotlin/io/element/android/x/di/AppBindings.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package io.element.android.x.di
1818

1919
import com.squareup.anvil.annotations.ContributesTo
2020
import io.element.android.features.rageshake.api.reporter.BugReporter
21-
import io.element.android.libraries.designsystem.utils.SnackbarDispatcher
21+
import io.element.android.libraries.designsystem.utils.snackbar.SnackbarDispatcher
2222
import io.element.android.libraries.di.AppScope
2323
import io.element.android.libraries.matrix.api.tracing.TracingService
2424

app/src/main/kotlin/io/element/android/x/di/AppModule.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import io.element.android.features.messages.impl.timeline.components.customreact
2828
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
2929
import io.element.android.libraries.core.meta.BuildMeta
3030
import io.element.android.libraries.core.meta.BuildType
31-
import io.element.android.libraries.designsystem.utils.SnackbarDispatcher
31+
import io.element.android.libraries.designsystem.utils.snackbar.SnackbarDispatcher
3232
import io.element.android.libraries.di.AppScope
3333
import io.element.android.libraries.di.ApplicationContext
3434
import io.element.android.libraries.di.DefaultPreferences
58 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
18 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
80 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
182 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<network-security-config>
3+
<!-- Ref: https://developer.android.com/training/articles/security-config.html -->
4+
<!-- By default, do not allow clearText traffic -->
5+
<base-config cleartextTrafficPermitted="false" />
6+
7+
<!-- Allow clearText traffic on some specified host -->
8+
<domain-config cleartextTrafficPermitted="true">
9+
<!-- Localhost -->
10+
<domain includeSubdomains="true">localhost</domain>
11+
<domain includeSubdomains="true">127.0.0.1</domain>
12+
<!-- Localhost for Android emulator -->
13+
<domain includeSubdomains="true">10.0.2.2</domain>
14+
<!-- Onion services -->
15+
<domain includeSubdomains="true">onion</domain>
16+
17+
<!-- Domains that are used for LANs -->
18+
<!-- These are IANA recognized special use domain names, see https://www.iana.org/assignments/special-use-domain-names/special-use-domain-names.xhtml -->
19+
<domain includeSubdomains="true">home.arpa</domain>
20+
<domain includeSubdomains="true">local</domain> <!-- Note this has been reserved for use with mDNS -->
21+
<domain includeSubdomains="true">test</domain>
22+
<!-- These are observed in the wild either by convention or RFCs that have not been accepted, and are not currently TLDs -->
23+
<domain includeSubdomains="true">home</domain>
24+
<domain includeSubdomains="true">lan</domain>
25+
<domain includeSubdomains="true">localdomain</domain>
26+
</domain-config>
27+
28+
<debug-overrides>
29+
<trust-anchors>
30+
<certificates src="system" />
31+
<certificates src="user" />
32+
</trust-anchors>
33+
</debug-overrides>
34+
35+
</network-security-config>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
/*
2+
* Copyright (c) 2023 New Vector Ltd
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.element.android.app
18+
19+
import androidx.compose.runtime.Composable
20+
import com.lemonappdev.konsist.api.KoModifier
21+
import com.lemonappdev.konsist.api.Konsist
22+
import com.lemonappdev.konsist.api.ext.list.constructors
23+
import com.lemonappdev.konsist.api.ext.list.modifierprovider.withoutModifier
24+
import com.lemonappdev.konsist.api.ext.list.modifierprovider.withoutOverrideModifier
25+
import com.lemonappdev.konsist.api.ext.list.parameters
26+
import com.lemonappdev.konsist.api.ext.list.properties
27+
import com.lemonappdev.konsist.api.ext.list.withAllAnnotationsOf
28+
import com.lemonappdev.konsist.api.ext.list.withAllParentsOf
29+
import com.lemonappdev.konsist.api.ext.list.withNameEndingWith
30+
import com.lemonappdev.konsist.api.ext.list.withReturnType
31+
import com.lemonappdev.konsist.api.ext.list.withTopLevel
32+
import com.lemonappdev.konsist.api.ext.list.withoutName
33+
import com.lemonappdev.konsist.api.ext.list.withoutNameEndingWith
34+
import com.lemonappdev.konsist.api.verify.assertFalse
35+
import com.lemonappdev.konsist.api.verify.assertTrue
36+
import io.element.android.libraries.architecture.Presenter
37+
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
38+
import org.junit.Test
39+
40+
class KonsistTest {
41+
42+
@Test
43+
fun `Classes extending 'Presenter' should have 'Presenter' suffix`() {
44+
Konsist.scopeFromProject()
45+
.classes()
46+
.withAllParentsOf(Presenter::class)
47+
.assertTrue {
48+
it.name.endsWith("Presenter")
49+
}
50+
}
51+
52+
@Test
53+
fun `Functions with '@PreviewsDayNight' annotation should have 'Preview' suffix`() {
54+
Konsist
55+
.scopeFromProject()
56+
.functions()
57+
.withAllAnnotationsOf(PreviewsDayNight::class)
58+
.assertTrue {
59+
it.hasNameEndingWith("Preview") &&
60+
it.hasNameEndingWith("LightPreview").not() &&
61+
it.hasNameEndingWith("DarkPreview").not()
62+
}
63+
}
64+
65+
@Test
66+
fun `Top level function with '@Composable' annotation starting with a upper case should be placed in a file with the same name`() {
67+
Konsist
68+
.scopeFromProject()
69+
.functions()
70+
.withTopLevel()
71+
.withoutModifier(KoModifier.PRIVATE)
72+
.withoutNameEndingWith("Preview")
73+
.withAllAnnotationsOf(Composable::class)
74+
.withoutName(
75+
// Add some exceptions...
76+
"OutlinedButton",
77+
"TextButton",
78+
"SimpleAlertDialogContent",
79+
)
80+
.assertTrue(
81+
additionalMessage =
82+
"""
83+
Please check the filename. It should match the top level Composable function. If the filename is correct:
84+
- consider making the Composable private or moving it to its own file
85+
- at last resort, you can add an exception in the Konsist test
86+
""".trimIndent()
87+
) {
88+
if (it.name.first().isLowerCase()) {
89+
true
90+
} else {
91+
val fileName = it.containingFile.name.removeSuffix(".kt")
92+
fileName == it.name
93+
}
94+
}
95+
}
96+
97+
@Test
98+
fun `Data class state MUST not have default value`() {
99+
Konsist
100+
.scopeFromProject()
101+
.classes()
102+
.withNameEndingWith("State")
103+
.withoutName(
104+
"CameraPositionState",
105+
)
106+
.constructors
107+
.parameters
108+
.assertTrue { parameterDeclaration ->
109+
parameterDeclaration.defaultValue == null &&
110+
// Using parameterDeclaration.defaultValue == null is not enough apparently,
111+
// Also check that the text does not contain an equal sign
112+
parameterDeclaration.text.contains("=").not()
113+
}
114+
}
115+
116+
@Test
117+
fun `Function which creates Presenter in test MUST be named 'createPresenterName'`() {
118+
Konsist
119+
.scopeFromTest()
120+
.functions()
121+
.withReturnType { it.name.endsWith("Presenter") }
122+
.withoutOverrideModifier()
123+
.assertTrue { functionDeclaration ->
124+
functionDeclaration.name == "create${functionDeclaration.returnType?.name}"
125+
}
126+
}
127+
128+
@Test
129+
fun `no field should have 'm' prefix`() {
130+
Konsist
131+
.scopeFromProject()
132+
.classes()
133+
.properties()
134+
.assertFalse {
135+
val secondCharacterIsUppercase = it.name.getOrNull(1)?.isUpperCase() ?: false
136+
it.name.startsWith('m') && secondCharacterIsUppercase
137+
}
138+
}
139+
}

0 commit comments

Comments
 (0)