This file contains 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 org.kodein.di.* | |
import org.kodein.di.bindings.Scope | |
import org.kodein.di.bindings.ScopeRegistry | |
import org.kodein.di.bindings.StandardScopeRegistry | |
import java.util.concurrent.ConcurrentHashMap | |
import java.util.concurrent.atomic.AtomicReference | |
enum class Environment(val baseUrl: String) { | |
DEBUG("http://localhost"), | |
PROD("https://api.awesome-service.com") |
This file contains 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
object SecurityManager { | |
fun isPackageNameAllowed( | |
context: Context, | |
packageName: String, | |
allowedApps: Map<String, String> | |
): Boolean { | |
return if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) { | |
isPackageNameAllowedApi27Down(context, packageName, allowedApps) | |
} else { | |
isPackageNameAllowedApi28Up(context, packageName, allowedApps) |
This file contains 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
* To test in-app updates the app must be released at least once before to any track | |
* The application ID must match, but the signature doesn't since Play Store has its own signature for apps shared via Internal App Sharing links | |
* If the app has custom country availability, which happens to not include the country of the tester, a new track must be create | |
with a custom country availability that includes also the country of the tester. In case this is not followed, the tester will | |
see an error related to purchase not available in his country. | |
* When using test tracks, the testers Google account must be in the testers list and they must opt-in. | |
* Upload the test build to https://play.google.com/console/internal-app-sharing | |
* The tester must download and install the app at least once from the Internal App Sharing before testing in-app update | |
* Once the app is installed at least once, the tester should open the new link, but not install the update from there. Instead | |
he should navigate to the app and test the in- |
This file contains 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
# Path to your oh-my-zsh installation. | |
export ZSH="$HOME/.oh-my-zsh" | |
# Set name of the theme to load --- if set to "random", it will | |
# load a random theme each time oh-my-zsh is loaded, in which case, | |
# to know which specific one was loaded, run: echo $RANDOM_THEME | |
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes | |
ZSH_THEME="robbyrussell" |
This file contains 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
/* | |
* Copyright 2020 Nimrod Dayan nimroddayan.com | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains 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 WorkoutSummaryController : TypedEpoxyController<WorkoutSummaryViewState>( | |
EpoxyAsyncUtil.getAsyncBackgroundHandler(), | |
EpoxyAsyncUtil.getAsyncBackgroundHandler()) { | |
override fun buildModels(viewState: WorkoutSummaryViewState) { | |
addLikes(viewState) | |
addLoadingIndicatorIfNeed(viewState) | |
} |
This file contains 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 WorkoutSummaryActivity : AppCompatActivity() { | |
private lateinit var binding: WorkoutSummaryActivityBinding | |
private val viewModel: WorkoutSummaryViewModel by viewModels() | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
// We use View Binding here | |
binding = WorkoutSummaryActivityBinding.inflate(layoutInflater) | |
setContentView(binding.root) | |
This file contains 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 WorkoutSummaryViewModel : ViewModel() { | |
private val _viewState = MutableLiveData<WorkoutSummaryViewState>() | |
val viewState: LiveData<WorkoutSummaryViewState> = _viewState | |
// Conflated channel makes sure that we always keep only the last emitted item | |
// other channels have been omitted for brevity | |
private val likesItemChannel = ConflatedBroadcastChannel<ViewState<LikesItem>>() | |
fun loadData(workoutId: Int) { | |
viewModelScope.launch { |
This file contains 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 WorkoutSummaryViewState( | |
val workoutId: Int, | |
val coverImagesItem: ViewState<CoverImagesItem>, | |
val likesItem: ViewState<LikesItem>, | |
val commentsItem: ViewState<CommentsItem>, | |
val workoutSummaryItem: ViewState<WorkoutSummaryItem> | |
) | |
typealias OnClickHandler = (workoutId: Int) -> Unit |
This file contains 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
sealed class ViewState<T>(val data: T? = null) { | |
class Loading<T>(data: T? = null) : ViewState<T>(data) | |
class Error<T>(val throwable: Throwable, data: T? = null) : ViewState<T>(data) | |
class Loaded<T>(data: T? = null) : ViewState<T>(data) | |
fun isLoading(): Boolean = this is Loading | |
} |
NewerOlder