Powered by
Why Android?
community
๐ Projects | โญ Stars | ๐ Forks | ๐ Issues | ๐ท๏ธ Stack |
Lady Happy | multi module, custom gradle plugin, dymamic delivery | |||
RadioTok | full compose, support android auto | |||
GrodnoRoads | maps compose, decompose |
Open Source multi-module app for Handmade Hats company with modern approaches under the hood.
Home Page: https://lady-happy.com
License: Apache License 2.0
Powered by
Why Android?
community
๐ Projects | โญ Stars | ๐ Forks | ๐ Issues | ๐ท๏ธ Stack |
Lady Happy | multi module, custom gradle plugin, dymamic delivery | |||
RadioTok | full compose, support android auto | |||
GrodnoRoads | maps compose, decompose |
26.08.21 Load config from firebase
import com.egoriku.ladyhappy.postcreator.domain.predefined.PredefinedData
import com.egoriku.ladyhappy.postcreator.domain.usecase.PublishPostUseCase
import com.egoriku.ladyhappy.postcreator.domain.usecase.UploadImagesUseCase
import com.egoriku.ladyhappy.postcreator.presentation.state.DialogEvent
import com.egoriku.ladyhappy.postcreator.presentation.state.Effect
import com.egoriku.ladyhappy.postcreator.presentation.state.PostState
import com.egoriku.ladyhappy.postcreator.presentation.state.ScreenState
import com.egoriku.ladyhappy.postcreator.presentation.state.ScreenState.Uploading.Stage
import com.google.firebase.Timestamp
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.util.*
const val MAX_IMAGES_SIZE = 10
class PostViewModel(
application: Application,
private val uploadImagesUseCase: UploadImagesUseCase,
private val publishPostUseCase: PublishPostUseCase,
) : AndroidViewModel(application) {
private val _uiState = MutableStateFlow<ScreenState>(ScreenState.None)
val uiState = _uiState.asStateFlow()
private val _postState = MutableStateFlow(PostState())
val postState = _postState.asStateFlow()
private val _publishButtonAvailability = MutableStateFlow(false)
val publishButtonAvailability = _publishButtonAvailability.asStateFlow()
private val _dialogEffects = MutableSharedFlow<DialogEvent>()
val dialogEffects = _dialogEffects.asSharedFlow()
private val _effects = MutableSharedFlow<Effect>()
val effects = _effects.asSharedFlow()
private val _currentPostState
get() = _postState.value
private val subCategoryId: Int
get() = requireNotNull(
_currentPostState.chooserState
.filterIsInstance<ChooserType.SubCategory>()
.firstOrNull()
?.categoryId
)
init {
viewModelScope.launch {
_uiState.emit(ScreenState.Loading)
// TODO: 26.08.21 Load config from firebase
_uiState.emit(ScreenState.CreatePost)
}
}
fun processEffect(effect: Effect) {
viewModelScope.launch {
_effects.emit(effect)
}
}
fun openDialog(type: ChooserType) {
val dialogEvent = when (type) {
is ChooserType.Category -> DialogEvent.Category(
data = PredefinedData.getCategoriesNames()
)
is ChooserType.SubCategory -> DialogEvent.SubCategory(
data = PredefinedData.getSubCategoriesNames(subCategoryId)
)
is ChooserType.Color -> DialogEvent.Color
is ChooserType.CreationDate -> DialogEvent.Date
}
viewModelScope.launch {
_dialogEffects.emit(dialogEvent)
}
}
fun processImageResult(list: List<Uri>) {
val images = _currentPostState.imagesSection.images
val newImages = list.map { ImageItem(uri = it) }
_postState.value = _currentPostState.copy(
imagesSection = ImageSection(images + newImages)
)
1871318460819d14f96bf237fd5a6a6b44598b8e
The project could not be analyzed because of maven build errors. Please review the error messages here. Another build will be scheduled within 24 hours. If the build is successful this issue will be closed, otherwise the error message will be updated.
This is an automated GitHub Issue created by Sonatype DepShield. GitHub Apps, including DepShield, can be managed from the Developer settings of the repository administrators.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.