Skip to content

Commit

Permalink
Updated Alarm feature
Browse files Browse the repository at this point in the history
  • Loading branch information
myofficework000 committed Apr 10, 2024
1 parent a2556ec commit cb5669e
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import kotlin.reflect.KFunction2
@Composable
fun AlarmMainUI(
viewModel: AlarmViewModel = hiltViewModel(),
snackbarFunc: (String, Boolean) -> Unit
snackBarFunc: (String, Boolean) -> Unit
) {
val localContext = LocalContext.current

Expand Down Expand Up @@ -80,8 +80,8 @@ fun AlarmMainUI(
localContext,
data,
on,
{ info, delta -> snackbarFunc("Alarm ${info.id} rings after ${delta.formatTime()}", false) },
{ info -> snackbarFunc("Alarm ${info.id} disabled.", false) },
{ info, delta -> snackBarFunc("Alarm ${info.id} rings after ${delta.formatTime()}", false) },
{ info -> snackBarFunc("Alarm ${info.id} disabled.", false) },
viewModel::toggleAlarm
) },
{ viewModel.removeAlarm(data) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ import com.example.jetpack_compose_all_in_one.features.profile_update.Converter
import com.example.jetpack_compose_all_in_one.features.profile_update.Profile
import com.example.jetpack_compose_all_in_one.features.profile_update.ProfileDao

@Database(entities = [AlarmInfo::class, Profile::class], version = 2, exportSchema = false)
@Database(
entities = [AlarmInfo::class, Profile::class],
version = 2,
exportSchema = false
)
@TypeConverters(Converter::class)
abstract class AppDatabase: RoomDatabase() {
abstract class AppDatabase : RoomDatabase() {
abstract fun getAlarmDao(): AlarmDao

abstract fun getProfileDao(): ProfileDao
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class ChatViewModel @Inject constructor(
override fun onCancelled(error: DatabaseError) {

}

})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,25 @@ class RandomFoxImpl @Inject constructor(@RandomFoxAPI val service: RandomFoxServ
override suspend fun getRandomFoxFlow() =
flow {
service.getRandomFoxUsingCoroutines().apply {
this.body()?.let {
if (!this.isSuccessful){
emit(
ResultState.Success(
it
ResultState.Error<RandomFoxResponse>(
this.message().toString()
)
).runCatching {
)
}else{
this.body()?.let {
emit(
ResultState.Error<RandomFoxResponse>(
it.toString()
ResultState.Success(
it
)
)
).runCatching {
emit(
ResultState.Error<RandomFoxResponse>(
it.toString()
)
)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.example.jetpack_compose_all_in_one.ui.components

import androidx.lifecycle.ViewModel

class ExplandDataVIewModel :ViewModel(){

val
}
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,11 @@ fun AnimatedExpandableCard(item: Country) {
stiffness = Spring.StiffnessMedium
)
)
.clickable { expanded.value = !expanded.value },
.clickable {
expanded.value = !expanded.value


},
) {
Column(
modifier = Modifier
Expand Down

0 comments on commit cb5669e

Please sign in to comment.