Git Product home page Git Product logo

norris's Introduction

Norris

ktlint Maintainability CI License

An app that existed even before Android existed! ๐Ÿ”ฅ

About

Norris is a small and non-trivial Android project used as

  • a showcase for some advanced techniques regarding infrastructure for large Android projects
  • a sandbox for testing new tools in the open

This project leverages on api.chucknorris.io as remote data source to implement the following use cases

  • User can search for Chuck Norris facts and share them
  • Application will offer suggestions of searches
  • Application also remembers terms searched by the user

showcase-norris

A note on tooling

Some of the tools used in this project that maybe you are not aware about:

Related blog posts

This project supports directly or indirectly a couple of posts I've posted in my blog:

Credits

  • Mathias Schilling, for the Chuck Norris facts REST API
  • Material Design Icons for the error states images
  • Jetbrains for the amazing developer experience around Kotlin and Coroutines
  • Someone in the Web for the Norris clipart โค๏ธ (I'll be happy to put your name here, ping me!)

Author

Coded by Ubiratan Soares (follow me on Mastodon)

License

The MIT License (MIT)

Copyright (c) 2019 Dotanuki Labs

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

norris's People

Contributors

dependabot[bot] avatar dotanukibot avatar renovate[bot] avatar ubiratansoares avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

norris's Issues

[QUESTION] Domain + UseCase + Livedata

Hey there! First of all, congrats on the job!

A have a little question about architecture stuff.
How would you handle with some observable use case (RxJava or LiveData) on the domain layer?

For example, there is some service updating the data on Room Database, those updates must be sent to the UI.

So basically we have ViewModel connected on some UseCase that is observing the Repository that is observing a Room query.

How would you do these kinds of connection between the layers once the Domain layer is an only Kotlin module, without android dependencies?

Thanks!!

Encrypt local files with age

We should evaluate age as an alternative to GPG to drive locally encrypted files. This for sure has impact in both local/CI environments, but eventually drives also a simpler setup for dealing with such files

Code readability

hi I know you've moved to processor recently

 when (interaction) {
            is QueryDefined -> {
                processor.process(
                    CommandTrigger(::save, interaction)
                )
            }
            else -> {
                interpret(interaction)
                    .let { transition ->
                        machine.consume(transition)
                    }
            }
        }

your impl is quite hard to understand. with QueryDefined you use processor, else you use machine.consume(transition). what are the reasons behind?

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: File contents are invalid JSON but parse using JSON5. Support for this will be removed in a future release so please change to a support .json5 file name or ensure correct JSON syntax.

This repository currently has no open or pending branches.

Detected dependencies

asdf
.tool-versions
  • ktlint 1.2.1
  • detekt 1.23.6
  • maestro 1.36.0
github-actions
.github/actions/setup-android-build/action.yml
  • actions/setup-java v4.2.1
  • gradle/gradle-build-action v3.3.0
.github/workflows/main.yml
  • actions/checkout v4.1.1@b4ffde65f46336ab88eb53be808477a3936bae11
  • asdf-vm/actions v3.0.2
  • crate-ci/typos v1.20.8
  • actions/checkout v4.1.1@b4ffde65f46336ab88eb53be808477a3936bae11
  • nick-fields/retry v3.0.0
  • actions/upload-artifact v4.3.1
  • actions/checkout v4.1.1@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/upload-artifact v4.3.1
  • actions/upload-artifact v4.3.1
  • actions/checkout v4.1.1@b4ffde65f46336ab88eb53be808477a3936bae11
  • asdf-vm/actions v3.0.2
  • actions/download-artifact v4.1.4
  • actions/checkout v4.1.1@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/download-artifact v4.1.4
  • asdf-vm/actions v3.0.2
  • actions/upload-artifact v4.3.1
  • actions/checkout v4.1.1@b4ffde65f46336ab88eb53be808477a3936bae11
  • asdf-vm/actions v3.0.2
  • gradle/wrapper-validation-action v3.3.0
  • actions/download-artifact v4.1.4
  • actions/checkout v4.1.1@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/download-artifact v4.1.4
  • EmergeTools/emerge-upload-action v1.1.0
  • actions/checkout v4.1.1@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/download-artifact v4.1.4
  • dorny/test-reporter v1.9.0
  • ubuntu 22.04
  • ubuntu 22.04
  • ubuntu 22.04
  • ubuntu 22.04
  • ubuntu 22.04
  • ubuntu 22.04
  • ubuntu 22.04
  • ubuntu 22.04
gradle
gradle.properties
settings.gradle.kts
  • org.gradle.toolchains.foojay-resolver-convention 0.8.0
  • com.gradle.enterprise 3.17.1
build.gradle.kts
app/build.gradle.kts
features/facts/build.gradle.kts
features/search/build.gradle.kts
gradle/libs.versions.toml
  • com.android.tools.build:gradle 8.3.2
  • org.jetbrains.kotlin:kotlin-gradle-plugin 1.9.23
  • com.adarshr:gradle-test-logger-plugin 4.0.0
  • org.jetbrains.kotlin:kotlin-serialization 1.9.23
  • com.dropbox.dropshots:dropshots-gradle-plugin 0.4.1
  • wtf.emulator:gradle-plugin 0.16.2
  • org.jetbrains.kotlinx:kotlinx-coroutines-core 1.8.0
  • org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm 1.8.0
  • org.jetbrains.kotlinx:kotlinx-coroutines-android 1.8.0
  • org.jetbrains.kotlinx:kotlinx-coroutines-test 1.8.0
  • org.jetbrains.kotlinx:kotlinx-serialization-core 1.6.3
  • org.jetbrains.kotlinx:kotlinx-serialization-core-jvm 1.6.3
  • org.jetbrains.kotlinx:kotlinx-serialization-json 1.6.3
  • androidx.core:core 1.12.0
  • androidx.core:core-ktx 1.12.0
  • androidx.activity:activity-ktx 1.8.2
  • androidx.lifecycle:lifecycle-common 2.7.0
  • androidx.lifecycle:lifecycle-runtime-ktx 2.7.0
  • androidx.lifecycle:lifecycle-viewmodel 2.7.0
  • androidx.lifecycle:lifecycle-viewmodel-ktx 2.7.0
  • androidx.appcompat:appcompat 1.6.1
  • androidx.swiperefreshlayout:swiperefreshlayout 1.1.0
  • androidx.coordinatorlayout:coordinatorlayout 1.2.0
  • androidx.recyclerview:recyclerview 1.3.2
  • androidx.test:core 1.5.0
  • androidx.test:core-ktx 1.5.0
  • androidx.test.ext:junit 1.1.5
  • androidx.test.ext:junit-ktx 1.1.5
  • androidx.test:runner 1.5.2
  • androidx.test:rules 1.5.0
  • androidx.test:monitor 1.6.1
  • androidx.test.espresso:espresso-core 3.5.1
  • androidx.test.espresso:espresso-intents 3.5.1
  • com.google.truth:truth 1.4.2
  • com.google.android.material:material 1.11.0
  • com.squareup.okhttp3:okhttp 4.12.0
  • com.squareup.okhttp3:logging-interceptor 4.12.0
  • com.squareup.retrofit2:retrofit 2.11.0
  • com.squareup.radiography:radiography 2.5
  • com.squareup.leakcanary:leakcanary-android 2.13
  • com.squareup.leakcanary:leakcanary-android-instrumentation 2.13
  • com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter 1.0.0
  • app.cash.turbine:turbine 1.1.0
  • io.github.resilience4j:resilience4j-retry 2.2.0
  • io.github.resilience4j:resilience4j-kotlin 2.2.0
  • junit:junit 4.13.2
  • org.slf4j:slf4j-nop 2.0.13
  • org.robolectric:robolectric 4.12.1
  • com.adevinta.android:barista 4.3.0
  • com.dropbox.dropshots:dropshots 0.4.1
  • org.testcontainers:testcontainers 1.19.7
  • org.testcontainers:toxiproxy 1.19.7
  • org.jsoup:jsoup 1.17.2
  • com.squareup.okio:okio 3.9.0
gradle/plugins/settings.gradle.kts
gradle/plugins/build.gradle.kts
platform/android/core-assets/build.gradle.kts
platform/android/core-navigator/build.gradle.kts
platform/android/core-persistence/build.gradle.kts
platform/android/testing-application/build.gradle.kts
platform/android/testing-helpers-espresso/build.gradle.kts
platform/android/testing-persistence/build.gradle.kts
platform/android/testing-screenshots/build.gradle.kts
platform/jvm/core-rest/build.gradle.kts
platform/jvm/testing-helpers/build.gradle.kts
platform/jvm/testing-mockserver/build.gradle.kts
platform/jvm/testing-rest/build.gradle.kts
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 8.7

  • Check this box to trigger a request for Renovate to run again on this repository

Crash when I clicked "search" button

Steps to reproduce:

  1. Emulator API 30
  2. Open and run project build
  3. Click "search" icon when app is ready

2021-01-24 20:07:22.019 6280-6280/? E/AndroidRuntime: FATAL EXCEPTION: main Process: io.dotanuki.demos.norris.debug, PID: 6280 java.lang.IllegalStateException: LifecycleOwner io.dotanuki.norris.facts.FactsActivity@807bd3e is attempting to register while current state is RESUMED. LifecycleOwners must call register before they are STARTED. at androidx.activity.result.ActivityResultRegistry.register(ActivityResultRegistry.java:120) at androidx.activity.ComponentActivity.registerForActivityResult(ComponentActivity.java:666) at androidx.activity.ComponentActivity.registerForActivityResult(ComponentActivity.java:675) at io.dotanuki.norris.navigator.Navigator.navigateForResult(Navigator.kt:21) at io.dotanuki.norris.facts.FactsActivity.goToSearch(FactsActivity.kt:70) at io.dotanuki.norris.facts.FactsActivity.onOptionsItemSelected(FactsActivity.kt:62)

Investigate breaking changes with AGP 4.1.x

Context

Seems that AGP 4.1.x introduces some breaking changes this project should catch

  • #74 (by Dependabot)
  • #69 (by Dependabot)
  • #71 (by Dependabot)

Goal

  • Investigate why this happens and make this project compatible with the latest stable AGP
  • Make sure that Detekt and Ktlint are also working with the latest stables

Optimise storage usage driven by CI cache

After Github introduced better visibility / management to storage used by CI caching, constantly we have to handle messages like this one

image

In addition to that, frequently we blow the 10GB budget, which is a source of cache misses. This is happening due 2 main reasons

  • #651, which doubled the consumption of cache storage based on JDK versions
  • poor cache management, although we are making the most we can of actions/cache

Two solution can contribute to improve the situation

  • stick only to jdk17 when driving CI build
  • replace action/cache with gradle/gradle-build-action, which delivers an implementation that avoids caching by branching and sticks with cache updates / invalidation at default branch level

Manage CLI tooling on top of a asdf-compatible version manager

Right now we use a couple of CLI tools and have their version hardcoded in a couple of scripts.

We'd like to extract such hardcoded versions and manage them via a proper .tool-versions file, as per defined by asdf. We could manage with adsf itself or with a compatible tool like rtx

Note that we'd need to implement the support of emulator.wtf-cli and maestro-cli for such versions managers, eventually as new plugins.

Add `UseCase` postfix

My understanding is ComposeSearchOptions, FetchCategories, FetchFacts and ManageSearchQuery are UseCases. Can you add the postfix UseCase to make its name more meaningful?

Coding style

private fun interpret(interaction: UserInteraction) =
        when (interaction) {
            OpenedScreen, RequestedFreshContent -> ::showFacts
            is NewSearch -> {
                currentQuery = (interaction as NewSearch).query
                ::showFacts
            }
            else -> throw UnsupportedUserInteraction
        }

    private suspend fun showFacts() =
        usecase.search(currentQuery)
            .map { FactDisplayRow(it) }
            .let { rows ->
                FactsPresentation(currentQuery, rows)
            }

with the current arch the app is using. Is there anyway to pass parameter to showFacts like
showFacts(query: String). Look at the code, you have to keep currentQuery as a global field. I don't think that looks good

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.