-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/0.2.4' into main
- Loading branch information
Showing
518 changed files
with
6,060 additions
and
2,308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ jobs: | |
distribution: 'temurin' # See 'Supported distributions' for available options | ||
java-version: '17' | ||
- name: Configure gradle | ||
uses: gradle/gradle-build-action@v2.8.1 | ||
uses: gradle/gradle-build-action@v2.9.0 | ||
with: | ||
cache-read-only: ${{ github.ref != 'refs/heads/develop' }} | ||
- name: Assemble debug APK | ||
|
@@ -55,7 +55,7 @@ jobs: | |
name: elementx-debug | ||
path: | | ||
app/build/outputs/apk/debug/*.apk | ||
- uses: rnkdsh/[email protected].2 | ||
- uses: rnkdsh/[email protected].3 | ||
id: diawi | ||
# Do not fail the whole build if Diawi upload fails | ||
continue-on-error: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+392 Bytes
(100%)
app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+1.66 KB
(100%)
app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<network-security-config> | ||
<!-- Ref: https://developer.android.com/training/articles/security-config.html --> | ||
<!-- By default, do not allow clearText traffic --> | ||
<base-config cleartextTrafficPermitted="false" /> | ||
|
||
<!-- Allow clearText traffic on some specified host --> | ||
<domain-config cleartextTrafficPermitted="true"> | ||
<!-- Localhost --> | ||
<domain includeSubdomains="true">localhost</domain> | ||
<domain includeSubdomains="true">127.0.0.1</domain> | ||
<!-- Localhost for Android emulator --> | ||
<domain includeSubdomains="true">10.0.2.2</domain> | ||
<!-- Onion services --> | ||
<domain includeSubdomains="true">onion</domain> | ||
|
||
<!-- Domains that are used for LANs --> | ||
<!-- These are IANA recognized special use domain names, see https://www.iana.org/assignments/special-use-domain-names/special-use-domain-names.xhtml --> | ||
<domain includeSubdomains="true">home.arpa</domain> | ||
<domain includeSubdomains="true">local</domain> <!-- Note this has been reserved for use with mDNS --> | ||
<domain includeSubdomains="true">test</domain> | ||
<!-- These are observed in the wild either by convention or RFCs that have not been accepted, and are not currently TLDs --> | ||
<domain includeSubdomains="true">home</domain> | ||
<domain includeSubdomains="true">lan</domain> | ||
<domain includeSubdomains="true">localdomain</domain> | ||
</domain-config> | ||
|
||
<debug-overrides> | ||
<trust-anchors> | ||
<certificates src="system" /> | ||
<certificates src="user" /> | ||
</trust-anchors> | ||
</debug-overrides> | ||
|
||
</network-security-config> |
139 changes: 139 additions & 0 deletions
139
app/src/test/kotlin/io/element/android/app/KonsistTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
/* | ||
* Copyright (c) 2023 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. | ||
* 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 io.element.android.app | ||
|
||
import androidx.compose.runtime.Composable | ||
import com.lemonappdev.konsist.api.KoModifier | ||
import com.lemonappdev.konsist.api.Konsist | ||
import com.lemonappdev.konsist.api.ext.list.constructors | ||
import com.lemonappdev.konsist.api.ext.list.modifierprovider.withoutModifier | ||
import com.lemonappdev.konsist.api.ext.list.modifierprovider.withoutOverrideModifier | ||
import com.lemonappdev.konsist.api.ext.list.parameters | ||
import com.lemonappdev.konsist.api.ext.list.properties | ||
import com.lemonappdev.konsist.api.ext.list.withAllAnnotationsOf | ||
import com.lemonappdev.konsist.api.ext.list.withAllParentsOf | ||
import com.lemonappdev.konsist.api.ext.list.withNameEndingWith | ||
import com.lemonappdev.konsist.api.ext.list.withReturnType | ||
import com.lemonappdev.konsist.api.ext.list.withTopLevel | ||
import com.lemonappdev.konsist.api.ext.list.withoutName | ||
import com.lemonappdev.konsist.api.ext.list.withoutNameEndingWith | ||
import com.lemonappdev.konsist.api.verify.assertFalse | ||
import com.lemonappdev.konsist.api.verify.assertTrue | ||
import io.element.android.libraries.architecture.Presenter | ||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight | ||
import org.junit.Test | ||
|
||
class KonsistTest { | ||
|
||
@Test | ||
fun `Classes extending 'Presenter' should have 'Presenter' suffix`() { | ||
Konsist.scopeFromProject() | ||
.classes() | ||
.withAllParentsOf(Presenter::class) | ||
.assertTrue { | ||
it.name.endsWith("Presenter") | ||
} | ||
} | ||
|
||
@Test | ||
fun `Functions with '@PreviewsDayNight' annotation should have 'Preview' suffix`() { | ||
Konsist | ||
.scopeFromProject() | ||
.functions() | ||
.withAllAnnotationsOf(PreviewsDayNight::class) | ||
.assertTrue { | ||
it.hasNameEndingWith("Preview") && | ||
it.hasNameEndingWith("LightPreview").not() && | ||
it.hasNameEndingWith("DarkPreview").not() | ||
} | ||
} | ||
|
||
@Test | ||
fun `Top level function with '@Composable' annotation starting with a upper case should be placed in a file with the same name`() { | ||
Konsist | ||
.scopeFromProject() | ||
.functions() | ||
.withTopLevel() | ||
.withoutModifier(KoModifier.PRIVATE) | ||
.withoutNameEndingWith("Preview") | ||
.withAllAnnotationsOf(Composable::class) | ||
.withoutName( | ||
// Add some exceptions... | ||
"OutlinedButton", | ||
"TextButton", | ||
"SimpleAlertDialogContent", | ||
) | ||
.assertTrue( | ||
additionalMessage = | ||
""" | ||
Please check the filename. It should match the top level Composable function. If the filename is correct: | ||
- consider making the Composable private or moving it to its own file | ||
- at last resort, you can add an exception in the Konsist test | ||
""".trimIndent() | ||
) { | ||
if (it.name.first().isLowerCase()) { | ||
true | ||
} else { | ||
val fileName = it.containingFile.name.removeSuffix(".kt") | ||
fileName == it.name | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
fun `Data class state MUST not have default value`() { | ||
Konsist | ||
.scopeFromProject() | ||
.classes() | ||
.withNameEndingWith("State") | ||
.withoutName( | ||
"CameraPositionState", | ||
) | ||
.constructors | ||
.parameters | ||
.assertTrue { parameterDeclaration -> | ||
parameterDeclaration.defaultValue == null && | ||
// Using parameterDeclaration.defaultValue == null is not enough apparently, | ||
// Also check that the text does not contain an equal sign | ||
parameterDeclaration.text.contains("=").not() | ||
} | ||
} | ||
|
||
@Test | ||
fun `Function which creates Presenter in test MUST be named 'createPresenterName'`() { | ||
Konsist | ||
.scopeFromTest() | ||
.functions() | ||
.withReturnType { it.name.endsWith("Presenter") } | ||
.withoutOverrideModifier() | ||
.assertTrue { functionDeclaration -> | ||
functionDeclaration.name == "create${functionDeclaration.returnType?.name}" | ||
} | ||
} | ||
|
||
@Test | ||
fun `no field should have 'm' prefix`() { | ||
Konsist | ||
.scopeFromProject() | ||
.classes() | ||
.properties() | ||
.assertFalse { | ||
val secondCharacterIsUppercase = it.name.getOrNull(1)?.isUpperCase() ?: false | ||
it.name.startsWith('m') && secondCharacterIsUppercase | ||
} | ||
} | ||
} |
Oops, something went wrong.