Skip to content

Android app about space news, launches and events

Notifications You must be signed in to change notification settings

riddick-boss/2Space

Repository files navigation

2Space

Android app for every space enthusiast. Check upcoming and past SpaceX launches and find out more about each flight (e.g. data about payload).

App is published on Google Play.

Get it on Google Play

Used:

  • Kotlin
  • Hilt
  • Jetpack Compose
  • Ktor
  • Accompanist library
  • Pagination
  • Firebase Cloud Messaging
  • MVVM architecture
  • Git flow workflow

General info

App is organized in MVVM architecture. Kotlin Coroutines and Flows were used to achieve reactive approach. Data is fetched from apis (like SpaceX Api) with usage of Ktor (this enables to use code in kotlin multiplatform app in future). Whole app is organized with intent to be clean, scalable and easy to refactor. Also, SOLID rules were applied.

Screenshots

Dashboard Launches Events

Checkout also

Checkout my other repo, which contains server side code of the project. Its purpose is to fetch info about upcoming launches and send FCM notifications if necessary. Android app subscripes to this topic and shows notifications. Written in Go.

Tests

Tests were created with usage of Truth library.

Sample test:

    @Before
    fun setUp() {
        eventsApi = mock {
            onBlocking { loadUpcomingEvents() } doReturn mock()
        }
        articlesApi = mock {
            onBlocking { loadArticles(any()) } doReturn mock()
        }
        mapper = mock {
            on { toSpaceEvents(any()) } doReturn listOf(
                SpaceEvent(title = "title1", description = "desc1", imageUrl = null, newsUrl = null, videoUrl = null, type = null)
            )
            on { toSpaceArticles(any()) } doReturn listOf(
                SpaceArticle(title = "title1", summary = "summary1", imageUrl = null, url = null)
            )
        }
        repository = NewsRepositoryImpl(
            eventsApi = eventsApi,
            articlesApi = articlesApi,
            mapper = mapper
        )
    }
    
    @After
    fun tearDown() {
        unmockkAll()
    }

    @Test
    fun `loadArticles calls articles api`(): Unit = runBlocking {
        val numOfArticles = 10
        repository.loadArticles(numOfArticles)
        verify(articlesApi).loadArticles(numOfArticles)
    }
    
    @Test
    fun `loadArticles calls mapper`(): Unit = runBlocking {
        repository.loadArticles(1)
        verify(mapper).toSpaceArticles(any())
    }

Disclaimer

Author and app is not affiliated, associated, authorized, endorsed by, or in any way officially connected with Space Exploration Technologies Corp (SpaceX), or any of its subsidiaries or its affiliates. The names SpaceX as well as related names, marks, emblems and images are registered trademarks of their respective owners. This is not an official SpaceX app.