Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@ class AppPreferencesServiceImpl @Inject constructor(
preferences.edit { putString(PreferencesKeys.CONTENT_RESTRICTION_KEY, level.name) }
_contentRestrictionLevel.value = level
}

//endregion

override fun clearAllPreferences() = preferences.edit { clear() }

private object PreferencesKeys {
const val HAS_ONBOARDING_BEEN_SHOWN = "has_onboarding_been_shown"
const val CONTENT_RESTRICTION_KEY = "content_restriction_key"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import com.london.data.remote.source.account.AccountRemoteDataSource
import com.london.data.remote.source.authentication.AuthenticationRemoteDataSource
import com.london.data.utils.isFailure
import com.london.domain.repository.AuthenticationRepository
import com.london.domain.service.AppPreferencesService
import javax.inject.Inject

class AuthenticationRepositoryImpl @Inject constructor(
private val authenticationRemoteDataSource: AuthenticationRemoteDataSource,
private val accountRemoteDataSource: AccountRemoteDataSource,
private val authenticationPreferences: AuthenticationPreferences,
private val customMovieListLocalDataSource: CustomMovieListLocalDataSource
private val customMovieListLocalDataSource: CustomMovieListLocalDataSource,
private val appPreferencesService: AppPreferencesService
) : AuthenticationRepository {

override suspend fun login(username: String, password: String): Boolean {
Expand Down Expand Up @@ -52,6 +54,7 @@ class AuthenticationRepositoryImpl @Inject constructor(
}
customMovieListLocalDataSource.clearAllCache()
authenticationPreferences.clearAuthentication()
appPreferencesService.clearAllPreferences()
return true
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fun FloatingActionButton(
) {
if (isDisabledIcon || isDefaultIcon) {
Icon(
painter = painterResource(id = R.drawable.icon_add),
painter = painterResource(id = R.drawable.add_icon),
contentDescription = "Add button",
modifier = Modifier.size(24.dp)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private fun PreviewNormalOutlineButton() {
isLoading = false,
hasIcon = false,
hasLabel = true,
icon = R.drawable.icon_add
icon = R.drawable.add_icon
)
}
}
Expand Down Expand Up @@ -130,7 +130,7 @@ private fun PreviewOutlinePrimaryWithIcon() {
isLoading = false,
hasIcon = true,
hasLabel = true,
icon = R.drawable.icon_add
icon = R.drawable.add_icon
)
}
}
Expand All @@ -145,7 +145,7 @@ private fun PreviewPrimaryWithIconOnly() {
isLoading = false,
hasIcon = true,
hasLabel = false,
icon = R.drawable.icon_add
icon = R.drawable.add_icon

)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private fun PreviewPrimaryNormal() {
enabled = false,
hasIcon = false,
hasLabel = true,
icon = R.drawable.icon_add
icon = R.drawable.add_icon
)
}
}
Expand Down Expand Up @@ -137,7 +137,7 @@ private fun PreviewPrimaryWithTextAndIcon() {
enabled = false,
hasIcon = true,
hasLabel = true,
icon = R.drawable.icon_add
icon = R.drawable.add_icon
)
}
}
Expand All @@ -153,7 +153,7 @@ private fun PreviewPrimaryWithIcon() {
enabled = false,
hasIcon = true,
hasLabel = false,
icon = R.drawable.icon_add
icon = R.drawable.add_icon

)
}
Expand Down
Binary file not shown.
Binary file removed designSystem/src/main/res/drawable-mdpi/icon_add.png
Binary file not shown.
Binary file not shown.
Binary file removed designSystem/src/main/res/drawable-xhdpi/icon_add.png
Binary file not shown.
Binary file not shown.
Binary file removed designSystem/src/main/res/drawable-xxhdpi/icon_add.png
Binary file not shown.
Binary file not shown.
Binary file removed designSystem/src/main/res/drawable-xxxhdpi/icon_add.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed designSystem/src/main/res/drawable/polygon1.png
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ interface AppPreferencesService {

val contentRestrictionLevel: StateFlow<ContentRestrictionLevel>
fun setContentRestrictionLevel(level: ContentRestrictionLevel)

fun clearAllPreferences()
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,6 @@ private fun Content(
.zIndex(1f)
)

Image(
painter = painterResource(dsR.drawable.polygon1),
contentDescription = stringResource(R.string.app_icon),
modifier = Modifier
.align(Alignment.TopStart)
.offset(y = (-60).dp, x = (-20).dp)
)

Column(
modifier = Modifier
.fillMaxSize()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
Expand Down Expand Up @@ -54,6 +55,7 @@ import com.london.presentation.shared.BackgroundGradient
import com.london.presentation.shared.base.ErrorState
import com.london.presentation.shared.buildscreen.BuildScreen
import com.london.presentation.utils.Listen
import com.london.presentation.utils.navBarBottomPadding
import com.london.presentation.utils.toLocalizedNumbers

@Composable
Expand Down Expand Up @@ -86,7 +88,9 @@ private fun Content(
val pagingItems = state.items.collectAsLazyPagingItems()

Box(
modifier = Modifier.fillMaxSize()
modifier = Modifier
.fillMaxSize()
.navBarBottomPadding()
) {

BuildScreen(
Expand All @@ -96,7 +100,12 @@ private fun Content(
pagingFlow = pagingItems,
isGuest = state.isGuest,
guestContent = { NoListFoundAsGuest(onLoginClick = contract::onLoginClick) },
emptyContent = { EmptyList(contract = contract, addListSheetState = state.addListSheetState) },
emptyContent = {
EmptyList(
contract = contract,
addListSheetState = state.addListSheetState
)
},
handlePagingLoadingAutomatically = true
) {

Expand Down Expand Up @@ -128,6 +137,8 @@ private fun Content(
}
}

ListFAB(contract::onFabClick)

AddListBottomSheet(
addListInteractions = contract,
addListSheetState = state.addListSheetState
Expand Down Expand Up @@ -158,30 +169,28 @@ private fun Content(

@Composable
private fun ScreenScaffold(
titleRes: Int,
showFab: Boolean = true,
onFabClick: (() -> Unit)? = null,
content: @Composable () -> Unit,
) {

Box(
modifier = Modifier.fillMaxSize()
) {
Box(modifier = Modifier.fillMaxSize()) {
content()

if (showFab && onFabClick != null) {
FloatingActionButton(
modifier = Modifier
.align(Alignment.BottomEnd)
.padding(bottom = 16.dp, end = 16.dp),
onClick = onFabClick,
isLoadingIcon = false,
isDisabledIcon = false,
isDefaultIcon = true
)
}
onFabClick?.let { ListFAB(onFabClick) }
}
}

@Composable
fun BoxScope.ListFAB(
onFabClick: () -> Unit
) {
FloatingActionButton(
modifier = Modifier
.align(Alignment.BottomEnd)
.padding(bottom = 16.dp, end = 16.dp),
onClick = onFabClick,
isLoadingIcon = false,
isDisabledIcon = false,
isDefaultIcon = true
)
}

@Composable
Expand Down Expand Up @@ -248,9 +257,7 @@ private fun EmptyList(
addListSheetState: AddSheetState
) {
ScreenScaffold(
titleRes = R.string.saved_list_title,
onFabClick = contract::onFabClick,
showFab = true,
onFabClick = contract::onFabClick
) {
Box(
modifier = Modifier
Expand Down Expand Up @@ -280,10 +287,7 @@ private fun NoListFoundAsGuest(
onLoginClick: () -> Unit,
modifier: Modifier = Modifier
) {
ScreenScaffold(
titleRes = R.string.saved_list_title,
showFab = false
) {
ScreenScaffold {
Box(
modifier = Modifier.fillMaxSize()
) {
Expand Down
Loading