Package the Rust mobile core and generated Kotlin API for Android (#92)
Dependency security audit / rustsec (push) Failing after 24s

This commit is contained in:
hugo committed 2026-10-08 12:34:09 +02:00
1 parent e079b82b15
commit fcb36a0684
42 files changed
+1586 -172

No files matched your search

@@ -25,6 +25,10 @@ class ShellScreenTest {
hasText(tab.name) and androidx.compose.ui.test.isSelectable()
).performClick()
val page = ShellFixtures.all.getValue(state).first { it.tab == tab }
compose.waitUntil(timeoutMillis = 10_000) {
compose.onAllNodes(hasText(page.stateTitle) and isHeading())
.fetchSemanticsNodes().size == 1
}
compose.onNode(hasText(page.stateTitle) and isHeading()).assertIsDisplayed()
}
}
@@ -1,39 +0,0 @@
package de.rfc1437.ironstorage
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import de.rfc1437.ironstorage.core.ShellFixtures
import de.rfc1437.ironstorage.core.ShellRepository
import de.rfc1437.ironstorage.core.ShellSnapshot
import de.rfc1437.ironstorage.core.ShellState
import de.rfc1437.ironstorage.core.ShellTab
import javax.inject.Singleton
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
class DebugShellRepository : ShellRepository {
private val mutableSnapshot =
MutableStateFlow(
ShellSnapshot(ShellState.Empty, ShellFixtures.all.getValue(ShellState.Empty))
)
override val snapshot: StateFlow<ShellSnapshot> = mutableSnapshot
override fun selectTab(tab: ShellTab) {
mutableSnapshot.value = mutableSnapshot.value.copy(selectedTab = tab)
}
fun showFixture(state: ShellState) {
mutableSnapshot.value =
mutableSnapshot.value.copy(state = state, pages = ShellFixtures.all.getValue(state))
}
}
@Module
@InstallIn(SingletonComponent::class)
object DebugShellModule {
@Provides
@Singleton
fun shellRepository(): ShellRepository = DebugShellRepository()
}
@@ -9,6 +9,7 @@ import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import de.rfc1437.ironstorage.core.NativeFixtureShellRepository
import de.rfc1437.ironstorage.core.ShellRepository
import de.rfc1437.ironstorage.core.ShellState
import de.rfc1437.ironstorage.features.ShellScreen
@@ -19,7 +20,9 @@ fun VariantContent(viewModel: ShellViewModel, repository: ShellRepository) {
Column(Modifier.statusBarsPadding()) {
Row(Modifier.horizontalScroll(rememberScrollState())) {
ShellState.entries.forEach { state ->
TextButton(onClick = { (repository as DebugShellRepository).showFixture(state) }) {
TextButton(onClick = {
(repository as NativeFixtureShellRepository).showFixture(state)
}) {
Text("Fixture: ${state.name}")
}
}
@@ -0,0 +1,26 @@
package de.rfc1437.ironstorage
import android.content.Context
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import de.rfc1437.ironstorage.core.NativeFixtureShellRepository
import de.rfc1437.ironstorage.core.ShellRepository
import javax.inject.Singleton
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
@Module
@InstallIn(SingletonComponent::class)
object ShellModule {
@Provides
@Singleton
fun shellRepository(@ApplicationContext context: Context): ShellRepository =
NativeFixtureShellRepository(
context,
CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
)
}
@@ -1,30 +0,0 @@
package de.rfc1437.ironstorage
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import de.rfc1437.ironstorage.core.ShellRepository
import de.rfc1437.ironstorage.core.ShellSnapshot
import de.rfc1437.ironstorage.core.ShellState
import de.rfc1437.ironstorage.core.ShellTab
import javax.inject.Singleton
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
class ScaffoldShellRepository : ShellRepository {
private val mutableSnapshot = MutableStateFlow(ShellSnapshot(ShellState.Empty, emptyList()))
override val snapshot: StateFlow<ShellSnapshot> = mutableSnapshot
override fun selectTab(tab: ShellTab) {
mutableSnapshot.value = mutableSnapshot.value.copy(selectedTab = tab)
}
}
@Module
@InstallIn(SingletonComponent::class)
object ReleaseShellModule {
@Provides
@Singleton
fun shellRepository(): ShellRepository = ScaffoldShellRepository()
}
@@ -1,5 +1,6 @@
package de.rfc1437.ironstorage
import de.rfc1437.ironstorage.core.ShellFixtures
import de.rfc1437.ironstorage.core.ShellState
import de.rfc1437.ironstorage.core.ShellTab
import org.junit.Assert.assertEquals
@@ -7,14 +8,12 @@ import org.junit.Test
class DebugShellRepositoryTest {
@Test
fun everyFixtureHasFivePagesAndSelectionSurvivesStateChanges() {
val repository = DebugShellRepository()
repository.selectTab(ShellTab.Totp)
fun fixtureInventorySupportsEveryNativeTab() {
val selected = ShellTab.Totp
ShellState.entries.forEach { state ->
repository.showFixture(state)
assertEquals(state, repository.snapshot.value.state)
assertEquals(ShellTab.entries, repository.snapshot.value.pages.map { it.tab })
assertEquals(ShellTab.Totp, repository.snapshot.value.selectedTab)
val pages = ShellFixtures.all.getValue(state)
assertEquals(ShellTab.entries, pages.map { it.tab })
assertEquals(selected, pages.first { it.tab == selected }.tab)
}
}
}