Skip to content

Commit

Permalink
migrate to compose-extensions util and camera-permission
Browse files Browse the repository at this point in the history
  • Loading branch information
avan1235 committed Oct 22, 2023
1 parent cdb3feb commit da2dd34
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 116 deletions.
7 changes: 3 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[versions]
accompanist = "0.32.0"
# @keep
android-compileSdk = "34"
# @pin
Expand All @@ -17,7 +16,7 @@ androidx-crypto = "1.1.0-alpha05"
barcodeScanning = "17.2.0"
buffer = "1.3.6"
compose = "1.5.3"
compose-extensions = "0.0.1"
compose-extensions = "0.0.2"
decompose = "2.2.0-compose-experimental-alpha01"
encoding-base32 = "2.0.0"
essenty = "1.3.0-alpha01"
Expand All @@ -44,15 +43,15 @@ webcamCaptureDriverNative = "1.0.0"
zxing-core = "3.5.2"

[libraries]
accompanist-permissions = { module = "com.google.accompanist:accompanist-permissions", version.ref = "accompanist" }
accompanist-systemuicontroller = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "accompanist" }
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity-compose" }
androidx-appcompat-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat-appcompat" }
androidx-biometric = { module = "androidx.biometric:biometric", version.ref = "androidx-biometric" }
androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "androidx-core-ktx" }
androidx-security-crypto = { module = "androidx.security:security-crypto", version.ref = "androidx-crypto" }
buffer = { module = "com.ditchoom:buffer", version.ref = "buffer" }
compose-extensions-camera-permission = { module = "in.procyk.compose:camera-permission", version.ref = "compose-extensions" }
compose-extensions-camera-qr = { module = "in.procyk.compose:camera-qr", version.ref = "compose-extensions" }
compose-extensions-util = { module = "in.procyk.compose:util", version.ref = "compose-extensions" }
decompose = { module = "com.arkivanov.decompose:decompose", version.ref = "decompose" }
decompose-extensionsComposeJetbrains = { module = "com.arkivanov.decompose:extensions-compose-jetbrains", version.ref = "decompose" }
encoding-base32 = { module = "io.matthewnelson.encoding:base32", version.ref = "encoding-base32" }
Expand Down
5 changes: 2 additions & 3 deletions shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ kotlin {
api(libs.moko.resoures)
api(libs.moko.resoures.compose)

implementation(libs.compose.extensions.camera.permission)
implementation(libs.compose.extensions.camera.qr)
implementation(libs.compose.extensions.util)
}
}
val commonTest by getting {
Expand All @@ -108,9 +110,6 @@ kotlin {
implementation(libs.mlkit.barcodeScanning)
implementation(libs.androidx.security.crypto)

implementation(libs.accompanist.permissions)
implementation(libs.accompanist.systemuicontroller)

runtimeOnly(libs.kotlinx.coroutines.android)
}
}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ import androidx.compose.material.icons.filled.Pin
import androidx.compose.material.icons.filled.Update
import androidx.compose.material.icons.outlined.Cancel
import androidx.compose.material.icons.outlined.Save
import androidx.compose.material3.Icon
import androidx.compose.material3.Tab
import androidx.compose.material3.TabRow
import androidx.compose.material3.Text
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.arkivanov.decompose.extensions.compose.jetbrains.subscribeAsState
import dev.icerock.moko.resources.compose.stringResource
import `in`.procyk.compose.util.SystemBarsScreen
import ml.dev.kotlin.openotp.component.AddHotpProviderComponent
import ml.dev.kotlin.openotp.component.AddOtpProviderComponent
import ml.dev.kotlin.openotp.component.AddTotpProviderComponent
Expand All @@ -35,7 +33,10 @@ internal fun AddProviderScreen(
totpComponent: AddTotpProviderComponent,
hotpComponent: AddHotpProviderComponent,
) {
SystemBarsScreen {
SystemBarsScreen(
top = MaterialTheme.colorScheme.background,
bottom = MaterialTheme.colorScheme.background,
) {
Column(modifier = Modifier.fillMaxWidth()) {
var selected by remember { mutableStateOf(OtpType.entries.first()) }
TabRow(selectedTabIndex = selected.ordinal) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ml.dev.kotlin.openotp.ui.screen

import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
Expand All @@ -12,9 +13,10 @@ import androidx.compose.ui.platform.ClipboardManager
import androidx.compose.ui.unit.dp
import com.arkivanov.decompose.extensions.compose.jetbrains.subscribeAsState
import dev.icerock.moko.resources.compose.stringResource
import `in`.procyk.compose.camera.qr.CameraPermission.Denied
import `in`.procyk.compose.camera.qr.CameraPermission.Granted
import `in`.procyk.compose.camera.qr.rememberCameraPermissionState
import `in`.procyk.compose.camera.permission.CameraPermission.Denied
import `in`.procyk.compose.camera.permission.CameraPermission.Granted
import `in`.procyk.compose.camera.permission.rememberCameraPermissionState
import `in`.procyk.compose.util.SystemBarsScreen
import ml.dev.kotlin.openotp.component.MainComponent
import ml.dev.kotlin.openotp.otp.OtpData
import ml.dev.kotlin.openotp.otp.PresentedOtpCodeData
Expand All @@ -23,7 +25,10 @@ import ml.dev.kotlin.openotp.ui.component.*

@Composable
internal fun MainScreen(mainComponent: MainComponent) {
SystemBarsScreen {
SystemBarsScreen(
top = MaterialTheme.colorScheme.background,
bottom = MaterialTheme.colorScheme.background,
) {
val cameraPermissionState = rememberCameraPermissionState()
val navigateToScanQRCodeWhenCameraPermissionChanged by mainComponent.navigateToScanQRCodeWhenCameraPermissionChanged.subscribeAsState()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.min
import dev.icerock.moko.resources.compose.stringResource
import `in`.procyk.compose.camera.qr.QRCodeScanner
import `in`.procyk.compose.util.NoSystemBarsScreen
import ml.dev.kotlin.openotp.component.ScanQRCodeComponent
import ml.dev.kotlin.openotp.shared.OpenOtpResources
import ml.dev.kotlin.openotp.ui.component.ClickableIconButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import com.arkivanov.decompose.extensions.compose.jetbrains.subscribeAsState
import dev.icerock.moko.resources.compose.stringResource
import `in`.procyk.compose.util.SystemBarsScreen
import ml.dev.kotlin.openotp.component.OpenOtpAppTheme
import ml.dev.kotlin.openotp.component.SettingsComponent
import ml.dev.kotlin.openotp.component.SortOtpDataBy
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit da2dd34

Please sign in to comment.