This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ru.leroymerlin.library_sdk.screens.product_details | |
import android.media.Rating | |
import androidx.compose.foundation.ExperimentalFoundationApi | |
import androidx.compose.foundation.background | |
import androidx.compose.foundation.layout.* | |
import androidx.compose.foundation.lazy.LazyColumn | |
import androidx.compose.foundation.shape.RoundedCornerShape | |
import androidx.compose.material.* | |
import androidx.compose.runtime.Composable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class GistResponse( | |
val url: String, | |
..., | |
val files: FilesRemote | |
) | |
data class FilesRemote( | |
val filename: FilesFilename | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CatalogVersionRepositoryImpl @Inject constructor( | |
private val catalogVersionRemoteDataSource: CatalogVersionRemoteDataSource, | |
private val catalogVersionLocalDataSource: CatalogVersionLocalDataSource | |
) : CatalogVersionRepository { | |
override fun checkNeedUpdate(): Single<Boolean> { | |
return catalogVersionRemoteDataSource.getCurrentCatalogVersion() | |
.map { remoteCatalogueVersion -> | |
val localCatalogueVersion = catalogVersionLocalDataSource.getCurrentCatalogVersion() | |
val hasActualVersion = localCatalogueVersion == remoteCatalogueVersion |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fields | |
private var needsToBreakCycle = false | |
for (i in 0..<100) { | |
if (needsToBreakCycle) continue | |
// do work | |
} | |
Handler().postDelayed({ | |
needsToBreakCycle = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ExperimentalCoroutinesApi | |
abstract class BaseFlowViewModel<S, A, E>: ViewModel() { | |
private val TAG = BaseFlowViewModel::class.java.simpleName | |
private val _viewStates: MutableStateFlow<S?> = MutableStateFlow(null) | |
fun viewStates(): StateFlow<S?> = _viewStates | |
protected var viewState: S | |
get() = _viewStates.value | |
?: throw UninitializedPropertyAccessException("\"viewState\" was queried before being initialized") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Module | |
@Module | |
class SharedModule { | |
@Provides | |
fun provideConfigurationRepository(context: Context): ConfigurationRepository = | |
ConfigurationRepository( | |
localDataSource = CommonConfigurationDataSource(context), | |
remoteDataSource = MockConfigurationDataSource() | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Pack For XCode | |
val packForXcode by tasks.creating(Sync::class) { | |
group = "build" | |
val mode = System.getenv("CONFIGURATION") ?: "DEBUG" | |
val sdkName = System.getenv("SDK_NAME") ?: "iphonesimulator" | |
val targetName = "ios" + if (sdkName.startsWith("iphoneos")) "Arm64" else "X64" | |
val framework = kotlin.targets.getByName<KotlinNativeTarget>(targetName).binaries.getFramework(mode) | |
inputs.property("mode", mode) | |
dependsOn(framework.linkTask) | |
val targetDir = File(buildDir, "xcode-frameworks") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// ConfigurationModel | |
data class ConfigurationModel( | |
val currentQuestId: Int, | |
val currentQuestPage: Int, | |
val boughtQuestIds: List<Int> | |
) | |
/// Configuration Local Data Source | |
interface ConfigurationLocalDataSource { | |
fun storeConfiguration(configurationModel: ConfigurationModel) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import LMCustomerSDK // Your Kotlin Multiplatform Library | |
import RxSwift | |
struct RxAsyncResult<ResultElement: AnyObject> { | |
#if targetEnvironment(simulator) | |
let async: AsyncResult<ResultElement> | |
#else | |
let async: AsyncResult | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TODO: - Рефакторинг - разбить на более мелкие функции | |
func mainFlowController() -> UIViewController { | |
// NavigationBar setting | |
AppAppearance.applyAppearanceNavigationbBarStyle() | |
AppAppearance.applyAppearanceBarButtonItem() | |
// creates a Home tab | |
let homeVC: HomeViewController = ControllerFactory.createViewController() | |
let homeNav = LMNavigationController(rootViewController: homeVC) | |
homeNav.tabBarItem.title = L10n.ATestHome.title |