chore: merge the develop branch into master #1

Merged
reya merged 43 commits from develop into master 2026-05-23 00:50:13 +00:00
7 changed files with 108 additions and 3 deletions
Showing only changes of commit e775d799ea - Show all commits

View File

@@ -28,6 +28,7 @@ kotlin {
implementation("su.reya:nostr-sdk-kmp:0.2.3") implementation("su.reya:nostr-sdk-kmp:0.2.3")
implementation("io.github.kalinjul.easyqrscan:scanner:0.7.0") implementation("io.github.kalinjul.easyqrscan:scanner:0.7.0")
implementation("androidx.lifecycle:lifecycle-process:2.8.0") implementation("androidx.lifecycle:lifecycle-process:2.8.0")
implementation("io.github.alexzhirkevich:qrose:1.1.2")
} }
commonMain.dependencies { commonMain.dependencies {
implementation(libs.compose.runtime) implementation(libs.compose.runtime)

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="#000000"
android:pathData="M520,840L520,760L600,760L600,840L520,840ZM440,760L440,560L520,560L520,760L440,760ZM760,640L760,480L840,480L840,640L760,640ZM680,480L680,400L760,400L760,480L680,480ZM200,560L200,480L280,480L280,560L200,560ZM120,480L120,400L200,400L200,480L120,480ZM480,200L480,120L560,120L560,200L480,200ZM180,300L300,300L300,180L180,180L180,300ZM120,360L120,120L360,120L360,360L120,360ZM180,780L300,780L300,660L180,660L180,780ZM120,840L120,600L360,600L360,840L120,840ZM660,300L780,300L780,180L660,180L660,300ZM600,360L600,120L840,120L840,360L600,360ZM680,840L680,720L600,720L600,640L760,640L760,760L840,760L840,840L680,840ZM520,560L520,480L680,480L680,560L520,560ZM360,560L360,480L280,480L280,400L520,400L520,480L440,480L440,560L360,560ZM400,360L400,200L480,200L480,280L560,280L560,360L400,360ZM210,270L210,210L270,210L270,270L210,270ZM210,750L210,690L270,690L270,750L210,750ZM690,270L690,210L750,210L750,270L690,270Z" />
</vector>

View File

@@ -48,6 +48,7 @@ import su.reya.coop.coop.storage.SecretStore
import su.reya.coop.screens.ChatScreen import su.reya.coop.screens.ChatScreen
import su.reya.coop.screens.HomeScreen import su.reya.coop.screens.HomeScreen
import su.reya.coop.screens.ImportScreen import su.reya.coop.screens.ImportScreen
import su.reya.coop.screens.MyQrScreen
import su.reya.coop.screens.NewChatScreen import su.reya.coop.screens.NewChatScreen
import su.reya.coop.screens.NewIdentityScreen import su.reya.coop.screens.NewIdentityScreen
import su.reya.coop.screens.OnboardingScreen import su.reya.coop.screens.OnboardingScreen
@@ -236,6 +237,11 @@ fun App() {
onBack = { navController.popBackStack() }, onBack = { navController.popBackStack() },
) )
} }
composable<Screen.MyQr> { backStackEntry ->
MyQrScreen(
onBack = { navController.popBackStack() },
)
}
} }
} }
} }

View File

@@ -23,4 +23,7 @@ sealed interface Screen {
@Serializable @Serializable
data object Scan : Screen data object Scan : Screen
@Serializable
data object MyQr : Screen
} }

View File

@@ -19,6 +19,7 @@ import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
import androidx.compose.material3.ExtendedFloatingActionButton import androidx.compose.material3.ExtendedFloatingActionButton
import androidx.compose.material3.FilledIconButton
import androidx.compose.material3.FilledTonalButton import androidx.compose.material3.FilledTonalButton
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton import androidx.compose.material3.IconButton
@@ -64,6 +65,7 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import coop.composeapp.generated.resources.Res import coop.composeapp.generated.resources.Res
import coop.composeapp.generated.resources.ic_new_chat import coop.composeapp.generated.resources.ic_new_chat
import coop.composeapp.generated.resources.ic_qr
import coop.composeapp.generated.resources.ic_scanner import coop.composeapp.generated.resources.ic_scanner
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import org.jetbrains.compose.resources.painterResource import org.jetbrains.compose.resources.painterResource
@@ -304,8 +306,8 @@ fun HomeScreen(
) )
} }
Spacer(modifier = Modifier.size(8.dp)) Spacer(modifier = Modifier.size(8.dp))
Box( Row(
contentAlignment = Alignment.Center verticalAlignment = Alignment.CenterVertically,
) { ) {
OutlinedButton( OutlinedButton(
onClick = { onClick = {
@@ -320,6 +322,21 @@ fun HomeScreen(
) { ) {
Text(text = shortPubkey) Text(text = shortPubkey)
} }
FilledIconButton(
onClick = {
scope.launch {
sheetState.hide()
showBottomSheet = false
navController.navigate(Screen.MyQr)
}
},
shape = MaterialShapes.Square.toShape()
) {
Icon(
painter = painterResource(Res.drawable.ic_qr),
contentDescription = "My QR"
)
}
} }
} }
Spacer(modifier = Modifier.size(16.dp)) Spacer(modifier = Modifier.size(16.dp))

View File

@@ -0,0 +1,68 @@
package su.reya.coop.screens
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import coop.composeapp.generated.resources.Res
import coop.composeapp.generated.resources.ic_arrow_back
import io.github.alexzhirkevich.qrose.rememberQrCodePainter
import org.jetbrains.compose.resources.painterResource
import su.reya.coop.LocalNostrViewModel
import su.reya.coop.LocalSnackbarHostState
@Composable
fun MyQrScreen(
onBack: () -> Unit
) {
val snackbarHostState = LocalSnackbarHostState.current
val viewModel = LocalNostrViewModel.current
val currentUser = viewModel.currentUser() ?: return
Scaffold(
snackbarHost = { SnackbarHost(snackbarHostState) },
topBar = {
TopAppBar(
title = {
Text(
text = "My QR",
style = MaterialTheme.typography.titleMediumEmphasized
)
},
navigationIcon = {
IconButton(onClick = onBack) {
Icon(
painter = painterResource(Res.drawable.ic_arrow_back),
contentDescription = "Back"
)
}
}
)
},
content = { innerPadding ->
Column(
modifier = Modifier
.fillMaxSize()
.padding(innerPadding),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
) {
Image(
painter = rememberQrCodePainter(currentUser.toBech32()),
contentDescription = "My QR"
)
}
}
)
}

View File

@@ -52,7 +52,8 @@ fun ScanScreen(
TopAppBar( TopAppBar(
title = { title = {
Text( Text(
text = "Scan QR", style = MaterialTheme.typography.titleMediumEmphasized text = "Scan QR",
style = MaterialTheme.typography.titleMediumEmphasized
) )
}, },
navigationIcon = { navigationIcon = {