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 Identifier(val rawValue: UUID) |
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 Team(val id: UUID, val size: Int) | |
| data class TeamMember(val id: String, val name: String) |
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
| sealed class AuthenticationState | |
| data class SignedIn(val userGuid: UUID) : AuthenticationState() | |
| data class StoredCredentials(val credentials: Credentials) : AuthenticationState() | |
| object SignedOut : AuthenticationState() |
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
| sealed class AnalyticsEvent { | |
| object AccountCreated : AnalyticsEvent() | |
| data class MessageSent(val conversation: Conversation) : AnalyticsEvent() | |
| data class ProfileOpened(val participant: Participant) : AnalyticsEvent() | |
| fun parameters(): Map<Parameter, String> = when (this) { | |
| AccountCreated -> mapOf() | |
| is MessageSent -> mapOf( | |
| Parameter.PARTICIPANT_COUNT to conversation.participants.size.toString(), | |
| Parameter.IS_ARCHIVED to conversation.isArchived.toString() |
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
| fun renderViewState(viewState: ViewState) = when (viewState) { | |
| LoadingState -> showLoadingViews() | |
| is PresentingState -> showPresentingViews(viewState.viewData) | |
| is ErrorState -> showErrorViews(viewState.message) | |
| } |
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
| sealed class ViewState | |
| object LoadingState : ViewState() | |
| data class PresentingState(val viewData: ContactsViewData) : ViewState() | |
| data class ErrorState(val message: String) : ViewState() |
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
| fun onAuthenticationStateChanged(newState: AuthenticationState) = when (newState) { | |
| is AuthenticationState.SignedIn -> showSignedIn(newState.userGuid) | |
| is AuthenticationState.StoredCredentials -> showSignedIn(newState.credentials) | |
| AuthenticationState.SignedOut -> showSignedOut() | |
| } |
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
| sealed class AuthenticationState { | |
| data class SignedIn(val userGuid: UUID) : AuthenticationState() | |
| data class StoredCredentials(val credentials: Credentials) : AuthenticationState() | |
| object SignedOut : AuthenticationState() | |
| } |
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
| fun <ViewT : View> Activity.bindView(@IdRes idRes: Int): Lazy<ViewT> { | |
| return lazyUnsychronized { | |
| findViewById<ViewT>(idRes) | |
| } | |
| } | |
| class PlanningActivity : AppCompatActivity() { | |
| private val planningText by bindView<TextView>(R.id.planning_text) | |
| // or | |
| private val planningText: TextView by bindView(R.id.planning_text) |
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 kotlinx.android.synthetic.main.activity_planning.* | |
| class PlanningActivity : AppCompatActivity() { | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContentView(R.layout.activity_planning) | |
| planning_text.text = "Hello" | |
| } | |
| } |