Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
Bump dev.medzik.android to 1.8.0 and add common-kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
M3DZIK committed Jul 20, 2024
1 parent 69776c9 commit 1d07faf
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package dev.medzik.librepass.android.business

import android.content.Context
import dev.medzik.librepass.android.database.Credentials
import dev.medzik.librepass.android.database.injection.DatabaseProvider
import dev.medzik.librepass.android.database.injection.RepositoryModule
import dev.medzik.librepass.client.api.CipherClient
import java.util.Date
import java.util.concurrent.TimeUnit
Expand All @@ -15,7 +15,7 @@ suspend fun syncCiphers(
) {
val currentTimeSeconds = TimeUnit.MILLISECONDS.toSeconds(Date().time)

val repository = DatabaseProvider.provideRepository(context)
val repository = RepositoryModule.provideRepository(context)

val localCiphers = repository.cipher.getAll(credentials.userId)

Expand Down
2 changes: 2 additions & 0 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ android {

dependencies {
implementation(libs.compose.navigation)
implementation(libs.kotlinx.coroutines)
implementation(libs.medzik.android.crypto)
implementation(libs.medzik.android.utils)
implementation(libs.medzik.common.kotlin)

implementation(libs.librepass.client)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,15 @@ import androidx.room.Update

@Dao
interface CredentialsDao {
/**
* Insert credentials into the database.
* @param credentials the credentials to be inserted
*/
@Insert
suspend fun insert(credentials: Credentials)

/**
* Get credentials from the database.
* @return The credentials from the database, if any.
*/
@Query("SELECT * FROM credentials LIMIT 1")
fun get(): Credentials?

/**
* Update credentials in the database.
* @param credentials the updated credentials
*/
@Update
suspend fun update(credentials: Credentials)

/**
* Delete credentials from the database.
*/
@Query("DELETE FROM credentials")
suspend fun drop()
}
6 changes: 4 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ kotlin-ksp = "2.0.0-1.0.23"
kotlinx-coroutines = "1.8.1"
kotlinx-serialization = "1.7.1"
librepass-client = "1.6.2"
medzik-android-utils = "1.7.1"
medzik-android-utils = "1.8.0"
medzik-common-kotlin = "1.1.0"
otp = "1.0.1"
zxing = "3.5.3"
zxing-android = "4.3.0"
Expand All @@ -37,7 +38,7 @@ androidx-datastore = { module = "androidx.datastore:datastore", version.ref = "a
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "androidx-room" }
androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "androidx-room" }
androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "androidx-room" }
coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil-compose" }
compose-coil = { module = "io.coil-kt:coil-compose", version.ref = "coil-compose" }
compose-lifecycle-runtime = { module = "androidx.lifecycle:lifecycle-runtime-compose", version.ref = "compose-lifecycle-runtime" }
compose-material-icons = { module = "androidx.compose.material:material-icons-extended", version.ref = "compose" }
compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "compose-material3" }
Expand All @@ -56,6 +57,7 @@ librepass-client = { module = "dev.medzik.librepass:client", version.ref = "libr
medzik-android-compose = { module = "dev.medzik.android:compose", version.ref = "medzik-android-utils" }
medzik-android-crypto = { module = "dev.medzik.android:crypto", version.ref = "medzik-android-utils" }
medzik-android-utils = { module = "dev.medzik.android:utils", version.ref = "medzik-android-utils" }
medzik-common-kotlin = { module = "dev.medzik.common:kotlin", version.ref = "medzik-common-kotlin" }
otp = { module = "dev.medzik:otp", version.ref = "otp" }
zxing = { module = "com.google.zxing:core", version.ref = "zxing" }
zxing-android = { module = "com.journeyapps:zxing-android-embedded", version.ref = "zxing-android" }
Expand Down
1 change: 1 addition & 0 deletions ui-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ dependencies {
implementation(libs.accompanist.drawablepainter)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.core.ktx)
implementation(libs.compose.coil)
implementation(libs.compose.lifecycle.runtime)
implementation(libs.compose.material.icons)
implementation(libs.compose.material3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fun ChoiceServer(
}
}

var servers by rememberMutable(emptyList<CustomServer>())
var servers by rememberMutable { emptyList<CustomServer>() }

LaunchedEffect(Unit) {
val customServers = viewModel.getCustomServers()
Expand Down Expand Up @@ -145,12 +145,12 @@ private fun AddServerSheetContent(

val scope = rememberCoroutineScope()

var customServer by rememberMutable(
var customServer by rememberMutable {
CustomServer(
name = "",
address = "https://"
)
)
}

Column(
modifier = Modifier.padding(horizontal = 8.dp),
Expand Down Expand Up @@ -187,7 +187,7 @@ private fun AddServerSheetContent(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.Center
) {
var loading by rememberMutable(false)
var loading by rememberMutable { false }

LoadingButton(
loading = loading,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import androidx.navigation.NavController
import androidx.navigation.compose.rememberNavController
import dev.medzik.android.compose.icons.TopAppBarBackIcon
import dev.medzik.android.compose.theme.infoContainer
import dev.medzik.android.compose.theme.spacing
import dev.medzik.android.compose.ui.LoadingButton
import dev.medzik.librepass.android.ui.R
import dev.medzik.librepass.client.Server
import dev.medzik.librepass.client.api.AuthClient
import kotlinx.serialization.Serializable

@Serializable
Expand Down Expand Up @@ -74,7 +74,7 @@ fun ForgotPasswordScreenContent(
Column(
modifier = Modifier
.padding(innerPadding)
.padding(horizontal = 12.dp)
.padding(horizontal = MaterialTheme.spacing.horizontalPadding)
.fillMaxSize(),
verticalArrangement = Arrangement.SpaceBetween
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
import androidx.navigation.compose.rememberNavController
import dev.medzik.android.compose.icons.TopAppBarBackIcon
import dev.medzik.android.compose.theme.spacing
import dev.medzik.android.compose.ui.LoadingButton
import dev.medzik.android.compose.ui.textfield.TextFieldValue
import dev.medzik.librepass.android.business.injection.VaultCacheModule
Expand Down Expand Up @@ -85,7 +86,7 @@ fun LoginScreen(
) {
LoadingButton(
modifier = Modifier
.padding(vertical = 12.dp)
.padding(horizontal = MaterialTheme.spacing.horizontalPadding)
.height(50.dp)
.fillMaxWidth(0.85f),
onClick = { viewModel.login() },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
import androidx.navigation.compose.rememberNavController
import dev.medzik.android.compose.icons.TopAppBarBackIcon
import dev.medzik.android.compose.theme.regularHorizontalPadding
import dev.medzik.android.compose.theme.spacing
import dev.medzik.android.compose.ui.IconBox
import dev.medzik.android.compose.ui.LoadingButton
import dev.medzik.android.compose.ui.textfield.AnimatedTextField
Expand Down Expand Up @@ -67,7 +67,7 @@ fun SignupScreen(
) {
item {
Column(
modifier = Modifier.regularHorizontalPadding(),
modifier = Modifier.padding(horizontal = MaterialTheme.spacing.horizontalPadding),
verticalArrangement = Arrangement.spacedBy(12.dp)
) {
EmailTextField(
Expand Down

0 comments on commit 1d07faf

Please sign in to comment.