Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 28 additions & 19 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ if (file("google-services.json").exists()) {
apply(plugin = "com.google.gms.google-services")
}

val localProperties = Properties().apply {
val file = rootProject.file("local.properties")
if (file.exists()) {
file.inputStream().use(::load)
val localProperties =
Properties().apply {
val file = rootProject.file("local.properties")
if (file.exists()) {
file.inputStream().use(::load)
}
}
}

fun credential(name: String): String? =
localProperties.getProperty(name)?.takeIf { it.isNotBlank() }
Expand All @@ -32,19 +33,25 @@ val unsignedBuild =
providers.gradleProperty("unsigned").orNull.equals("true", ignoreCase = true)
val startupPrewarm = !providers.gradleProperty("startupPrewarm").orNull.equals("false", ignoreCase = true)
val targetAbiProp = providers.gradleProperty("targetAbi").orNull
val selectedAbis = if (!targetAbiProp.isNullOrBlank()) {
listOf(targetAbiProp)
} else {
listOf("armeabi-v7a", "arm64-v8a", "x86_64")
}
val selectedAbis =
if (!targetAbiProp.isNullOrBlank()) {
listOf(targetAbiProp)
} else {
listOf("armeabi-v7a", "arm64-v8a", "x86_64")
}
val appVersionCode = 20
val appVersionName = "0.4.3"

/** Short git SHA of the checked-out commit, shown next to the build type in settings. */
val gitCommit: String = providers.exec {
commandLine("git", "rev-parse", "--short", "HEAD")
isIgnoreExitValue = true
}.standardOutput.asText.get().trim().ifEmpty { "unknown" }
val gitCommit: String =
providers
.exec {
commandLine("git", "rev-parse", "--short", "HEAD")
isIgnoreExitValue = true
}.standardOutput.asText
.get()
.trim()
.ifEmpty { "unknown" }

android {
namespace = "org.monogram"
Expand Down Expand Up @@ -138,11 +145,12 @@ androidComponents {
onVariants { variant ->
val buildType = variant.buildType ?: variant.name.substringAfterLast("-")
variant.outputs.forEach { output ->
val abi = output.filters
.firstOrNull { it.filterType.name == "ABI" }
?.identifier
?: targetAbiProp?.takeIf { it.isNotBlank() }
?: "universal"
val abi =
output.filters
.firstOrNull { it.filterType.name == "ABI" }
?.identifier
?: targetAbiProp?.takeIf { it.isNotBlank() }
?: "universal"
output.outputFileName.set("monogram-$abi-$appVersionName-$buildType.apk")
}
}
Expand Down Expand Up @@ -203,6 +211,7 @@ dependencies {
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.room.testing)
androidTestImplementation(libs.androidx.media3.exoplayer)
androidTestImplementation(libs.coil.video)
debugImplementation(libs.androidx.compose.ui.test.manifest)
debugImplementation(libs.androidx.compose.ui.tooling)
}
38 changes: 37 additions & 1 deletion app/src/androidTest/java/org/monogram/ComposerEditingTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,45 @@ class ComposerEditingTest {

private var scenario: ActivityScenario<UiStateTestActivity>? = null
private lateinit var root: RootComponent
private val historyRequests = mutableListOf<Pair<String, Int>>()

@After
fun cleanup() {
scenario?.close()
UiStateTestActivity.content = {}
}

@Test
fun chatRowOpensRenderedHistory() {
val messages = (1..80).map { id ->
Message(
org.monogram.core.models.MessageId(PeerId(1), id),
null,
"Loading fixture $id",
id.toLong(),
outgoing = true
)
}
launch(messages)
val startedAt = android.os.SystemClock.elapsedRealtime()
compose.onNodeWithText("Chat 001").performClick()
compose.waitUntil(10_000) {
(root.stack.value.active.instance as? RootComponent.Child.Dialog)
?.component?.state?.value?.messages?.isNotEmpty() == true
}
compose.onNodeWithText("Loading fixture 80", substring = true).assertIsDisplayed()
compose.runOnIdle {
assertEquals(1, historyRequests.count { it.first == "getHistory" })
assertEquals(emptyList<Pair<String, Int>>(), historyRequests.filter {
it.first == "getHistoryPageBackground" || it.second < 80
})
}
android.util.Log.i(
"LoadingUiTiming",
"operation=chat_click_history_render ms=${android.os.SystemClock.elapsedRealtime() - startedAt}"
)
}

@Test
fun selectedMessagesOpenUnifiedRecipientPicker() {
val messages = listOf(1, 2).map { id ->
Expand Down Expand Up @@ -187,9 +219,13 @@ class ComposerEditingTest {
"toString" -> "ComposerEditingFakeClient"
"libraryVersion" -> "test"
"updates", "sessionLost" -> emptyFlow<Nothing>()
"proxyConnectionStatus" -> org.monogram.network.bridge.session.ProxyConnectionStatus.Disabled
"getChats" -> Outcome.Ok(chats)
"getFolders" -> Outcome.Ok(listOf(Folder(2, "Work", chatIds = chats.map { it.id })))
"getHistory", "getHistoryPage" -> Outcome.Ok(messages)
"getHistory", "getHistoryPage", "getHistoryPageBackground" -> {
historyRequests += method.name to (args!![1] as Int)
Outcome.Ok(messages)
}
"getPinnedMessages" -> Outcome.Ok(emptyList<Message>())
"getProfile" -> {
val id = args!![0] as PeerId
Expand Down
Loading