I hereby claim:
- I am scottroemeschke on github.
- I am scottroemeschke (https://keybase.io/scottroemeschke) on keybase.
- I have a public key ASDDvJY8fuJkxd2g4R9shAbVA-UFvYGpXwBf0YJFx0V9qgo
To claim this, I am signing this object:
// Some syntax, might be a bit off, written quickly :D | |
/** | |
* The question, (as I'm hearing it): how to write unit tests for my view controller when Kotlin classes are closed by default? | |
**/ | |
//------------------------------------------------------------------------------------------------------------------------------------ | |
//------------------------------------------------------------------------------------------------------------------------------------ |
I hereby claim:
To claim this, I am signing this object:
Inside config obj: | |
- Feature flags values are limited to true/false? | |
- Keys are immutable across environments. | |
- In Blinker Api: Keys come from? (Consul? Code? Variety of sources?) | |
- Do we want to add timestamp or something to flag so clients | |
can be set to invalidate all before a given time or something like this? |
fun stuff() { | |
val cal = Calendar.getInstance() | |
val date = cal.time (is a Date) // synthetic property for getTime() which returns a date | |
//but somehow at runtime this is a long (calendar has protected long called time) | |
val realDate = cal.getTime() //get ide warning to use the property syntax instead, but at run-time this is actually a date | |
methodThatTakesADate(date) | |
} | |
fun methodThatTakesADate(date: Date) { | |
println(date) |
package com.thinksincode.prboard; | |
import android.content.Intent; | |
import android.net.Uri; | |
import android.os.Bundle; | |
import android.support.constraint.Group; | |
import android.support.v7.app.AppCompatActivity; | |
import android.util.Log; | |
import android.view.View; | |
import android.widget.ProgressBar; |
fun examples() { | |
val disposables = CompositeDisposable() | |
disposables += Maybe.just("User") | |
.subscribeEmitNull { | |
if (it != null) println(it) | |
} | |
data class User(val firstName: String, val lastName: String) | |
interface UserObserver { | |
fun onUserUpdated(user: User) | |
} | |
//could also do this user observer as just a function/lambda with or without type alias | |
//typealias UserObserver = (User) -> Unit | |
interface UserRepo { |
//basic interface start something to get single with eventual result (or quit) | |
//call quit to cancel/quit the workflow prematurely | |
interface Workflow<C, Q> { | |
fun start(): Single<WorkflowResult<C,Q>> | |
fun quit() | |
} | |
//completed or quit, this comes down the single as the result of the workflow | |
//would be very high level business results (with potential data) | |
sealed class WorkflowResult<C,Q> { |
//when you have a single activity it's very easy to build abstractions, hook into those, and simplify lifecycle issues, | |
//navigation (subscreens, backbutton, new flows etc), permissions/fingerprint other annoying APIs | |
//simple psuedo-code ish examples | |
sealed class PermissionResult { | |
data class Successful(val permission: String): PermissionResult() | |
data class Failed(val failureReason: FailureReason): PermissionResult() | |
enum class FailureReason { |
//Top level Tag Interfaces - May not be needed | |
interface HelixState //Immutable State/Data for UI/Helix | |
interface HelixIntent //User intents/actions from UI | |
interface HelixEvent //External events (Internet connected, low battery warning, etc) | |
interface HelixEffect //Triggered effects (HTTP/DB calls, business logic/app layer updates etc) | |
interface HelixCommand //Commands to trigger effects (MakeLoginRequest, SchedulePendingNotification) | |
interface HelixDestination //Navigation/Routing location (URL/URI, changing sub-screens or top level flows/features) | |
typealias BeginProvider<State, Command> = () -> Begin<State, Command> | |
typealias UpdateGenerator<State, Input, Command, Destination> = (State, Input) -> Update<State, Command, Destination> |