Skip to content

Instantly share code, notes, and snippets.


Nimrod Dayan Nimrodda

View GitHub Profile
Nimrodda / KodeinDI-environmentScope.kt
Created Dec 21, 2020 — forked from SalomonBrys/KodeinDI-environmentScope.kt
Example that shows how to create a scope registry according to a server environment.
View KodeinDI-environmentScope.kt
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) {
Nimrodda / security.kt
Last active Nov 17, 2020
App signing verification
View security.kt
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)
Nimrodda / Play core in-app updates.txt
Created Sep 28, 2020
Google Play Internal App Sharing
View Play core in-app updates.txt
* 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
* 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-
Nimrodda / zshrc
Last active Apr 25, 2022
Zsh config for Android and Flutter
View zshrc
# 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
Nimrodda / Redux.kt
Created Jun 11, 2020
Redux Kotlin draft
View Redux.kt
* Copyright 2020 Nimrod Dayan
* 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
* Unless required by applicable law or agreed to in writing, software
View WorkoutSummaryController.kt
class WorkoutSummaryController : TypedEpoxyController<WorkoutSummaryViewState>(
EpoxyAsyncUtil.getAsyncBackgroundHandler()) {
override fun buildModels(viewState: WorkoutSummaryViewState) {
View WorkoutSummaryActivity.kt
class WorkoutSummaryActivity : AppCompatActivity() {
private lateinit var binding: WorkoutSummaryActivityBinding
private val viewModel: WorkoutSummaryViewModel by viewModels()
override fun onCreate(savedInstanceState: Bundle?) {
// We use View Binding here
binding = WorkoutSummaryActivityBinding.inflate(layoutInflater)
View WorkoutSummaryViewModel.kt
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 {
View WorkoutSummaryViewState.kt
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
View ViewState.kt
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