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
3 changes: 0 additions & 3 deletions .idea/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

6 changes: 1 addition & 5 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 0 additions & 47 deletions .idea/emulatorDisplays.xml

This file was deleted.

1 change: 0 additions & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions data/src/main/java/com/dev/chacha/data/util/Constants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import androidx.datastore.preferences.core.intPreferencesKey

object Constants {
val THEME_OPTIONS = intPreferencesKey(name = "theme_option")
val THEME_NAME = intPreferencesKey(name = "theme_name")
const val THEME_PREFERENCES = "THEME_PREFERENCES"

}
4 changes: 4 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ lifecycle = "2.5.1"
room = "2.4.2"
ktor = "2.0.3"
splash = "1.0.0-rc01"
compose_window = "1.1.1"


[libraries]
android-appCompat = "androidx.appcompat:appcompat:1.4.2"
Expand Down Expand Up @@ -53,6 +55,8 @@ accompanist-permission= "com.google.accompanist:accompanist-permissions:0.21.1-b
date = "com.maxkeppeler.sheets-compose-dialogs:core:1.0.2"
datee = "com.maxkeppeler.sheets-compose-dialogs:calendar:1.0.2"



gson-gson = "com.google.code.gson:gson:2.9.0"
kotlinx-coroutines-core = "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9"
kotlin-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" }
Expand Down
6 changes: 0 additions & 6 deletions presentation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,6 @@ dependencies {
implementation(libs.coil.compose)
implementation(libs.coil.gf)
implementation(libs.accompanist.swiperefresh)
/* implementation(libs.accompanist.permission)
implementation(libs.accompanist.indicator)
implementation(libs.accompanist.systemui)
implementation(libs.accompanist.pager)
implementation(libs.accompanist.animation)
implementation(libs.accompanist.navigation)*/
implementation(libs.kotlin.coroutines.datetime)
implementation(libs.zeko.query.builder)
kapt(libs.android.hilt.compiler)
Expand Down
1 change: 1 addition & 0 deletions presentation/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,57 @@ import com.dev.chacha.presentation.common.theme.Brutalista
fun AccountCard(
onClick: (String) -> Unit,
title: String,
icon: Int
icon: Int,

) {
Card(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp)
.clickable { onClick(title) },
shape = RoundedCornerShape(8.dp),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.6F),
)
) {
Row(
modifier = Modifier
.fillMaxSize()
.padding(16.dp),
horizontalArrangement = Arrangement.SpaceBetween,
verticalAlignment = Alignment.CenterVertically
) {
Row(
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalAlignment = Alignment.CenterVertically
) {
Icon(
painter = painterResource(id = icon),
contentDescription = null,
modifier = Modifier.size(25.dp)
)
Text(
text = title,
color = MaterialTheme.colorScheme.onSurfaceVariant,
fontSize = 14.sp,
fontFamily = Brutalista,
)
}
Icon(
painter = painterResource(id = R.drawable.chevron_right),
contentDescription = null
)
}
}
}

@Composable
fun AccountCards(
onClick: (String) -> Unit,
title: String,
icon: Int,
onSelectTheme: (Int) -> Unit,
selectedTheme: Int,
) {
Card(
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,17 @@ import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.annotation.RequiresApi
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.runtime.rememberCoroutineScope
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.lifecycleScope
import androidx.navigation.compose.rememberNavController
import com.dev.chacha.presentation.common.theme.SaccoRideTheme
import com.dev.chacha.presentation.common.theme.Theme
import com.dev.chacha.presentation.fingerprint.Biometric
import com.dev.chacha.presentation.theme.ThemeViewModel
import com.google.accompanist.navigation.material.ExperimentalMaterialNavigationApi
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.Dispatchers
import timber.log.Timber

@RequiresApi(Build.VERSION_CODES.P)
@AndroidEntryPoint
class MainActivity : ComponentActivity(),Biometric.AuthListener {
class MainActivity : ComponentActivity(), Biometric.AuthListener {
@OptIn(ExperimentalMaterialNavigationApi::class)
@RequiresApi(Build.VERSION_CODES.P)
override fun onCreate(savedInstanceState: Bundle?) {
Expand All @@ -36,12 +26,17 @@ class MainActivity : ComponentActivity(),Biometric.AuthListener {
val bottomSheetNavigator = rememberBottomSheetNavigator()
val navController = rememberNavController(bottomSheetNavigator)
lifecycleScope.launchWhenStarted {
Biometric(
this@MainActivity,
navController,
this@MainActivity,
).authenticate()
Biometric(this@MainActivity, navController, this@MainActivity).authenticate()
}
lifecycleScope.launchWhenResumed {
Biometric(this@MainActivity, navController, this@MainActivity).authenticate()

}.isCancelled
lifecycleScope.launchWhenCreated {
Biometric(this@MainActivity, navController, this@MainActivity).authenticate()
}


}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,16 @@ fun MainScreen(
initial = Theme.FOLLOW_SYSTEM.themeValue,
context = Dispatchers.Main.immediate
)
val themeName by viewModel.theme.collectAsState(
initial = Theme.FOLLOW_SYSTEM.themeName,
context = Dispatchers.Main.immediate
)

SaccoRideTheme(theme = themeValue) {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
ModalBottomSheetLayout(bottomSheetNavigator = bottomSheetNavigator) {
Scaffold(
modifier = Modifier.fillMaxSize(),
bottomBar = { BottomNavigationBar(navController = navController) }
Expand All @@ -67,7 +71,7 @@ fun MainScreen(

}

}


}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.dev.chacha.presentation.base

import androidx.compose.ui.graphics.Color
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import dagger.hilt.android.HiltAndroidApp
import javax.inject.Inject

data class SystemBarState (
val statusBarColor: Color,
val statusBarDarkIcons: Boolean,
val navigationBarDarkIcons: Boolean,
val navigationBarColor: Color,
)

data class PathState (
val name: String,
val args: Map<String, Any?> = emptyMap(),
val callback: (result: Map<String, Any?>) -> Unit = {},
)

@HiltAndroidApp
class AppViewModel @Inject constructor(
private val savedStateHandle: SavedStateHandle,
) : ViewModel() {

var sheetStates: MutableLiveData<Map<String, PathState>> = MutableLiveData(emptyMap())

fun openSheet(state: PathState) {
sheetStates.value = sheetStates.value!!.plus(Pair(state.name, state))
}

fun closeSheet(name: String) {
sheetStates.value = sheetStates.value!!.minus(name)
}

}
Loading