optimize imports and format code for all files :)
This commit is contained in:
parent
cefa85ae22
commit
62bca72d0f
56 changed files with 310 additions and 239 deletions
|
@ -29,7 +29,8 @@ fun DrawerScreenTemplate(
|
|||
Scaffold(
|
||||
scaffoldState = scaffoldState,
|
||||
|
||||
topBar = { TopAppBar(
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
title = { Text(text = title) },
|
||||
navigationIcon = {
|
||||
IconButton(onClick = {
|
||||
|
@ -42,7 +43,8 @@ fun DrawerScreenTemplate(
|
|||
}
|
||||
},
|
||||
actions = barAction
|
||||
)},
|
||||
)
|
||||
},
|
||||
|
||||
drawerContent = {
|
||||
Drawer(drawerActions)
|
||||
|
@ -55,10 +57,12 @@ fun DrawerScreenTemplate(
|
|||
@Preview
|
||||
@Composable
|
||||
fun DrawerScreenPreview() {
|
||||
StudeezTheme { DrawerScreenTemplate(
|
||||
StudeezTheme {
|
||||
DrawerScreenTemplate(
|
||||
title = "Drawer screen preview",
|
||||
drawerActions = DrawerActions({}, {}, {}, {}, {})
|
||||
) {
|
||||
Text(text = "Preview content")
|
||||
} }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -131,15 +131,19 @@ fun ExpandedEntry(
|
|||
@Preview
|
||||
@Composable
|
||||
fun AddButtonPreview() {
|
||||
StudeezTheme { AddButton(
|
||||
StudeezTheme {
|
||||
AddButton(
|
||||
addButtonActions = AddButtonActions({}, {}, {})
|
||||
)}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun ExpandedAddButtonPreview() {
|
||||
StudeezTheme { ExpandedAddButton (
|
||||
StudeezTheme {
|
||||
ExpandedAddButton(
|
||||
addButtonActions = AddButtonActions({}, {}, {})
|
||||
) }
|
||||
)
|
||||
}
|
||||
}
|
|
@ -57,11 +57,15 @@ fun PrimaryScreenTemplate(
|
|||
bottomBar = { NavigationBar(navigationBarActions) },
|
||||
floatingActionButtonPosition = FabPosition.Center,
|
||||
isFloatingActionButtonDocked = true,
|
||||
floatingActionButton = { AddButton(AddButtonActions(
|
||||
floatingActionButton = {
|
||||
AddButton(
|
||||
AddButtonActions(
|
||||
onTaskClick = navigationBarActions.onAddTaskClick,
|
||||
onFriendClick = navigationBarActions.onAddFriendClick,
|
||||
onSessionClick = navigationBarActions.onAddSessionClick
|
||||
)) }
|
||||
)
|
||||
)
|
||||
}
|
||||
) {
|
||||
content(it)
|
||||
}
|
||||
|
|
|
@ -21,7 +21,8 @@ fun SecondaryScreenTemplate(
|
|||
) {
|
||||
Scaffold(
|
||||
// Everything at the top of the screen
|
||||
topBar = { TopAppBar(
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
title = { Text(text = title) },
|
||||
navigationIcon = {
|
||||
IconButton(onClick = { popUp() }) {
|
||||
|
@ -32,7 +33,8 @@ fun SecondaryScreenTemplate(
|
|||
}
|
||||
},
|
||||
actions = barAction
|
||||
) },
|
||||
)
|
||||
},
|
||||
) { paddingValues ->
|
||||
content(paddingValues)
|
||||
}
|
||||
|
@ -41,8 +43,10 @@ fun SecondaryScreenTemplate(
|
|||
@Preview
|
||||
@Composable
|
||||
fun SecondaryScreenToolbarPreview() {
|
||||
StudeezTheme { SecondaryScreenTemplate(
|
||||
StudeezTheme {
|
||||
SecondaryScreenTemplate(
|
||||
"Preview screen",
|
||||
{}
|
||||
) {} }
|
||||
) {}
|
||||
}
|
||||
}
|
|
@ -161,7 +161,6 @@ fun LabeledErrorTextField(
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun IntInputPreview() {
|
||||
|
|
|
@ -82,7 +82,11 @@ fun TimePickerButton(
|
|||
}
|
||||
}
|
||||
|
||||
private fun pickDuration(context: Context, onTimeChosen: (Int) -> Unit, timeState: MutableState<Int>) {
|
||||
private fun pickDuration(
|
||||
context: Context,
|
||||
onTimeChosen: (Int) -> Unit,
|
||||
timeState: MutableState<Int>
|
||||
) {
|
||||
val listener = OnTimeSetListener { _, hour, minute ->
|
||||
timeState.value = HoursMinutesSeconds(hour, minute, 0).getTotalSeconds()
|
||||
onTimeChosen(timeState.value)
|
||||
|
|
|
@ -2,12 +2,7 @@ package be.ugent.sel.studeez.common.composable.drawer
|
|||
|
||||
import android.content.Context
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.icons.Icons
|
||||
|
|
|
@ -3,8 +3,6 @@ package be.ugent.sel.studeez.common.composable.drawer
|
|||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import be.ugent.sel.studeez.domain.AccountDAO
|
||||
import be.ugent.sel.studeez.domain.LogService
|
||||
import be.ugent.sel.studeez.navigation.StudeezDestinations
|
||||
|
|
|
@ -8,8 +8,6 @@ import androidx.compose.material.icons.Icons
|
|||
import androidx.compose.material.icons.filled.Check
|
||||
import androidx.compose.material.icons.filled.List
|
||||
import androidx.compose.material.icons.filled.Person
|
||||
import androidx.compose.material.icons.outlined.Check
|
||||
import androidx.compose.material.icons.outlined.DateRange
|
||||
import androidx.compose.material.icons.outlined.Face
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
|
|
|
@ -6,11 +6,15 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.unit.dp
|
||||
|
||||
fun Modifier.textButton(): Modifier {
|
||||
return this.fillMaxWidth().padding(16.dp, 8.dp, 16.dp, 0.dp)
|
||||
return this
|
||||
.fillMaxWidth()
|
||||
.padding(16.dp, 8.dp, 16.dp, 0.dp)
|
||||
}
|
||||
|
||||
fun Modifier.basicButton(): Modifier {
|
||||
return this.fillMaxWidth().padding(16.dp, 8.dp)
|
||||
return this
|
||||
.fillMaxWidth()
|
||||
.padding(16.dp, 8.dp)
|
||||
}
|
||||
|
||||
fun Modifier.card(): Modifier {
|
||||
|
@ -26,7 +30,9 @@ fun Modifier.dropdownSelector(): Modifier {
|
|||
}
|
||||
|
||||
fun Modifier.fieldModifier(): Modifier {
|
||||
return this.fillMaxWidth().padding(16.dp, 4.dp)
|
||||
return this
|
||||
.fillMaxWidth()
|
||||
.padding(16.dp, 4.dp)
|
||||
}
|
||||
|
||||
fun Modifier.toolbarActions(): Modifier {
|
||||
|
@ -34,9 +40,13 @@ fun Modifier.toolbarActions(): Modifier {
|
|||
}
|
||||
|
||||
fun Modifier.spacer(): Modifier {
|
||||
return this.fillMaxWidth().padding(12.dp)
|
||||
return this
|
||||
.fillMaxWidth()
|
||||
.padding(12.dp)
|
||||
}
|
||||
|
||||
fun Modifier.smallSpacer(): Modifier {
|
||||
return this.fillMaxWidth().height(8.dp)
|
||||
return this
|
||||
.fillMaxWidth()
|
||||
.height(8.dp)
|
||||
}
|
|
@ -2,7 +2,6 @@ package be.ugent.sel.studeez.data.local.models.timer_info
|
|||
|
||||
import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalPomodoroTimer
|
||||
import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalTimer
|
||||
import be.ugent.sel.studeez.data.local.models.timer_functional.FunctionalTimerVisitor
|
||||
|
||||
class PomodoroTimerInfo(
|
||||
name: String,
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package be.ugent.sel.studeez.domain
|
||||
|
||||
import be.ugent.sel.studeez.data.local.models.FeedEntry
|
||||
import be.ugent.sel.studeez.data.local.models.SessionReport
|
||||
import be.ugent.sel.studeez.data.local.models.User
|
||||
import be.ugent.sel.studeez.data.local.models.task.Task
|
||||
import be.ugent.sel.studeez.data.local.models.timer_info.TimerInfo
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package be.ugent.sel.studeez.domain
|
||||
|
||||
import be.ugent.sel.studeez.data.local.models.timer_info.TimerInfo
|
||||
import be.ugent.sel.studeez.data.local.models.timer_info.TimerJson
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface TimerDAO {
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package be.ugent.sel.studeez.domain.implementation
|
||||
|
||||
import be.ugent.sel.studeez.data.local.models.timer_info.*
|
||||
import be.ugent.sel.studeez.data.local.models.timer_info.TimerInfo
|
||||
import be.ugent.sel.studeez.data.local.models.timer_info.TimerJson
|
||||
import be.ugent.sel.studeez.domain.ConfigurationService
|
||||
import com.google.firebase.ktx.Firebase
|
||||
import com.google.firebase.remoteconfig.ktx.get
|
||||
import com.google.firebase.remoteconfig.ktx.remoteConfig
|
||||
import com.google.firebase.remoteconfig.ktx.remoteConfigSettings
|
||||
import com.google.gson.Gson
|
||||
import kotlinx.coroutines.tasks.await
|
||||
import javax.inject.Inject
|
||||
|
||||
|
|
|
@ -109,7 +109,11 @@ class FirebaseFeedDAO @Inject constructor(
|
|||
return makeFeedEntry(sessionReport, subject, task)
|
||||
}
|
||||
|
||||
private fun makeFeedEntry(sessionReport: SessionReport, subject: Subject, task: Task): FeedEntry {
|
||||
private fun makeFeedEntry(
|
||||
sessionReport: SessionReport,
|
||||
subject: Subject,
|
||||
task: Task
|
||||
): FeedEntry {
|
||||
return FeedEntry(
|
||||
argb_color = subject.argb_color,
|
||||
subJectName = subject.name,
|
||||
|
@ -125,7 +129,10 @@ class FirebaseFeedDAO @Inject constructor(
|
|||
/**
|
||||
* Convert a sessionReport to a feedEntry. Fetch Task and Subject to get names
|
||||
*/
|
||||
private suspend fun sessionToFeedEntryFromUser(sessionReport: SessionReport, id: String): FeedEntry {
|
||||
private suspend fun sessionToFeedEntryFromUser(
|
||||
sessionReport: SessionReport,
|
||||
id: String
|
||||
): FeedEntry {
|
||||
val subjectId: String = sessionReport.subjectId
|
||||
val taskId: String = sessionReport.taskId
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ import kotlinx.coroutines.flow.Flow
|
|||
import kotlinx.coroutines.flow.catch
|
||||
import kotlinx.coroutines.flow.flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.tasks.await
|
||||
import javax.inject.Inject
|
||||
import kotlin.coroutines.resume
|
||||
import kotlin.coroutines.resumeWithException
|
||||
|
@ -89,21 +88,25 @@ class FirebaseFriendshipDAO @Inject constructor(
|
|||
// Add entry to current user
|
||||
currentUserDocument()
|
||||
.collection(FRIENDS_COLLECTION)
|
||||
.add(mapOf(
|
||||
.add(
|
||||
mapOf(
|
||||
FRIENDID to otherUserId,
|
||||
ACCEPTED to true, // TODO Make it not automatically accepted.
|
||||
FRIENDSSINCE to Timestamp.now()
|
||||
))
|
||||
)
|
||||
)
|
||||
|
||||
// Add entry to other user
|
||||
firestore.collection(USER_COLLECTION)
|
||||
.document(otherUserId)
|
||||
.collection(FRIENDS_COLLECTION)
|
||||
.add(mapOf(
|
||||
.add(
|
||||
mapOf(
|
||||
FRIENDID to currentUserId,
|
||||
ACCEPTED to true, // TODO Make it not automatically accepted.
|
||||
FRIENDSSINCE to Timestamp.now()
|
||||
))
|
||||
)
|
||||
)
|
||||
}
|
||||
}.addOnSuccessListener {
|
||||
val message = if (allowed) AppText.success else AppText.already_friend
|
||||
|
|
|
@ -1,24 +1,15 @@
|
|||
package be.ugent.sel.studeez.domain.implementation
|
||||
|
||||
import be.ugent.sel.studeez.data.local.models.FeedEntry
|
||||
import be.ugent.sel.studeez.data.local.models.SessionReport
|
||||
import be.ugent.sel.studeez.data.local.models.User
|
||||
import be.ugent.sel.studeez.data.local.models.task.Task
|
||||
import be.ugent.sel.studeez.data.local.models.timer_info.TimerInfo
|
||||
import be.ugent.sel.studeez.data.remote.FirebaseSessionReport
|
||||
import be.ugent.sel.studeez.data.remote.FirebaseSessionReport.ENDTIME
|
||||
import be.ugent.sel.studeez.data.remote.FirebaseSessionReport.STUDYTIME
|
||||
import be.ugent.sel.studeez.domain.*
|
||||
import be.ugent.sel.studeez.domain.AccountDAO
|
||||
import be.ugent.sel.studeez.domain.SessionDAO
|
||||
import be.ugent.sel.studeez.domain.implementation.FirebaseCollections.SESSION_COLLECTION
|
||||
import be.ugent.sel.studeez.domain.implementation.FirebaseCollections.USER_COLLECTION
|
||||
import com.google.firebase.Timestamp
|
||||
import com.google.firebase.firestore.CollectionReference
|
||||
import com.google.firebase.firestore.FirebaseFirestore
|
||||
import com.google.firebase.firestore.ktx.getField
|
||||
import com.google.firebase.firestore.ktx.snapshots
|
||||
import com.google.firebase.firestore.ktx.toObject
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.emptyFlow
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.tasks.await
|
||||
import javax.inject.Inject
|
||||
|
|
|
@ -82,7 +82,10 @@ class FirebaseSubjectDAO @Inject constructor(
|
|||
.document(id)
|
||||
.collection(FirebaseCollections.SUBJECT_COLLECTION)
|
||||
|
||||
private fun subjectTasksCollection(subject: Subject, id: String = auth.currentUserId): CollectionReference =
|
||||
private fun subjectTasksCollection(
|
||||
subject: Subject,
|
||||
id: String = auth.currentUserId
|
||||
): CollectionReference =
|
||||
firestore.collection(FirebaseCollections.USER_COLLECTION)
|
||||
.document(id)
|
||||
.collection(FirebaseCollections.SUBJECT_COLLECTION)
|
||||
|
|
|
@ -51,7 +51,10 @@ class FirebaseTaskDAO @Inject constructor(
|
|||
selectedSubjectTasksCollection(oldTask.subjectId).document(oldTask.id).delete()
|
||||
}
|
||||
|
||||
private fun selectedSubjectTasksCollection(subjectId: String, id: String = auth.currentUserId): CollectionReference =
|
||||
private fun selectedSubjectTasksCollection(
|
||||
subjectId: String,
|
||||
id: String = auth.currentUserId
|
||||
): CollectionReference =
|
||||
firestore.collection(FirebaseCollections.USER_COLLECTION)
|
||||
.document(id)
|
||||
.collection(FirebaseCollections.SUBJECT_COLLECTION)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package be.ugent.sel.studeez.domain.implementation
|
||||
|
||||
import be.ugent.sel.studeez.data.local.models.timer_info.*
|
||||
import be.ugent.sel.studeez.data.local.models.timer_info.TimerInfo
|
||||
import be.ugent.sel.studeez.data.local.models.timer_info.TimerJson
|
||||
import be.ugent.sel.studeez.domain.AccountDAO
|
||||
import be.ugent.sel.studeez.domain.TimerDAO
|
||||
import com.google.firebase.firestore.CollectionReference
|
||||
|
|
|
@ -80,10 +80,12 @@ class FirebaseUserDAO @Inject constructor(
|
|||
newUsername: String,
|
||||
newBiography: String
|
||||
) {
|
||||
currentUserDocument().set(mapOf(
|
||||
currentUserDocument().set(
|
||||
mapOf(
|
||||
USERNAME to newUsername,
|
||||
BIOGRAPHY to newBiography
|
||||
))
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun deleteLoggedInUserReferences() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package be.ugent.sel.studeez.domain.implementation
|
||||
|
||||
import be.ugent.sel.studeez.data.local.models.timer_info.*
|
||||
import be.ugent.sel.studeez.domain.implementation.ToTimerConverter.TimerFactory
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
|
||||
|
@ -19,25 +20,31 @@ class ToTimerConverter {
|
|||
}
|
||||
|
||||
private val timerInfoMap: Map<TimerType, TimerFactory> = mapOf(
|
||||
TimerType.ENDLESS to TimerFactory { EndlessTimerInfo(
|
||||
TimerType.ENDLESS to TimerFactory {
|
||||
EndlessTimerInfo(
|
||||
it.name,
|
||||
it.description,
|
||||
it.id
|
||||
) },
|
||||
TimerType.CUSTOM to TimerFactory { CustomTimerInfo(
|
||||
)
|
||||
},
|
||||
TimerType.CUSTOM to TimerFactory {
|
||||
CustomTimerInfo(
|
||||
it.name,
|
||||
it.description,
|
||||
it.studyTime,
|
||||
it.id
|
||||
) },
|
||||
TimerType.BREAK to TimerFactory { PomodoroTimerInfo(
|
||||
)
|
||||
},
|
||||
TimerType.BREAK to TimerFactory {
|
||||
PomodoroTimerInfo(
|
||||
it.name,
|
||||
it.description,
|
||||
it.studyTime,
|
||||
it.breakTime,
|
||||
it.repeats,
|
||||
it.id
|
||||
) }
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
private fun getTimer(timerJson: TimerJson): TimerInfo {
|
||||
|
|
|
@ -112,7 +112,12 @@ fun StudeezNavGraph(
|
|||
|
||||
composable(StudeezDestinations.TASKS_SCREEN) {
|
||||
TaskRoute(
|
||||
goBack = { openAndPopUp(StudeezDestinations.SUBJECT_SCREEN, StudeezDestinations.TASKS_SCREEN) },
|
||||
goBack = {
|
||||
openAndPopUp(
|
||||
StudeezDestinations.SUBJECT_SCREEN,
|
||||
StudeezDestinations.TASKS_SCREEN
|
||||
)
|
||||
},
|
||||
open = open,
|
||||
viewModel = hiltViewModel(),
|
||||
)
|
||||
|
|
|
@ -208,7 +208,11 @@ fun FriendsEntry(
|
|||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
Text(
|
||||
text = "${resources().getString(AppText.app_name)} ${resources().getString(AppText.friend)}",
|
||||
text = "${resources().getString(AppText.app_name)} ${
|
||||
resources().getString(
|
||||
AppText.friend
|
||||
)
|
||||
}",
|
||||
fontSize = 14.sp,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
|
|
|
@ -23,9 +23,11 @@ class FriendsOverviewViewModel @Inject constructor(
|
|||
logService: LogService
|
||||
) : StudeezViewModel(logService) {
|
||||
|
||||
var uiState = mutableStateOf(FriendsOverviewUiState(
|
||||
var uiState = mutableStateOf(
|
||||
FriendsOverviewUiState(
|
||||
userId = selectedUserIdState.value
|
||||
))
|
||||
)
|
||||
)
|
||||
private set
|
||||
|
||||
fun getAllFriends(): Flow<List<Pair<User, Friendship>>> {
|
||||
|
|
|
@ -123,21 +123,29 @@ fun SearchFriendsPreview() {
|
|||
popUp = {},
|
||||
uiState = SearchFriendUiState(
|
||||
queryString = "dit is een test",
|
||||
searchResults = flowOf(listOf(User(
|
||||
searchResults = flowOf(
|
||||
listOf(
|
||||
User(
|
||||
id = "someid",
|
||||
username = "Eerste user",
|
||||
biography = "blah blah blah"
|
||||
)))
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
searchFriendsActions = SearchFriendsActions(
|
||||
onQueryStringChange = {},
|
||||
getUsersWithUsername = {},
|
||||
getAllUsers = {
|
||||
flowOf(listOf(User(
|
||||
flowOf(
|
||||
listOf(
|
||||
User(
|
||||
id = "someid",
|
||||
username = "Eerste user",
|
||||
biography = "blah blah blah"
|
||||
)))
|
||||
)
|
||||
)
|
||||
)
|
||||
},
|
||||
goToProfile = { }
|
||||
)
|
||||
|
@ -178,7 +186,11 @@ fun UserEntry(
|
|||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
Text(
|
||||
text = "${resources().getString(AppText.app_name)} ${resources().getString(AppText.friend)}",
|
||||
text = "${resources().getString(AppText.app_name)} ${
|
||||
resources().getString(
|
||||
AppText.friend
|
||||
)
|
||||
}",
|
||||
fontSize = 14.sp,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
package be.ugent.sel.studeez.screens.home
|
||||
|
||||
import be.ugent.sel.studeez.domain.LogService
|
||||
import be.ugent.sel.studeez.navigation.StudeezDestinations
|
||||
import be.ugent.sel.studeez.screens.StudeezViewModel
|
||||
|
|
|
@ -92,7 +92,8 @@ fun ProfileScreen(
|
|||
item {
|
||||
Row(
|
||||
horizontalArrangement = Arrangement.spacedBy(5.dp),
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.wrapContentWidth(align = Alignment.CenterHorizontally)
|
||||
) {
|
||||
AmountOfFriendsButton(
|
||||
|
|
|
@ -39,9 +39,11 @@ fun getPublicProfileActions(
|
|||
): PublicProfileActions {
|
||||
return PublicProfileActions(
|
||||
getUserDetails = { viewModel.getUserDetails(viewModel.uiState.value.userId) },
|
||||
getAmountOfFriends = { viewModel.getAmountOfFriends(
|
||||
getAmountOfFriends = {
|
||||
viewModel.getAmountOfFriends(
|
||||
userId = viewModel.uiState.value.userId
|
||||
) },
|
||||
)
|
||||
},
|
||||
onViewFriendsClick = { viewModel.onViewFriendsClick(open) },
|
||||
sendFriendRequest = {
|
||||
viewModel.sendFriendRequest(
|
||||
|
@ -123,11 +125,13 @@ fun PublicProfilePreview() {
|
|||
PublicProfileScreen(
|
||||
publicProfileActions = PublicProfileActions(
|
||||
getUserDetails = {
|
||||
flowOf(User(
|
||||
flowOf(
|
||||
User(
|
||||
id = "someid",
|
||||
username = "Maxime De Poorter",
|
||||
biography = "I am a different student and this is my public profile"
|
||||
))
|
||||
)
|
||||
)
|
||||
},
|
||||
getAmountOfFriends = { flowOf(113) },
|
||||
onViewFriendsClick = {},
|
||||
|
|
|
@ -39,7 +39,8 @@ fun SessionRoute(
|
|||
|
||||
val soundPlayer = SoundPlayer(LocalContext.current)
|
||||
val sessionActions = getSessionActions(viewModel, openAndPopUp)
|
||||
val sessionScreen = viewModel.getTimer().accept(GetSessionScreenComposable(soundPlayer, open, sessionActions))
|
||||
val sessionScreen =
|
||||
viewModel.getTimer().accept(GetSessionScreenComposable(soundPlayer, open, sessionActions))
|
||||
|
||||
sessionScreen()
|
||||
}
|
||||
|
|
|
@ -57,11 +57,13 @@ private fun Dots(pomodoroTimer: FunctionalPomodoroTimer): Int {
|
|||
|
||||
@Composable
|
||||
private fun Dot(color: Color) {
|
||||
Box(modifier = Modifier
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.padding(5.dp)
|
||||
.size(10.dp)
|
||||
.clip(CircleShape)
|
||||
.background(color))
|
||||
.background(color)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,8 @@ class GetSessionScreenComposable(
|
|||
FunctionalTimerVisitor<@Composable () -> Unit> {
|
||||
|
||||
override fun visitFunctionalCustomTimer(functionalCustomTimer: FunctionalCustomTimer): @Composable () -> Unit {
|
||||
return { CustomTimerSessionScreenComposable(
|
||||
return {
|
||||
CustomTimerSessionScreenComposable(
|
||||
open = open,
|
||||
sessionActions = sessionActions,
|
||||
soundPlayer = soundPlayer,
|
||||
|
|
|
@ -135,9 +135,11 @@ fun SessionRecapScreenPreview() {
|
|||
SessionRecapScreen(
|
||||
modifier = Modifier,
|
||||
sessionRecapActions = SessionRecapActions(
|
||||
{ SessionReport(
|
||||
{
|
||||
SessionReport(
|
||||
studyTime = 100,
|
||||
) },
|
||||
)
|
||||
},
|
||||
{},
|
||||
{},
|
||||
)
|
||||
|
|
|
@ -35,6 +35,7 @@ class SignUpViewModel @Inject constructor(
|
|||
fun onUsernameChange(newValue: String) {
|
||||
uiState.value = uiState.value.copy(username = newValue)
|
||||
}
|
||||
|
||||
fun onEmailChange(newValue: String) {
|
||||
uiState.value = uiState.value.copy(email = newValue)
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ class BreakTimerFormScreen(
|
|||
) : AbstractTimerFormScreen(breakTimerInfo) {
|
||||
|
||||
|
||||
|
||||
@Composable
|
||||
override fun ExtraFields() {
|
||||
// If the user presses the OK button on the timepicker, the time in the button should change
|
||||
|
|
|
@ -40,7 +40,9 @@ fun TimerTypeSelectScreen(
|
|||
val default: TimerInfo = defaultTimerInfo.getValue(timerType)
|
||||
Button(
|
||||
onClick = { viewModel.onTimerTypeChosen(default, open) },
|
||||
modifier = Modifier.fillMaxWidth().padding(5.dp)
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(5.dp)
|
||||
) {
|
||||
Text(text = timerType.name)
|
||||
}
|
||||
|
|
|
@ -68,11 +68,13 @@ fun TimerOverviewScreen(
|
|||
LazyColumn {
|
||||
// Custom timer, select new duration each time
|
||||
item {
|
||||
TimerEntry(timerInfo = CustomTimerInfo(
|
||||
TimerEntry(
|
||||
timerInfo = CustomTimerInfo(
|
||||
name = resources().getString(R.string.custom_name),
|
||||
description = resources().getString(R.string.custom_name),
|
||||
studyTime = 0
|
||||
))
|
||||
)
|
||||
)
|
||||
}
|
||||
// Default Timers, cannot be edited
|
||||
items(timerOverviewActions.getDefaultTimers()) {
|
||||
|
|
Reference in a new issue